Bug #64007 [Asn->Csd]: There is an ability to create instance of Generator by hand

From: Date: Sat, 19 Jan 2013 09:04:00 +0000
Subject: Bug #64007 [Asn->Csd]: There is an ability to create instance of Generator by hand
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-176120@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64007&edit=1 ID: 64007 Updated by: laruence@php.net Reported by: lisachenko dot it at gmail dot com Summary: There is an ability to create instance of Generator by hand -Status: Assigned +Status: Closed Type: Bug Package: Reflection related Operating System: Windows 7 x64 PHP Version: 5.5.0alpha2 Assigned To: laruence Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=f7b99c481d0a943d922e99ad9afa82c45193030e Log: Fixed bug #64007 (There is an ability to create instance of Generator by hand). Previous Comments: ------------------------------------------------------------------------ [2013-01-19 09:02:42] laruence@php.net The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2013-01-19 09:02:23] laruence@php.net Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=f7b99c481d0a943d922e99ad9afa82c45193030e Log: Fixed bug #64007 (There is an ability to create instance of Generator by hand). ------------------------------------------------------------------------ [2013-01-17 18:21:38] nikic@php.net @laruence: Imho new Foo($bar) and (new ReflectionClass('Foo'))->newInstance($bar) should behave the same. So if the constructor throws a fatal error then the constructor invoked through reflection should also throw a fatal error. If reflection doesn't go through get_constructor then it won't work correctly if that handler is overloaded. It just works so well right now because nearly noone overrides get_constructor. ------------------------------------------------------------------------ [2013-01-17 10:40:17] laruence@php.net @nikic, after a digging, I think it's better to make a private constructor for generators. here is the reason: refelction_class->newInstance used to throw exception while the constructor is non-public.. if change to get_constructor, boom~ FATAL ERROR. ------------------------------------------------------------------------ [2013-01-17 10:07:24] laruence@php.net agree, I will make a patch ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=64007 -- Edit this bug report at https://bugs.php.net/bug.php?id=64007&edit=1

« previous php.bugs (#176120) next »