Skip to content

Commit 8e5b381

Browse files
committed
Fix bug #72162 (again)
Not sure what the previous fix was supposed to do. The issue was that error_reporting() simply assumes that the value must either be an integer or a string. Fixed by using zpp properly.
1 parent 395863b commit 8e5b381

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Zend/zend_builtin_functions.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,23 +689,22 @@ ZEND_FUNCTION(each)
689689
Return the current error_reporting level, and if an argument was passed - change to the new level */
690690
ZEND_FUNCTION(error_reporting)
691691
{
692-
zval *err;
692+
zend_long err;
693693
int old_error_reporting;
694694

695695
#ifndef FAST_ZPP
696-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &err) == FAILURE) {
696+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &err) == FAILURE) {
697697
return;
698698
}
699699
#else
700700
ZEND_PARSE_PARAMETERS_START(0, 1)
701701
Z_PARAM_OPTIONAL
702-
Z_PARAM_ZVAL(err)
702+
Z_PARAM_LONG(err)
703703
ZEND_PARSE_PARAMETERS_END();
704704
#endif
705705

706706
old_error_reporting = EG(error_reporting);
707707
if (ZEND_NUM_ARGS() != 0) {
708-
zend_string *new_val = zval_get_string(err);
709708
do {
710709
zend_ini_entry *p = EG(error_reporting_ini_entry);
711710

@@ -731,12 +730,8 @@ ZEND_FUNCTION(error_reporting)
731730
zend_string_release(p->value);
732731
}
733732

734-
p->value = new_val;
735-
if (Z_TYPE_P(err) == IS_LONG) {
736-
EG(error_reporting) = Z_LVAL_P(err);
737-
} else {
738-
EG(error_reporting) = atoi(ZSTR_VAL(p->value));
739-
}
733+
p->value = zend_long_to_str(err);
734+
EG(error_reporting) = err;
740735
} while (0);
741736
}
742737

0 commit comments

Comments
 (0)