1--TEST-- 2Unsetting name on ReflectionClassConstant 3--FILE-- 4<?php 5 6class Test { 7 public const C = 1; 8} 9 10// This is unsupported and the actual behavior doesn't matter. 11// Just make sure it doesn't crash. 12$rc = new ReflectionClassConstant(Test::class, 'C'); 13unset($rc->name); 14try { 15 var_dump($rc->getName()); 16} catch (Error $e) { 17 echo $e->getMessage(), "\n"; 18} 19try { 20 echo $rc, "\n"; 21} catch (Error $e) { 22 echo $e->getMessage(), "\n"; 23} 24 25?> 26--EXPECT-- 27Typed property ReflectionClassConstant::$name must not be accessed before initialization 28Typed property ReflectionClassConstant::$name must not be accessed before initialization 29