mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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.
This commit is contained in:
parent
ee16d99504
commit
920b4b249f
18 changed files with 4 additions and 327 deletions
|
@ -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
|
|
@ -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
|
|
@ -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"
|
|
@ -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)
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"
|
|
@ -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"]=>
|
||||
|
|
30
main/main.c
30
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."
|
|
@ -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==
|
|
@ -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"
|
|
@ -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"
|
|
@ -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"
|
Loading…
Add table
Add a link
Reference in a new issue