]> granicus.if.org Git - php/commitdiff
Remove track_errors and $php_errormsg
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 28 Jan 2019 11:54:46 +0000 (12:54 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 28 Jan 2019 14:58:23 +0000 (15:58 +0100)
This has been deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.

18 files changed:
Zend/tests/bug47320.phpt [deleted file]
Zend/tests/bug54585.phpt [deleted file]
Zend/tests/bug67858.phpt [deleted file]
Zend/tests/php_errormsg_misoptimization.phpt [deleted file]
ext/opcache/Optimizer/zend_inference.c
ext/opcache/Optimizer/zend_ssa.c
ext/opcache/Optimizer/zend_ssa.h
ext/opcache/tests/bug75893.phpt [deleted file]
ext/standard/tests/file/parse_ini_file_variation3.phpt
main/main.c
main/php_globals.h
php.ini-development
php.ini-production
tests/basic/027.phpt [deleted file]
tests/output/bug74815.phpt [deleted file]
tests/run-test/test005.phpt [deleted file]
tests/run-test/test008.phpt [deleted file]
tests/run-test/test008a.phpt [deleted file]

diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt
deleted file mode 100644 (file)
index 47db35e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #47320 ($php_errormsg out of scope in functions)
---INI--
-display_errors=0
-track_errors=1
---FILE--
-<?php
-if (!@substr('no 2nd parameter')) {
-    echo '$php_errormsg in global: ' . $php_errormsg . "\n";
-}
-
-function foo() {
-    if (!@strpos('no 2nd parameter')) {
-        echo '$php_errormsg in function: ' . $php_errormsg . "\n";
-
-        echo '$GLOBALS[php_errormsg] in function: ' .
-                $GLOBALS['php_errormsg'] . "\n";
-    }
-}
-
-foo();
-?>
---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 (file)
index deabe55..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #54585 (track_errors causes segfault)
---INI--
-track_errors=On
---FILE--
-<?php
-function testing($source) {
-    unset($source[$cos]);
-}
-testing($_GET);
-echo "ok\n";
-?>
---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 (file)
index 1186cd6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #67858: Leak when $php_errormsg already set
---INI--
-track_errors=1
-error_reporting=E_ALL
---FILE--
-<?php
-
-function f() {
-    $php_errormsg = [1, 2, 3];
-    echo $var;
-    var_dump($php_errormsg);
-}
-f();
-
-?>
---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 (file)
index ae389db..0000000
+++ /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--
-<?php
-
-function test() {
-    $php_errormsg = 1;
-    echo $undef;
-    var_dump($php_errormsg + 1);
-}
-test();
-
-?>
---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)
index 648e4e621c95d20abfe40c4a155cb86c7a160107..9a875fd90b656d1112cf25ef6cdb6109eaeff712 100644 (file)
@@ -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;
index a3a5130385f383b991d5a71a0b8b99ad269ba637..2e5c4639789c051f0fa6b313001dd32f4e4bbc81 100644 (file)
@@ -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;
                }
index 4ee442dcab6d67c34ce481f60d1bf7eba7c2ffb5..08aa5b9c1afe552ab01a6062076bb1e6639c1476 100644 (file)
@@ -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 (file)
index 670993c..0000000
+++ /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--
-<?php
-
-function test() {
-    echo $undef;
-    $foo = $php_errormsg;
-    var_dump($foo[0]);
-}
-
-test();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: undef in %s on line %d
-string(1) "U"
index 96d44433f7045af60e7c4504904181fa5fef7efa..acdb4d83ebe8e7ce66cbc9f25c24525e6aea8e24 100644 (file)
@@ -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"]=>
index 69d5ccc715e4699a4438cffcd4d06d746428f136..1e0dc9571e26a68a3605c1c3ce35f330374e87be 100644 (file)
@@ -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
                                }
                        }
index 077fa1f4bba2feba98c3de095f5bd697cb28a409..486d640f7f9dfb2c569b0a93c188abce111ba925 100644 (file)
@@ -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;
index 0566267c2f538f1a343b5866cf1674f2286ab0de..64c938ae0d07d75eaa193a7190739108c25f0d9f 100644 (file)
@@ -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
index 9ae24dba2c811241021a21ae3ef57454a51b0e33..98ab119168f09e67cdb72e12cf6638f9df0bba5e 100644 (file)
 ;   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 (file)
index 0528e83..0000000
+++ /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--
-<?php
-var_dump($_POST, $php_errormsg);
-?>
---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 (file)
index 1d9c825..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #74815 crash with a combination of INI entries at startup
---FILE--
-<?php
-
-$php = getenv("TEST_PHP_EXECUTABLE");
-
-echo shell_exec("$php -n -d error_log=".__DIR__."/error_log.tmp -d error_reporting=E_ALL -d log_errors=On -d track_errors=On -v");
-
-?>
-==DONE==
---CLEAN--
-<?php
-unlink(__DIR__.'/error_log.tmp');
-?>
---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 (file)
index a95281f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-extension_loaded("Zend Opcache") or die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---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 (file)
index c289e7a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Error message handling (without ZendOpcache)
---SKIPIF--
-<?php
-!extension_loaded("Zend Opcache") or die("skip Zend Opcache is loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', "0");
-var_dump(ini_get('display_errors'));
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---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 (file)
index d247eb3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-if (!extension_loaded("Zend Opcache")) die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---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"