Skip to content

Commit 073b6ea

Browse files
committed
Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
There is no good reason not to show the credits in text based SAPIs, except for brevity. Thus, we suppress the credits from `php -i`. Closes GH-6710.
1 parent d7c98ca commit 073b6ea

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
- Session:
1818
. Fixed bug #80774 (session_name() problem with backslash). (cmb)
1919

20+
- Standard:
21+
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)
22+
2023
04 Mar 2021, php 7.4.16
2124

2225
- Core:

ext/standard/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
10001000
}
10011001

10021002

1003-
if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
1003+
if (flag & PHP_INFO_CREDITS) {
10041004
php_info_print_hr();
10051005
php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE);
10061006
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI)
3+
--FILE--
4+
<?php
5+
ob_start();
6+
phpinfo(INFO_CREDITS);
7+
$info = ob_get_clean();
8+
9+
ob_start();
10+
phpcredits();
11+
$credits = ob_get_clean();
12+
13+
var_dump(strpos($info, $credits) !== false);
14+
?>
15+
--EXPECT--
16+
bool(true)

sapi/cli/php_cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
642642
goto err;
643643
}
644644
request_started = 1;
645-
php_print_info(0xFFFFFFFF);
645+
php_print_info(PHP_INFO_ALL & ~PHP_INFO_CREDITS);
646646
php_output_end_all();
647647
exit_status = (c == '?' && argc > 1 && !strchr(argv[1], c));
648648
goto out;

0 commit comments

Comments
 (0)