diff options
Diffstat (limited to 'ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt')
-rw-r--r-- | ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt b/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt index 334efc3a50..59337f09e8 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt @@ -22,7 +22,19 @@ $class = new ReflectionClass('DateTime'); var_dump($class->newInstanceWithoutConstructor()); $class = new ReflectionClass('Generator'); +try { + var_dump($class->newInstanceWithoutConstructor()); +} catch (ReflectionException $e) { + echo $e->getMessage(), "\n"; +} + +final class Bar extends ArrayObject { +} + +$class = new ReflectionClass('Bar'); var_dump($class->newInstanceWithoutConstructor()); + +?> --EXPECTF-- object(Foo)#%d (0) { } @@ -30,9 +42,9 @@ object(stdClass)#%d (0) { } object(DateTime)#%d (0) { } - -Fatal error: Uncaught ReflectionException: Class Generator is an internal class marked as final 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 +Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor +object(Bar)#%d (1) { + ["storage":"ArrayObject":private]=> + array(0) { + } +} |