Bug #52713 [Com]: Can't call undefined methods (using __call) on parent
| From: | giovanni at giacobbi dot net | Date: | Sat, 28 Aug 2010 20:38:40 +0000 |
| Subject: | Bug #52713 [Com]: Can't call undefined methods (using __call) on parent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153885@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52713&edit=1
ID: 52713
Comment by: giovanni at giacobbi dot net
Reported by: michael at wakeless dot net
Summary: Can't call undefined methods (using __call) on
parent
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: All
PHP Version: 5.3.3
Block user comment: N
New Comment:
I ran into the same problem.
It's a serious breakage! I just tested on php 5.3.2 and it works as
expected!
Previous Comments:
------------------------------------------------------------------------
[2010-08-27 06:06:16] michael at wakeless dot net
Description:
------------
When using the __call and __callStatic functionality on a parent class
calls to parent::method() will always use __callStatic rather than the
__call.
This breaks backwards compatibility in a number of cases.
Test script:
---------------
class A {
function __call($method, $args) {
if($method == "Test") {
echo "Success.";
}
}
function __callStatic($method, $args) {
echo "Failure.";
}
}
class B extends A {
function Test() {
echo "Test called.";
parent::Test();
}
}
$test = new B;
$test->Test();
Expected result:
----------------
//Expected output: Test called.Success.
Actual result:
--------------
//Actual output: Test called.Failure
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52713&edit=1