From: Nikita Popov Date: Mon, 31 Aug 2020 12:50:31 +0000 (+0200) Subject: Merge branch 'PHP-7.4' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1036fd2a70050a5955286e92852bbc560bb1fa78;p=php Merge branch 'PHP-7.4' * PHP-7.4: Check update constant failure in ReflectionClassConstant::__toString() --- 1036fd2a70050a5955286e92852bbc560bb1fa78 diff --cc ext/reflection/php_reflection.c index 016851e9e5,df00e5b4ba..f5c2b0f63c --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@@ -555,9 -545,12 +555,12 @@@ static void _const_string(smart_str *st static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent) { char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value)); - char *type; + const char *type; - zval_update_constant_ex(&c->value, c->ce); + if (zval_update_constant_ex(&c->value, c->ce) == FAILURE) { + return; + } + type = zend_zval_type_name(&c->value); if (Z_TYPE(c->value) == IS_ARRAY) { diff --cc ext/reflection/tests/ReflectionClassConstant_toString_error.phpt index 0000000000,cd4dfa3765..54290e97aa mode 000000,100644..100644 --- a/ext/reflection/tests/ReflectionClassConstant_toString_error.phpt +++ b/ext/reflection/tests/ReflectionClassConstant_toString_error.phpt @@@ -1,0 -1,18 +1,18 @@@ + --TEST-- + Exception thrown while converting ReflectionClassConstant to string + --FILE-- + getMessage(), "\n"; + } + + ?> + --EXPECT-- -Undefined class constant 'self::UNKNOWN' ++Undefined constant self::UNKNOWN