From: lisachenko dot it at gmail dot com Operating system: Windows 7 x64 PHP version: 5.5.0alpha2 Package: Reflection related Bug Type: Bug Bug description:There is an ability to create instance of Generator by hand
Description: ------------ Generator is an internal class, so there shouldn't be an ability to create it by hand. However, the Generator class doesn't have a private constructor and instance of it can be created via ReflectionClass. Solution: add a private constructor for this class to prevent instantiation (like for Closure class). Test script: --------------- $reflection = new ReflectionClass('Generator'); $generator = $reflection->newInstance(); var_dump($generator); Expected result: ---------------- Expected ReflectionException that restricts an object instantiation. Fatal error: Uncaught exception 'ReflectionException' with message 'Access to non-public constructor of class Generator' Actual result: -------------- Generator object created: object(Generator)#2 (0) { } -- Edit bug report at https://bugs.php.net/bug.php?id=64007&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64007&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64007&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64007&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64007&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64007&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64007&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64007&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64007&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64007&r=support Expected behavior: https://bugs.php.net/fix.php?id=64007&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64007&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64007&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64007&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64007&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64007&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64007&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64007&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64007&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64007&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64007&r=mysqlcfg