mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Check update constant failure in ReflectionClassConstant::__toString()
This commit is contained in:
commit
1036fd2a70
2 changed files with 22 additions and 1 deletions
|
@ -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));
|
char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
|
||||||
const 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);
|
type = zend_zval_type_name(&c->value);
|
||||||
|
|
||||||
if (Z_TYPE(c->value) == IS_ARRAY) {
|
if (Z_TYPE(c->value) == IS_ARRAY) {
|
||||||
|
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue