1--TEST-- 2Lazy objects: sub-classes of internal classes can not be initialized lazily 3--FILE-- 4<?php 5 6class C extends DateTime { 7} 8 9$reflector = new ReflectionClass(C::class); 10 11print "# Ghost:\n"; 12 13try { 14 $obj = $reflector->newLazyGhost(function ($obj) { 15 var_dump("initializer"); 16 $obj->__construct(); 17 }); 18} catch (Error $e) { 19 printf("%s: %s\n", $e::class, $e->getMessage()); 20} 21 22print "# Proxy:\n"; 23 24try { 25 $obj = $reflector->newLazyProxy(function ($obj) { 26 var_dump("initializer"); 27 $obj->__construct(); 28 }); 29} catch (Error $e) { 30 printf("%s: %s\n", $e::class, $e->getMessage()); 31} 32 33--EXPECTF-- 34# Ghost: 35Error: Cannot make instance of internal class lazy: C inherits internal class DateTime 36# Proxy: 37Error: Cannot make instance of internal class lazy: C inherits internal class DateTime 38