Merge branch 'PHP-7.4'

* PHP-7.4:
  Check update constant failure in ReflectionClassConstant::__toString()
This commit is contained in:
Nikita Popov 2020-08-31 14:50:31 +02:00
commit 1036fd2a70
2 changed files with 22 additions and 1 deletions

View file

@ -557,7 +557,10 @@ static void _class_const_string(smart_str *str, char *name, zend_class_constant
char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
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) {

View file

@ -0,0 +1,18 @@
--TEST--
Exception thrown while converting ReflectionClassConstant to string
--FILE--
<?php
class B {
const X = self::UNKNOWN;
}
try {
echo new ReflectionClassConstant('B', 'X');
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Undefined constant self::UNKNOWN