#32290 [Opn->Csd]: call_user_func_array() calls wrong class method within child class
| From: | helly@php.net | Date: | Sun, 13 Mar 2005 13:26:32 +0000 |
| Subject: | #32290 [Opn->Csd]: call_user_func_array() calls wrong class method within child class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75275@lists.php.net to get a copy of this message | ||
ID: 32290
Updated by: helly@php.net
Reported By: ladoo at gmx dot at
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5.0.3
Assigned To: helly
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-03-13 13:09:19] ladoo at gmx dot at
more accurate title
------------------------------------------------------------------------
[2005-03-13 13:04:59] ladoo at gmx dot at
Description:
------------
I have a class A and a class B which extends A. Both have a equally
named method. When I try to call A::method with call_user_func_array it
calls B::method instead.
Reproduce code:
---------------
class A {
public function doSomething($i)
{
return --$i;
}
}
class B extends A {
public function doSomething($i)
{
$i++;
if ($i >= 100) return 100;
return call_user_func_array(array("A","doSomething"), array($i));
}
}
$x = new B();
echo $x->doSomething(1);
Expected result:
----------------
1
Actual result:
--------------
100
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32290&edit=1