#30310 [Opn->WFx]: Can't overload static methods with __call()

From: Date: Sat, 02 Oct 2004 22:42:54 +0000
Subject: #30310 [Opn->WFx]: Can't overload static methods with __call()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67046@lists.php.net to get a copy of this message
ID: 30310 Updated by: helly@php.net Reported By: jaba at inbox dot lv -Status: Open +Status: Wont fix -Bug Type: Class/Object related +Bug Type: Feature/Change Request -Operating System: Windows XP +Operating System: * -PHP Version: 5.0.2 +PHP Version: 5.* Previous Comments: ------------------------------------------------------------------------ [2004-10-02 19:47:33] jaba at inbox dot lv Description: ------------ I am trying to write a class which can be used statically e.g. Db::connect(); Db::query() etc. I also have a __call() method to be executed in case of calling an inexistent static method. But this does not work: PHP says that the method is undefined. Reproduce code: --------------- <?php class Db { ... function __call($method,$args) { echo 'Method: '.$method.'<br />'; var_dump($args); } ... } # this works fine $Db = new Db(); $Db->test(); # this makes a PHP error Db::test(); ?> Expected result: ---------------- Method: test Array() Method: test Array() Actual result: -------------- Fatal error: Call to undefined method Db::test() in ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30310&edit=1

« previous php.bugs (#67046) next »