From 073b6ea818286fe838097d49f92ae379d5f217f0 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 22 Feb 2021 12:24:15 +0100 Subject: [PATCH] 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. --- NEWS | 3 +++ ext/standard/info.c | 2 +- .../tests/general_functions/bug80771.phpt | 16 ++++++++++++++++ sapi/cli/php_cli.c | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/general_functions/bug80771.phpt diff --git a/NEWS b/NEWS index 9c69fcd16b4..7080e5058a7 100644 --- a/NEWS +++ b/NEWS @@ -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: diff --git a/ext/standard/info.c b/ext/standard/info.c index 1e58b31a0fb..8e21d77f137 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -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); } diff --git a/ext/standard/tests/general_functions/bug80771.phpt b/ext/standard/tests/general_functions/bug80771.phpt new file mode 100644 index 00000000000..a8c9e7b5429 --- /dev/null +++ b/ext/standard/tests/general_functions/bug80771.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 91f400aca4c..0fd167de63d 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -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;