+++ /dev/null
---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
+++ /dev/null
---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
+++ /dev/null
---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"
+++ /dev/null
---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)
/* }}} */
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;
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;
}
typedef enum _zend_ssa_alias_kind {
NO_ALIAS,
SYMTABLE_ALIAS,
- PHP_ERRORMSG_ALIAS,
HTTP_RESPONSE_HEADER_ALIAS
} zend_ssa_alias_kind;
+++ /dev/null
---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"
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
-track_errors = Off
docref_root = "/phpmanual/"
docref_ext = .html
--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"]=>
string(0) ""
["report_memleaks"]=>
string(1) "1"
- ["track_errors"]=>
- string(0) ""
["docref_root"]=>
string(11) "/phpmanual/"
["docref_ext"]=>
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)
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 {
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);
}
/* }}} */
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
}
},
"safe_mode_allowed_env_vars",
"safe_mode_protected_env_vars",
"zend.ze1_compatibility_mode",
+ "track_errors",
NULL
}
}
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;
; 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
; 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"
; 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
+++ /dev/null
---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."
+++ /dev/null
---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==
+++ /dev/null
---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"
+++ /dev/null
---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"
+++ /dev/null
---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"