ID:               27304
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
-Operating System: RH8
+Operating System: *
-PHP Version:      5CVS-2004-02-18 (dev)
+PHP Version:      < 5.0.3
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2004-02-18 02:44:44] [EMAIL PROTECTED]

Description:
------------
Static functions don't behave properly at all. They can be called from
an object-context and provide no means to even confirm from within the
function if it has been called from a static context or not.

I understand that static methods should never have access to $this
regardless of context, but unless the engine enforces a restriction on
calling static functions from an object context this behavior is
completely counter-intuitive and inconsistent. Not only does the engine
not catch this, but the developer cannot either.



Reproduce code:
---------------
<?php
        error_reporting(E_ALL);
        class Staticexample {
                const a = 10;

                static function test() {
                        
                        var_dump(isset($this));

                }

                
        }
       
        $b = new Staticexample();
        Staticexample::test();
        $b->test();
        
?>

Expected result:
----------------
bool(false)
bool(true)


Actual result:
--------------
bool(false)
bool(false)


------------------------------------------------------------------------


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

Reply via email to