Skip to content

Commit 920b4b2

Browse files
committed
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.
1 parent ee16d99 commit 920b4b2

18 files changed

+4
-327
lines changed

Zend/tests/bug47320.phpt

-26
This file was deleted.

Zend/tests/bug54585.phpt

-17
This file was deleted.

Zend/tests/bug67858.phpt

-21
This file was deleted.

Zend/tests/php_errormsg_misoptimization.phpt

-22
This file was deleted.

ext/opcache/Optimizer/zend_inference.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1844,9 +1844,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
18441844
/* }}} */
18451845

18461846
static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
1847-
if (alias == PHP_ERRORMSG_ALIAS) {
1848-
return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
1849-
} else if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
1847+
if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
18501848
return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN;
18511849
} else {
18521850
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;

ext/opcache/Optimizer/zend_ssa.c

-2
Original file line numberDiff line numberDiff line change
@@ -1133,8 +1133,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
11331133
for (i = 0; i < op_array->last_var; i++) {
11341134
if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
11351135
ssa_vars[i].alias = SYMTABLE_ALIAS;
1136-
} else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) {
1137-
ssa_vars[i].alias = PHP_ERRORMSG_ALIAS;
11381136
} else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) {
11391137
ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS;
11401138
}

ext/opcache/Optimizer/zend_ssa.h

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ typedef struct _zend_ssa_op {
9595
typedef enum _zend_ssa_alias_kind {
9696
NO_ALIAS,
9797
SYMTABLE_ALIAS,
98-
PHP_ERRORMSG_ALIAS,
9998
HTTP_RESPONSE_HEADER_ALIAS
10099
} zend_ssa_alias_kind;
101100

ext/opcache/tests/bug75893.phpt

-22
This file was deleted.

ext/standard/tests/file/parse_ini_file_variation3.phpt

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ log_errors_max_len = 1024
4343
ignore_repeated_errors = Off
4444
ignore_repeated_source = Off
4545
report_memleaks = On
46-
track_errors = Off
4746
docref_root = "/phpmanual/"
4847
docref_ext = .html
4948
@@ -77,7 +76,7 @@ foreach($newdirs as $newdir) {
7776
--EXPECTF--
7877
*** Testing parse_ini_file() : variation ***
7978
New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
80-
array(11) {
79+
array(10) {
8180
["error_reporting"]=>
8281
string(5) "32767"
8382
["display_errors"]=>
@@ -94,8 +93,6 @@ array(11) {
9493
string(0) ""
9594
["report_memleaks"]=>
9695
string(1) "1"
97-
["track_errors"]=>
98-
string(0) ""
9996
["docref_root"]=>
10097
string(11) "/phpmanual/"
10198
["docref_ext"]=>

main/main.c

+2-28
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ PHP_INI_BEGIN()
731731
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
732732
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
733733
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)
734-
STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
735734

736735
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals)
737736
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
10951094
efree(docref_buf);
10961095
}
10971096

1098-
if (PG(track_errors) && module_initialized && EG(active) &&
1099-
(Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
1100-
zval tmp;
1101-
ZVAL_STRINGL(&tmp, buffer, buffer_len);
1102-
if (EG(current_execute_data)) {
1103-
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
1104-
zval_ptr_dtor(&tmp);
1105-
}
1106-
} else {
1107-
zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
1108-
}
1109-
}
11101097
if (replace_buffer) {
11111098
zend_string_free(replace_buffer);
11121099
} else {
@@ -1414,19 +1401,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
14141401
return;
14151402
}
14161403

1417-
if (PG(track_errors) && module_initialized && EG(active)) {
1418-
zval tmp;
1419-
1420-
ZVAL_STRINGL(&tmp, buffer, buffer_len);
1421-
if (EG(current_execute_data)) {
1422-
if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
1423-
zval_ptr_dtor(&tmp);
1424-
}
1425-
} else {
1426-
zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
1427-
}
1428-
}
1429-
14301404
efree(buffer);
14311405
}
14321406
/* }}} */
@@ -2364,13 +2338,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
23642338
struct {
23652339
const long error_level;
23662340
const char *phrase;
2367-
const char *directives[17]; /* Remember to change this if the number of directives change */
2341+
const char *directives[18]; /* Remember to change this if the number of directives change */
23682342
} directives[2] = {
23692343
{
23702344
E_DEPRECATED,
23712345
"Directive '%s' is deprecated",
23722346
{
2373-
"track_errors",
23742347
NULL
23752348
}
23762349
},
@@ -2394,6 +2367,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
23942367
"safe_mode_allowed_env_vars",
23952368
"safe_mode_protected_env_vars",
23962369
"zend.ze1_compatibility_mode",
2370+
"track_errors",
23972371
NULL
23982372
}
23992373
}

main/php_globals.h

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ struct _php_core_globals {
6666
zend_long memory_limit;
6767
zend_long max_input_time;
6868

69-
zend_bool track_errors;
7069
zend_bool display_errors;
7170
zend_bool display_startup_errors;
7271
zend_bool log_errors;

php.ini-development

-8
Original file line numberDiff line numberDiff line change
@@ -519,14 +519,6 @@ report_memleaks = On
519519
; This setting is on by default.
520520
;report_zend_debug = 0
521521

522-
; Store the last error/warning message in $php_errormsg (boolean).
523-
; This directive is DEPRECATED.
524-
; Default Value: Off
525-
; Development Value: Off
526-
; Production Value: Off
527-
; http://php.net/track-errors
528-
;track_errors = Off
529-
530522
; Turn off normal error reporting and emit XML-RPC error XML
531523
; http://php.net/xmlrpc-errors
532524
;xmlrpc_errors = 0

php.ini-production

-15
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@
153153
; Development Value: Off
154154
; Production Value: Off
155155

156-
; track_errors
157-
; Default Value: Off
158-
; Development Value: On
159-
; Production Value: Off
160-
161156
; variables_order
162157
; Default Value: "EGPCS"
163158
; Development Value: "GPCS"
@@ -524,16 +519,6 @@ report_memleaks = On
524519
; This setting is on by default.
525520
;report_zend_debug = 0
526521

527-
; Store the last error/warning message in $php_errormsg (boolean). Setting this value
528-
; to On can assist in debugging and is appropriate for development servers. It should
529-
; however be disabled on production servers.
530-
; This directive is DEPRECATED.
531-
; Default Value: Off
532-
; Development Value: Off
533-
; Production Value: Off
534-
; http://php.net/track-errors
535-
;track_errors = Off
536-
537522
; Turn off normal error reporting and emit XML-RPC error XML
538523
; http://php.net/xmlrpc-errors
539524
;xmlrpc_errors = 0

tests/basic/027.phpt

-33
This file was deleted.

tests/output/bug74815.phpt

-19
This file was deleted.

tests/run-test/test005.phpt

-36
This file was deleted.

0 commit comments

Comments
 (0)