1--TEST-- 2ReflectionProperty::get{Hook,Hooks}() crashes on dynamic properties 3--FILE-- 4<?php 5 6#[\AllowDynamicProperties] 7class MyDynamicClass { 8 9} 10 11class NonDynamicClass { 12 13} 14 15$cases = [ MyDynamicClass::class, stdClass::class, NonDynamicClass::class ]; 16 17foreach ( $cases as $c ) { 18 echo "$c:" . PHP_EOL; 19 $obj = new $c(); 20 $obj->prop = 'foo'; 21 $prop = new ReflectionProperty($obj, 'prop'); 22 var_dump( $prop->getHooks() ); 23 var_dump( $prop->getHook( PropertyHookType::Get ) ); 24 var_dump( $prop->getHook( PropertyHookType::Set ) ); 25 echo PHP_EOL; 26} 27 28?> 29--EXPECTF-- 30MyDynamicClass: 31array(0) { 32} 33NULL 34NULL 35 36stdClass: 37array(0) { 38} 39NULL 40NULL 41 42NonDynamicClass: 43 44Deprecated: Creation of dynamic property NonDynamicClass::$prop is deprecated in %sgh15718.php on line %d 45array(0) { 46} 47NULL 48NULL 49