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

Commit 6fab3bb

Browse files
committed
sapi/cli: Print non-default INI settings for --ini=diff
This is a follow-up for php#17459, updating the command-line flag to not modify the behavior of `--ini`.
1 parent e6c570a commit 6fab3bb

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

‎NEWS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PHP NEWS
33
?? ??? ????, PHP 8.5.0alpha1
44

55
- CLI:
6-
. Extended --ini to print INI settings changed from the builtin default.
6+
. Add --ini=diff to print INI settings changed from the builtin default.
77
(timwolla)
88

99
- COM:

‎UPGRADING‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ PHP 8.5 UPGRADE NOTES
114114
- CLI:
115115
. Trying to set a process title that is too long with cli_set_process_title()
116116
will now fail instead of silently truncating the given title.
117-
. --ini will now print INI settings changed from the builtin default.
117+
. Added a new --ini=diff option to print INI settings changed from the builtin
118+
default.
118119

119120
========================================
120121
4. Deprecated Functionality

‎sapi/cli/cli.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ typedef enum php_cli_mode {
4949
PHP_CLI_MODE_REFLECTION_EXT_INFO = 11,
5050
PHP_CLI_MODE_REFLECTION_ZEND_EXTENSION = 12,
5151
PHP_CLI_MODE_SHOW_INI_CONFIG = 13,
52+
PHP_CLI_MODE_SHOW_INI_DIFF = 14,
5253
} php_cli_mode;
5354

5455
typedef struct php_cli_server_context {

‎sapi/cli/php_cli.c‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const opt_struct OPTIONS[] = {
159159
{13, 1, "rzendextension"},
160160
{14, 1, "ri"},
161161
{14, 1, "rextinfo"},
162-
{15, 0, "ini"},
162+
{15, 2, "ini"},
163163
/* Internal testing option -- may be changed or removed without notice,
164164
* including in patch releases. */
165165
{16, 1, "repeat"},
@@ -502,6 +502,7 @@ static void php_cli_usage(char *argv0)
502502
" starts with - or script is read from stdin\n"
503503
"\n"
504504
" --ini Show configuration file names\n"
505+
" --ini=diff Show INI entries that differ from the built-in default\n"
505506
"\n"
506507
" --rf <name> Show information about function <name>.\n"
507508
" --rc <name> Show information about class <name>.\n"
@@ -827,7 +828,15 @@ static int do_cli(int argc, char **argv) /* {{{ */
827828
reflection_what = php_optarg;
828829
break;
829830
case 15:
830-
context.mode = PHP_CLI_MODE_SHOW_INI_CONFIG;
831+
if (php_optarg) {
832+
if (strcmp(php_optarg, "diff") == 0) {
833+
context.mode = PHP_CLI_MODE_SHOW_INI_DIFF;
834+
} else {
835+
param_error = "Unknown argument for --ini\n";
836+
}
837+
} else {
838+
context.mode = PHP_CLI_MODE_SHOW_INI_CONFIG;
839+
}
831840
break;
832841
case 16:
833842
num_repeats = atoi(php_optarg);
@@ -1106,7 +1115,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
11061115
zend_printf("Loaded Configuration File: %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)");
11071116
zend_printf("Scan for additional .ini files in: %s\n", php_ini_scanned_path ? php_ini_scanned_path : "(none)");
11081117
zend_printf("Additional .ini files parsed: %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
1109-
zend_printf("\n");
1118+
break;
1119+
}
1120+
case PHP_CLI_MODE_SHOW_INI_DIFF:
1121+
{
11101122
zend_printf("Non-default INI settings:\n");
11111123
zend_ini_entry *ini_entry;
11121124
HashTable *sorted = zend_array_dup(EG(ini_directives));

0 commit comments

Comments
(0)

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