ID: 30310
Updated by: [EMAIL PROTECTED]
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