#32290 [Opn]: call_user_func_array() calls wrong class method within child class
| From: | ladoo at gmx dot at | Date: | Sun, 13 Mar 2005 12:09:19 +0000 |
| Subject: | #32290 [Opn]: 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-75274@lists.php.net to get a copy of this message | ||
ID: 32290
User updated by: ladoo at gmx dot at
-Summary: calling call_user_func_array() ends in infinite loop
within child class
Reported By: ladoo at gmx dot at
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Linux (x86)
PHP Version: 5.0.3
New Comment:
more accurate title
Previous Comments:
------------------------------------------------------------------------
[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