#49376 [Opn->Bgs]: ReflectionClass::newInstanceArgs cannot instantiate a constructorless class
| From: | felipe@php.net | Date: | Fri, 28 Aug 2009 23:14:05 +0000 |
| Subject: | #49376 [Opn->Bgs]: ReflectionClass::newInstanceArgs cannot instantiate a constructorless class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141674@lists.php.net to get a copy of this message | ||
ID: 49376
Updated by: felipe@php.net
Reported By: sebcsaba at freemail dot hu
-Status: Open
+Status: Bogus
Bug Type: Reflection related
Operating System: WinXP
PHP Version: 5.3.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Do not pass any param to method. Just use $rc->newInstanceArgs();
Previous Comments:
------------------------------------------------------------------------
[2009-08-26 16:12:00] sebcsaba at freemail dot hu
Description:
------------
I've got a class without a constructor, and I want to instantiate it by
ReflectionClass::newInstanceArgs with an empty array as arguments.
This causes:
ReflectionException: 'Class A does not have a constructor, so you
cannot pass any constructor arguments'.
If I define an empty default constructor, this works well.
Reproduce code:
---------------
class A {}
$rc = new ReflectionClass('A');
$a = $rc->newInstanceArgs(array());
Expected result:
----------------
Create a new instance of class A, using default constructor behaviour.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49376&edit=1