From 331ac35f5802145648fefa6312aa54c7306b93d6 Mon Sep 17 00:00:00 2001 From: Richard Schneeman Date: Sun, 11 May 2025 08:53:56 -0500 Subject: [PATCH] Fix visibility of whitespace in config output (#18527) When a config var has whitespace (especially trailing whitespace) it is hard to see. This commit wraps the values (if they exist) in double quotes, so the difference is visually observable: Before: ``` $ export PHP_INI_SCAN_DIR="/opt/homebrew/etc/php/8.4/conf.d " $ ./sapi/cli/php --ini Configuration File (php.ini) Path: /usr/local/lib Loaded Configuration File: /opt/homebrew/etc/php/8.4/conf.d Scan for additional .ini files in: (none) Additional .ini files parsed: (none) ``` > Note > The above output has trailing whitespace that is not visible, you can see it if you copy it into an editor: After: ``` $ ./sapi/cli/php --ini Configuration File (php.ini) Path: "/usr/local/lib" Loaded Configuration File: "/opt/homebrew/etc/php/8.4/conf.d " Scan for additional .ini files in: (none) Additional .ini files parsed: (none) ``` Above the whitespace is now visible `/opt/homebrew/etc/php/8.4/conf.d `. Close #18390 --- sapi/cli/php_cli.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 91dd0864c2f..8a8f1389534 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1106,9 +1106,17 @@ do_repeat: case PHP_CLI_MODE_SHOW_INI_CONFIG: { - zend_printf("Configuration File (php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH); - zend_printf("Loaded Configuration File: %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)"); - zend_printf("Scan for additional .ini files in: %s\n", php_ini_scanned_path ? php_ini_scanned_path : "(none)"); + zend_printf("Configuration File (php.ini) Path: \"%s\"\n", PHP_CONFIG_FILE_PATH); + if (php_ini_scanned_path) { + zend_printf("Loaded Configuration File: \"%s\"\n", php_ini_scanned_path); + } else { + zend_printf("Loaded Configuration File: (none)\n"); + } + if (php_ini_opened_path) { + zend_printf("Scan for additional .ini files in: \"%s\"\n", php_ini_opened_path); + } else { + zend_printf("Scan for additional .ini files in: (none)\n"); + } zend_printf("Additional .ini files parsed: %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)"); break; }