Req #55490 [PATCH]: Allow instantiating objects without invoking the constructor
| From: | sebastian@php.net | Date: | Thu, 25 Aug 2011 09:27:08 +0000 |
| Subject: | Req #55490 [PATCH]: Allow instantiating objects without invoking the constructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162920@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55490&edit=1
ID: 55490
Patch added by: sebastian@php.net
Reported by: sebastian@php.net
Summary: Allow instantiating objects without invoking the
constructor
Status: Open
Type: Feature/Change Request
Package: Reflection related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: ReflectionClass_newInstanceWithoutConstructor
Revision: 1314264428
URL: https://bugs.php.net/patch-display.php?bug=55490&patch=ReflectionClass_newInstanceWithoutConstructor&revision=1314264428
Previous Comments:
------------------------------------------------------------------------
[2011-08-25 09:24:37] sebastian@php.net
The following patch has been added/updated:
Patch Name: ReflectionClass_newInstanceWithoutConstructor
Revision: 1314264277
URL: https://bugs.php.net/patch-display.php?bug=55490&patch=ReflectionClass_newInstanceWithoutConstructor&revision=1314264277
------------------------------------------------------------------------
[2011-08-23 12:31:07] sebastian@php.net
Description:
------------
Libraries such as Doctrine 2 and PHPUnit_MockObject (ab)use the unserialize() function
(unserialize(sprintf('O:%d:"%s":0:{}', strlen($name), $name))) to instantiate an
object of a class without invoking the constructor.
It would be nice if the Reflection API provided a clean API for this use case that does not depend
on implementation details of PHP's serializer.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55490&edit=1