Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Only quote php --ini values when out is a tty #18583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schneems wants to merge 1 commit into php:master from schneems:schneems/ini-tty-fyi
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ PHP NEWS
. Drop support for -z CLI/CGI flag. (nielsdos)
. Fixed GH-17956 - development server 404 page does not adapt to mobiles.
(pascalchevrel)
. Changed `php --ini` to quotes some values with double quotes, to
help humans debug unexpected whitespace, when stdout is a tty.
(schneems)

- CURL:
. Added CURLFOLLOW_ALL, CURLFOLLOW_OBEYCODE and CURLFOLLOW_FIRSTONLY
Expand Down
34 changes: 23 additions & 11 deletions sapi/cli/php_cli.c
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1106,17 +1106,29 @@ static int do_cli(int argc, char **argv) /* {{{ */

case PHP_CLI_MODE_SHOW_INI_CONFIG:
{
zend_printf("Configuration File (php.ini) Path: \"%s\"\n", PHP_CONFIG_FILE_PATH);
if (php_ini_opened_path) {
zend_printf("Loaded Configuration File: \"%s\"\n", php_ini_opened_path);
} else {
zend_printf("Loaded Configuration File: (none)\n");
}
if (php_ini_scanned_path) {
zend_printf("Scan for additional .ini files in: \"%s\"\n", php_ini_scanned_path);
} else {
zend_printf("Scan for additional .ini files in: (none)\n");
}
int is_tty = 0;
#ifdef HAVE_UNISTD_H
is_tty = isatty(STDOUT_FILENO);
#elif defined(PHP_WIN32)
is_tty = php_win32_console_fileno_is_console(STDOUT_FILENO) && php_win32_console_fileno_has_vt100(STDOUT_FILENO);
#endif
char *quote = is_tty ? "\"" : "";

zend_printf("Configuration File (php.ini) Path: %s%s%s\n",
quote,
PHP_CONFIG_FILE_PATH,
quote
);
zend_printf("Loaded Configuration File: %s%s%s\n",
php_ini_opened_path ? quote : "",
php_ini_opened_path ? php_ini_opened_path : "(none)",
php_ini_opened_path ? quote : ""
);
zend_printf("Scan for additional .ini files in: %s%s%s\n",
php_ini_scanned_path ? quote : "",
php_ini_scanned_path ? php_ini_scanned_path : "(none)",
php_ini_scanned_path ? quote : ""
);
zend_printf("Additional .ini files parsed: %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
break;
}
Expand Down

AltStyle によって変換されたページ (->オリジナル) /