com php-src: Revert "Fix bug #72162 (again)": Zend/zend_built in_functions.c

From: Date: Fri, 06 May 2016 02:45:44 +0000
Subject: com php-src: Revert "Fix bug #72162 (again)": Zend/zend_built in_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92038@lists.php.net to get a copy of this message
Commit: 441d1b8ef07c5dc7f5a7fada46d829eed21ed4bc Author: Xinchen Hui <laruence@gmail.com> Fri, 6 May 2016 10:45:44 +0800 Parents: 8e5b38100411d3b8fa4486c7c41dec7dedb4b474 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=441d1b8ef07c5dc7f5a7fada46d829eed21ed4bc Log: Revert "Fix bug #72162 (again)" The problem is because we release p->value too early and later you try to convert an object to string, which is a fatal error then leave p->value double free, change to expect long is a BC break This reverts commit 8e5b38100411d3b8fa4486c7c41dec7dedb4b474. Bugs: https://bugs.php.net/72162 Changed paths: M Zend/zend_builtin_functions.c Diff: diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 7716d3e..558a1b2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -689,22 +689,23 @@ ZEND_FUNCTION(each) Return the current error_reporting level, and if an argument was passed - change to the new level */ ZEND_FUNCTION(error_reporting) { - zend_long err; + zval *err; int old_error_reporting; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &err) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &err) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_LONG(err) + Z_PARAM_ZVAL(err) ZEND_PARSE_PARAMETERS_END(); #endif old_error_reporting = EG(error_reporting); if (ZEND_NUM_ARGS() != 0) { + zend_string *new_val = zval_get_string(err); do { zend_ini_entry *p = EG(error_reporting_ini_entry); @@ -730,8 +731,12 @@ ZEND_FUNCTION(error_reporting) zend_string_release(p->value); } - p->value = zend_long_to_str(err); - EG(error_reporting) = err; + p->value = new_val; + if (Z_TYPE_P(err) == IS_LONG) { + EG(error_reporting) = Z_LVAL_P(err); + } else { + EG(error_reporting) = atoi(ZSTR_VAL(p->value)); + } } while (0); }

« previous php.cvs (#92038) next »