--TEST-- ReflectionClass::newInstanceWithoutConstructor() --CREDITS-- Sebastian Bergmann --FILE-- newInstanceWithoutConstructor()); $class = new ReflectionClass('StdClass'); var_dump($class->newInstanceWithoutConstructor()); $class = new ReflectionClass('DateTime'); var_dump($class->newInstanceWithoutConstructor()); --EXPECTF-- object(Foo)#%d (0) { } object(stdClass)#%d (0) { } Fatal error: Uncaught exception 'ReflectionException' with message 'Class DateTime is an internal class that cannot be instantiated without invoking its constructor' in %sReflectionClass_newInstanceWithoutConstructor.php:%d Stack trace: #0 %sReflectionClass_newInstanceWithoutConstructor.php(%d): ReflectionClass->newInstanceWithoutConstructor() #1 {main} thrown in %sReflectionClass_newInstanceWithoutConstructor.php on line %d