From:             jaba at inbox dot lv
Operating system: Windows XP
PHP version:      5.0.2
PHP Bug Type:     Class/Object related
Bug description:  Can't overload static methods with __call()

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 bug report at http://bugs.php.net/?id=30310&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30310&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30310&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30310&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30310&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30310&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30310&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30310&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30310&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30310&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30310&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30310&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30310&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30310&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30310&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30310&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30310&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30310&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30310&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30310&r=mysqlcfg

Reply via email to