#36141 [Opn->Csd]: Add ReflectionClass::newInstanceArgs($args)

From: Date: Tue, 24 Jan 2006 20:27:03 +0000
Subject: #36141 [Opn->Csd]: Add ReflectionClass::newInstanceArgs($args)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92431@lists.php.net to get a copy of this message
ID: 36141 Updated by: helly@php.net Reported By: sebastian@php.net -Status: Open +Status: Closed Bug Type: Feature/Change Request -Operating System: Irrelevant +Operating System: * -PHP Version: 5.1.2 +PHP Version: 5.* Assigned To: helly New Comment: Implemented in HEAD Previous Comments: ------------------------------------------------------------------------ [2006-01-24 12:19:20] sebastian@php.net Description: ------------ An equivalent to ReflectionMethod::invokeArgs() is missing for creating new instances of classes through the Reflection API where the class' constructor requires parameters. I there propose ReflectionClass::newInstanceArgs($args) in addition to the existing ReflectionClass::newInstance() method. Reproduce code: --------------- <?php class Sample { public function __construct($a, $b) { print "$a, $b"; } } $class = new ReflectionClass('Sample'); $object = $class->newInstanceArgs(array(23, 42)); ?> Expected result: ---------------- 23, 42 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36141&edit=1

« previous php.bugs (#92431) next »