#49376 [NEW]: ReflectionClass::newInstanceArgs cannot instantiate a constructorless class
| From: | sebcsaba at freemail dot hu | Date: | Wed, 26 Aug 2009 16:12:00 +0000 |
| Subject: | #49376 [NEW]: ReflectionClass::newInstanceArgs cannot instantiate a constructorless class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-141567@lists.php.net to get a copy of this message | ||
From: sebcsaba at freemail dot hu
Operating system: WinXP
PHP version: 5.3.0
PHP Bug Type: Reflection related
Bug description: ReflectionClass::newInstanceArgs cannot instantiate a constructorless class
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 bug report at http://bugs.php.net/?id=49376&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49376&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49376&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49376&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49376&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49376&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49376&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49376&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49376&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49376&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49376&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49376&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49376&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49376&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49376&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49376&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49376&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49376&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49376&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49376&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49376&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49376&r=mysqlcfg