call_user_func broken for self, parent
| Bug #26543 | call_user_func broken for self, parent | ||||
|---|---|---|---|---|---|
| Submitted: | 2003-12-06 11:08 UTC | Modified: | 2004-01-05 07:06 UTC | ||
| From: | tater at potatoe dot com | Assigned: | stas (profile) | ||
| Status: | Closed | Package: | Scripting Engine problem | ||
| PHP Version: | 5CVS-2003-12-06 (dev) | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2003-12-06 11:08 UTC] tater at potatoe dot com
Description:
------------
Using call_user_func() for the equivalent of self::method() or parent::method() results in a warning. This has worked for
quite some time, and as recently as beta2. From Zend/ChangeLog:
<pre>
2003-06-09 Stanislav Malyshev <stas@zend.com>
* zend_API.c
zend_execute_API.c:
Support 'self' and 'parent' in call_user_func()
</pre>
Reproduce code:
---------------
class fooparent
{
function t() { print "fooparent::t()\n"; }
}
class foo extends fooparent
{
function p()
{
$this->t();
parent::t();
call_user_func(array('parent','t'));
}
}
$a = new foo;
$a->p();
Expected result:
----------------
fooparent::t()
fooparent::t()
fooparent::t()
Actual result:
--------------
fooparent::t()
fooparent::t()
Warning: call_user_func(parent::t): First argument is expected to be a valid callback in /my/path/bug.php on line 12
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2003-12-07 13:22 UTC] sniper@php.net
[2003-12-07 13:54 UTC] tater at potatoe dot com
[2004-01-05 07:06 UTC] stas@php.net