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