Edit report at http://bugs.php.net/bug.php?id=52713&edit=1

 ID:                 52713
 Updated by:         fel...@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

Reply via email to