note 96503 added to function.call-user-func-array

From: Date: Tue, 02 Mar 2010 19:35:39 +0000
Subject: note 96503 added to function.call-user-func-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-166541@lists.php.net to get a copy of this message
Following on from "mrextreme at freemail dot hu" using <?php call_user_func_array()?> with <?php array('parent', '__construct')?> generates an E_STRICT warning along the lines of Message: Non-static method B::__construct() cannot be called statically, assuming $this from compatible context D Severity: E_STRICT (running on PHP 5.2.8). Binding to $this seems to work fine. <?php class B { function __construct($x) { echo 'B::B(). ', $x, PHP_EOL; } } class D extends B { function __construct() { $args = func_get_args(); call_user_func_array(array($this, 'parent::__construct'), $args); } } $d = new D('hey'); ?> B::B(). hey (tested with PHP 5.2.8 and 5.3.0RC1). ---- Server IP: 69.147.83.197 Probable Submitter: 89.30.119.55 ---- Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php Edit -- https://master.php.net/note/edit/96503 Del: integrated -- https://master.php.net/note/delete/96503/integrated Del: useless -- https://master.php.net/note/delete/96503/useless Del: bad code -- https://master.php.net/note/delete/96503/bad+code Del: spam -- https://master.php.net/note/delete/96503/spam Del: non-english -- https://master.php.net/note/delete/96503/non-english Del: in docs -- https://master.php.net/note/delete/96503/in+docs Del: other reasons-- https://master.php.net/note/delete/96503 Reject -- https://master.php.net/note/reject/96503 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166541) next »