call_user_func_array() calls wrong class method within child class
| Bug #32290 | call_user_func_array() calls wrong class method within child class | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2005-03-13 13:04 UTC | Modified: | 2005-03-13 14:26 UTC |
|
||||||
| From: | ladoo at gmx dot at | Assigned: | helly (profile) | |||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||
| PHP Version: | 5.0.3 | OS: | * | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2005-03-13 13:04 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2005-03-13 14:26 UTC] helly@php.net