From:             info at rhalff dot com
Operating system: linux
PHP version:      5.0.2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Weird Behaviour calling non-static method statically

Description:
------------
I think the behaviour below is allready known and it can be fixed
declaring the method 'static', however I still think this is a bug. The
script should fail instead of continuing incorrect behaviour.

Related to Bug #9005, #12622, #20089, #25220, #29206

Because $this behaviour was allready there in 2001, I thought $this would
be a good reminder $this feature is still present in 5.0.2


Reproduce code:
---------------
<?php

class A {

    public function test()
    {
        $this->setValue('huh?');
    }
    
    public function test2()
    {   
        $this->nonExistent();
    }

}   

class B {
    
    public function test()
    {   
        A::test();
    }
    public function setValue($v)
    {   
        echo "$v";
    }
    
    public function test2()
    {   
        A::test2();
    }



}

$B = new B;
$B->test();
$B->test2();


?>

Expected result:
----------------
script should fail, cannot call a non-static method statically.




Actual result:
--------------
huh?
Fatal error: Call to undefined method B::nonExistent() in
/var/www/hosts/gedicht.nu/docs/static/test.php on line 12

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

Reply via email to