Skip to content

Commit

Permalink
Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
Browse files Browse the repository at this point in the history
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 phpGH-6710.
  • Loading branch information
cmb69 committed Feb 22, 2021
1 parent d7c98ca commit 073b6ea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ PHP NEWS
- Session:
. Fixed bug #80774 (session_name() problem with backslash). (cmb)

- Standard:
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)

04 Mar 2021, php 7.4.16

- Core:
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
}


if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
if (flag & PHP_INFO_CREDITS) {
php_info_print_hr();
php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE);
}
Expand Down
16 changes: 16 additions & 0 deletions ext/standard/tests/general_functions/bug80771.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI)
--FILE--
<?php
ob_start();
phpinfo(INFO_CREDITS);
$info = ob_get_clean();

ob_start();
phpcredits();
$credits = ob_get_clean();

var_dump(strpos($info, $credits) !== false);
?>
--EXPECT--
bool(true)
2 changes: 1 addition & 1 deletion sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
goto err;
}
request_started = 1;
php_print_info(0xFFFFFFFF);
php_print_info(PHP_INFO_ALL & ~PHP_INFO_CREDITS);
php_output_end_all();
exit_status = (c == '?' && argc > 1 && !strchr(argv[1], c));
goto out;
Expand Down

0 comments on commit 073b6ea

Please sign in to comment.