From: Xinchen Hui Date: Wed, 31 May 2017 05:08:26 +0000 (+0800) Subject: Merge branch 'PHP-7.0' into PHP-7.1 X-Git-Tag: php-7.2.0alpha1~34^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9064dca58ba87ccdbf6cee71122e50595765cfa1;p=php Merge branch 'PHP-7.0' into PHP-7.1 * PHP-7.0: Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant) Conflicts: ext/reflection/php_reflection.c --- 9064dca58ba87ccdbf6cee71122e50595765cfa1 diff --cc ext/reflection/php_reflection.c index a06522d025,5b162f759e..db7056e03b --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@@ -464,10 -459,13 +464,13 @@@ static void _class_string(string *str, string_printf(str, "%s - Constants [%d] {\n", indent, count); if (count > 0) { zend_string *key; - zval *value; + zend_class_constant *c; - ZEND_HASH_FOREACH_STR_KEY_VAL(&ce->constants_table, key, value) { - if (UNEXPECTED(zval_update_constant_ex(value, 1, NULL) == FAILURE)) { + ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) { + _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent.buf)); ++ if (UNEXPECTED(EG(exception))) { + return; + } - _const_string(str, ZSTR_VAL(key), value, indent); } ZEND_HASH_FOREACH_END(); } string_printf(str, "%s }\n", indent); @@@ -732,7 -707,15 +735,10 @@@ static void _parameter_string(string *s string_write(str, " = ", sizeof(" = ")-1); ZVAL_DUP(&zv, RT_CONSTANT(&fptr->op_array, precv->op2)); - zval_update_constant_ex(&zv, fptr->common.scope); - old_scope = EG(scope); - EG(scope) = fptr->common.scope; - if (UNEXPECTED(zval_update_constant_ex(&zv, 1, NULL) == FAILURE)) { - EG(scope) = old_scope; ++ if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) { + zval_ptr_dtor(&zv); + return; + } - EG(scope) = old_scope; if (Z_TYPE(zv) == IS_TRUE) { string_write(str, "true", sizeof("true")-1); } else if (Z_TYPE(zv) == IS_FALSE) {