diff options
author | Xinchen Hui <laruence@gmail.com> | 2017-05-31 13:12:24 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2017-05-31 13:12:24 +0800 |
commit | bfd35512bb795f0b4f83c1c857acca7e6e552f6f (patch) | |
tree | 12914b5cde7e8efc5941a0e2317fa71fe6e0c7e1 /ext/reflection/php_reflection.c | |
parent | 32200e0b699bbbaa26415e7266ab1ed3e0a783ba (diff) | |
parent | 741769d9337d9c211f3a106f6f171b889d5b70bf (diff) | |
download | php-git-bfd35512bb795f0b4f83c1c857acca7e6e552f6f.tar.gz |
Merge branch 'PHP-7.1'
* PHP-7.1:
Update NEWS
Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant)
Conflicts:
ext/reflection/php_reflection.c
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b8c984a8bf..3e5af0dbb8 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -380,6 +380,9 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) { _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent)); + if (UNEXPECTED(EG(exception))) { + return; + } } ZEND_HASH_FOREACH_END(); } smart_str_append_printf(str, "%s }\n", indent); @@ -637,7 +640,10 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_ smart_str_appends(str, " = "); ZVAL_DUP(&zv, RT_CONSTANT(&fptr->op_array, precv->op2)); - zval_update_constant_ex(&zv, fptr->common.scope); + if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) { + zval_ptr_dtor(&zv); + return; + } if (Z_TYPE(zv) == IS_TRUE) { smart_str_appends(str, "true"); } else if (Z_TYPE(zv) == IS_FALSE) { |