bug64007.phpt 747 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #64007 (There is an ability to create instance of Generator by hand)
  3. --FILE--
  4. <?php
  5. $reflection = new ReflectionClass('Generator');
  6. try {
  7. $generator = $reflection->newInstanceWithoutConstructor();
  8. var_dump($generator);
  9. } catch (Exception $e) {
  10. var_dump($e->getMessage());
  11. }
  12. $generator = $reflection->newInstance();
  13. var_dump($generator);
  14. ?>
  15. --EXPECTF--
  16. string(%d) "Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor"
  17. Fatal error: Uncaught Error: The "Generator" class is reserved for internal use and cannot be manually instantiated in %sbug64007.php:%d
  18. Stack trace:
  19. #0 %s(%d): ReflectionClass->newInstance()
  20. #1 {main}
  21. thrown in %sbug64007.php on line %d