php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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 commitsRelated reports
 [2003-12-07 13:22 UTC] sniper@php.net
Stanislav, can you check this out please?

 [2003-12-07 13:54 UTC] tater at potatoe dot com
btw, i reverted to before zend_make_callable() was added
(10/25), and this went away.
 [2004-01-05 07:06 UTC] stas@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC