note 86400 rejected from function.call-user-func-array by danbrown
| From: | danbrown@php.net | Date: | Thu, 16 Oct 2008 15:45:43 +0000 |
| Subject: | note 86400 rejected from function.call-user-func-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145432@lists.php.net to get a copy of this message | ||
Note Submitter: rpeters at icomproductions dot ca
----
I'm trying to find a method of calling the parent constructor while passing an array of
parameters that works in all versions of PHP 5.0+.
I've got two dev setups right now, 5.1.1 and 5.2.6.
return call_user_func_array(array($this, 'parent::__construct'), $arrParentArgs);
causes a warning in 5.1.1
$parent_class=get_parent_class($this);
call_user_func_array(array($parent_class, '__construct'), $arrParentArgs);
causes an e_strict message in 5.2.6
What's the correct way of doing this?
Both constructors use func_get_args() to allow infinite parameters, so the traditional
parent::__construct($arg1,$arg2,etc) method fails.