char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
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) {
--- /dev/null
+--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 class constant 'self::UNKNOWN'