Bug #52713 [Opn]: Can't call undefined methods (using __call) on parent

From: Date: Mon, 30 Aug 2010 23:05:07 +0000
Subject: Bug #52713 [Opn]: Can't call undefined methods (using __call) on parent
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153957@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 Updated by: felipe@php.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: The difference introduced was that the __call() just will be called when __callStatic() is not implemented, on such static method calls. Previous Comments: ------------------------------------------------------------------------ [2010-08-28 22:38:40] giovanni at giacobbi dot net I ran into the same problem. It's a serious breakage! I just tested on php 5.3.2 and it works as expected! ------------------------------------------------------------------------ [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

« previous php.bugs (#153957) next »