mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
sapi/cli: Extend --ini
to print INI settings changed from the builtin default (#17459)
* sapi/cli: Extend `--ini` to print INI settings changed from the builtin default This is intended to make it easier to check whether or not a given INI setting is changed from the default when building reproducers for a bugreport, without forgetting any that might be relevant to the report. As an example, running `sapi/cli/php -c /etc/php/8.3/cli/ --ini` on my Ubuntu will now output: Configuration File (php.ini) Path: /usr/local/lib Loaded Configuration File: /etc/php/8.3/cli/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) Non-standard INI settings: allow_url_include: "0" -> "" auto_append_file: (none) -> "" auto_prepend_file: (none) -> "" display_errors: "1" -> "" display_startup_errors: "1" -> "" enable_dl: "1" -> "" error_reporting: (none) -> "22527" html_errors: "1" -> "0" ignore_repeated_errors: "0" -> "" ignore_repeated_source: "0" -> "" implicit_flush: "0" -> "1" log_errors: "0" -> "1" mail.add_x_header: "0" -> "" mail.mixed_lf_and_crlf: "0" -> "" max_execution_time: "30" -> "0" memory_limit: "128M" -> "-1" request_order: (none) -> "GP" session.cookie_httponly: "0" -> "" session.gc_divisor: "100" -> "1000" session.gc_probability: "1" -> "0" session.sid_bits_per_character: "4" -> "5" session.sid_length: "32" -> "26" short_open_tag: "1" -> "" unserialize_callback_func: (none) -> "" user_dir: (none) -> "" variables_order: "EGPCS" -> "GPCS" zend.assertions: "1" -> "-1" zend.exception_ignore_args: "0" -> "1" zend.exception_string_param_max_len: "15" -> "0" * Improve phrasing Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz> * NEWS/UPGRADING --------- Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
This commit is contained in:
parent
107bd080a5
commit
e3798c2ab9
5 changed files with 40 additions and 0 deletions
|
@ -588,6 +588,14 @@ BOOL WINAPI php_cli_win32_ctrl_handler(DWORD sig)
|
|||
#endif
|
||||
/*}}}*/
|
||||
|
||||
static int zend_ini_entry_cmp(Bucket *a, Bucket *b)
|
||||
{
|
||||
zend_ini_entry *A = Z_PTR(a->val);
|
||||
zend_ini_entry *B = Z_PTR(b->val);
|
||||
|
||||
return zend_binary_strcasecmp(ZSTR_VAL(A->name), ZSTR_LEN(A->name), ZSTR_VAL(B->name), ZSTR_LEN(B->name));
|
||||
}
|
||||
|
||||
static int do_cli(int argc, char **argv) /* {{{ */
|
||||
{
|
||||
int c;
|
||||
|
@ -1096,6 +1104,31 @@ do_repeat:
|
|||
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("Additional .ini files parsed: %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
|
||||
zend_printf("\n");
|
||||
zend_printf("Non-default INI settings:\n");
|
||||
zend_ini_entry *ini_entry;
|
||||
HashTable *sorted = zend_array_dup(EG(ini_directives));
|
||||
zend_array_sort(sorted, zend_ini_entry_cmp, 1);
|
||||
ZEND_HASH_PACKED_FOREACH_PTR(sorted, ini_entry) {
|
||||
if (ini_entry->value == NULL && ini_entry->def->value == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (ini_entry->value != NULL && ini_entry->def->value != NULL && zend_string_equals_cstr(ini_entry->value, ini_entry->def->value, ini_entry->def->value_length)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
zend_printf(
|
||||
"%s: %s%s%s -> %s%s%s\n",
|
||||
ZSTR_VAL(ini_entry->name),
|
||||
ini_entry->def->value ? "\"" : "",
|
||||
ini_entry->def->value ? ini_entry->def->value : "(none)",
|
||||
ini_entry->def->value ? "\"" : "",
|
||||
ini_entry->value ? "\"" : "",
|
||||
ini_entry->value ? ZSTR_VAL(ini_entry->value) : "(none)",
|
||||
ini_entry->value ? "\"" : ""
|
||||
);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
zend_array_destroy(sorted);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue