From 920b4b249f71e6cbfd795f81c6a08126a33c659e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 28 Jan 2019 12:54:46 +0100 Subject: [PATCH] Remove track_errors and $php_errormsg This has been deprecated in PHP 7.2 as part of https://wiki.php.net/rfc/deprecations_php_7_2. --- Zend/tests/bug47320.phpt | 26 -------------- Zend/tests/bug54585.phpt | 17 --------- Zend/tests/bug67858.phpt | 21 ----------- Zend/tests/php_errormsg_misoptimization.phpt | 22 ------------ ext/opcache/Optimizer/zend_inference.c | 4 +-- ext/opcache/Optimizer/zend_ssa.c | 2 -- ext/opcache/Optimizer/zend_ssa.h | 1 - ext/opcache/tests/bug75893.phpt | 22 ------------ .../tests/file/parse_ini_file_variation3.phpt | 5 +-- main/main.c | 30 ++-------------- main/php_globals.h | 1 - php.ini-development | 8 ----- php.ini-production | 15 -------- tests/basic/027.phpt | 33 ----------------- tests/output/bug74815.phpt | 19 ---------- tests/run-test/test005.phpt | 36 ------------------- tests/run-test/test008.phpt | 33 ----------------- tests/run-test/test008a.phpt | 36 ------------------- 18 files changed, 4 insertions(+), 327 deletions(-) delete mode 100644 Zend/tests/bug47320.phpt delete mode 100644 Zend/tests/bug54585.phpt delete mode 100644 Zend/tests/bug67858.phpt delete mode 100644 Zend/tests/php_errormsg_misoptimization.phpt delete mode 100644 ext/opcache/tests/bug75893.phpt delete mode 100644 tests/basic/027.phpt delete mode 100644 tests/output/bug74815.phpt delete mode 100644 tests/run-test/test005.phpt delete mode 100644 tests/run-test/test008.phpt delete mode 100644 tests/run-test/test008a.phpt diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt deleted file mode 100644 index 47db35edac..0000000000 --- a/Zend/tests/bug47320.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Bug #47320 ($php_errormsg out of scope in functions) ---INI-- -display_errors=0 -track_errors=1 ---FILE-- - ---EXPECT-- -$php_errormsg in global: substr() expects at least 2 parameters, 1 given -$php_errormsg in function: strpos() expects at least 2 parameters, 1 given -$GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given diff --git a/Zend/tests/bug54585.phpt b/Zend/tests/bug54585.phpt deleted file mode 100644 index deabe55af8..0000000000 --- a/Zend/tests/bug54585.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #54585 (track_errors causes segfault) ---INI-- -track_errors=On ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: cos in %sbug54585.php on line 3 -ok diff --git a/Zend/tests/bug67858.phpt b/Zend/tests/bug67858.phpt deleted file mode 100644 index 1186cd6a6f..0000000000 --- a/Zend/tests/bug67858.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #67858: Leak when $php_errormsg already set ---INI-- -track_errors=1 -error_reporting=E_ALL ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: var in %s on line %d -string(23) "Undefined variable: var" diff --git a/Zend/tests/php_errormsg_misoptimization.phpt b/Zend/tests/php_errormsg_misoptimization.phpt deleted file mode 100644 index ae389db248..0000000000 --- a/Zend/tests/php_errormsg_misoptimization.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -The variable $php_errormsg shouldn't be optimized as it may be unpredictably modified ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d - -Warning: A non-numeric value encountered in %s on line %d -int(1) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 648e4e621c..9a875fd90b 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -1844,9 +1844,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{ /* }}} */ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) { - if (alias == PHP_ERRORMSG_ALIAS) { - return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN; - } else if (alias == HTTP_RESPONSE_HEADER_ALIAS) { + if (alias == HTTP_RESPONSE_HEADER_ALIAS) { return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN; } else { return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index a3a5130385..2e5c463978 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -1133,8 +1133,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_ for (i = 0; i < op_array->last_var; i++) { if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) { ssa_vars[i].alias = SYMTABLE_ALIAS; - } else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) { - ssa_vars[i].alias = PHP_ERRORMSG_ALIAS; } else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) { ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS; } diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 4ee442dcab..08aa5b9c1a 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -95,7 +95,6 @@ typedef struct _zend_ssa_op { typedef enum _zend_ssa_alias_kind { NO_ALIAS, SYMTABLE_ALIAS, - PHP_ERRORMSG_ALIAS, HTTP_RESPONSE_HEADER_ALIAS } zend_ssa_alias_kind; diff --git a/ext/opcache/tests/bug75893.phpt b/ext/opcache/tests/bug75893.phpt deleted file mode 100644 index 670993c50c..0000000000 --- a/ext/opcache/tests/bug75893.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #75893: file_get_contents $http_response_header variable bugged with opcache ---INI-- -opcache.enable_cli=1 -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d -string(1) "U" diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7..acdb4d83eb 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/main/main.c b/main/main.c index 69d5ccc715..1e0dc9571e 100644 --- a/main/main.c +++ b/main/main.c @@ -731,7 +731,6 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals) - STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals) @@ -1095,18 +1094,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ efree(docref_buf); } - if (PG(track_errors) && module_initialized && EG(active) && - (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) { - zval tmp; - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } if (replace_buffer) { zend_string_free(replace_buffer); } else { @@ -1414,19 +1401,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u return; } - if (PG(track_errors) && module_initialized && EG(active)) { - zval tmp; - - ZVAL_STRINGL(&tmp, buffer, buffer_len); - if (EG(current_execute_data)) { - if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) { - zval_ptr_dtor(&tmp); - } - } else { - zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp); - } - } - efree(buffer); } /* }}} */ @@ -2364,13 +2338,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod struct { const long error_level; const char *phrase; - const char *directives[17]; /* Remember to change this if the number of directives change */ + const char *directives[18]; /* Remember to change this if the number of directives change */ } directives[2] = { { E_DEPRECATED, "Directive '%s' is deprecated", { - "track_errors", NULL } }, @@ -2394,6 +2367,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod "safe_mode_allowed_env_vars", "safe_mode_protected_env_vars", "zend.ze1_compatibility_mode", + "track_errors", NULL } } diff --git a/main/php_globals.h b/main/php_globals.h index 077fa1f4bb..486d640f7f 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -66,7 +66,6 @@ struct _php_core_globals { zend_long memory_limit; zend_long max_input_time; - zend_bool track_errors; zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; diff --git a/php.ini-development b/php.ini-development index 0566267c2f..64c938ae0d 100644 --- a/php.ini-development +++ b/php.ini-development @@ -519,14 +519,6 @@ report_memleaks = On ; This setting is on by default. ;report_zend_debug = 0 -; Store the last error/warning message in $php_errormsg (boolean). -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 diff --git a/php.ini-production b/php.ini-production index 9ae24dba2c..98ab119168 100644 --- a/php.ini-production +++ b/php.ini-production @@ -153,11 +153,6 @@ ; Development Value: Off ; Production Value: Off -; track_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - ; variables_order ; Default Value: "EGPCS" ; Development Value: "GPCS" @@ -524,16 +519,6 @@ report_memleaks = On ; This setting is on by default. ;report_zend_debug = 0 -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 diff --git a/tests/basic/027.phpt b/tests/basic/027.phpt deleted file mode 100644 index 0528e835a1..0000000000 --- a/tests/basic/027.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Handling of max_input_nesting_level being reached ---INI-- -always_populate_raw_post_data=0 -display_errors=0 -max_input_nesting_level=10 -max_input_vars=1000 -track_errors=1 -log_errors=0 ---POST-- -a=1&b=ZYX&c[][][][][][][][][][][][][][][][][][][][][][]=123&d=123&e[][]][]=3 ---FILE-- - ---EXPECT-- -array(4) { - ["a"]=> - string(1) "1" - ["b"]=> - string(3) "ZYX" - ["d"]=> - string(3) "123" - ["e"]=> - array(1) { - [0]=> - array(1) { - [0]=> - string(1) "3" - } - } -} -string(115) "Unknown: Input variable nesting level exceeded 10. To increase the limit change max_input_nesting_level in php.ini." diff --git a/tests/output/bug74815.phpt b/tests/output/bug74815.phpt deleted file mode 100644 index 1d9c825999..0000000000 --- a/tests/output/bug74815.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #74815 crash with a combination of INI entries at startup ---FILE-- - -==DONE== ---CLEAN-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -%A -==DONE== diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt deleted file mode 100644 index a95281fc13..0000000000 --- a/tests/run-test/test005.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Error message handling (with ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -NULL -string(%d) "%sivision by zer%s" diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt deleted file mode 100644 index c289e7a696..0000000000 --- a/tests/run-test/test008.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Error message handling (without ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -string(%d) "%sivision by zer%s" diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt deleted file mode 100644 index d247eb36c2..0000000000 --- a/tests/run-test/test008a.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Error message handling (with ZendOpcache) ---SKIPIF-- - ---INI-- -track_errors=1 ---FILE-- - ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 -string(1) "1" -string(5) "32767" -string(1) "0" -string(1) "1" -string(1) "0" -NULL -string(%d) "%sivision by zer%s" -- 2.50.1