#26875 [Bgs]: class, static keyword

From: Date: Mon, 12 Jan 2004 12:58:17 +0000
Subject: #26875 [Bgs]: class, static keyword
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53180@lists.php.net to get a copy of this message
ID: 26875 Updated by: alan_k@php.net Reported By: jonas at datatal dot se Status: Bogus Bug Type: Class/Object related Operating System: win2k PHP Version: 5.0.0b3 (beta3) New Comment: E_STRICT is available, however, since parent::method() and self::method() basically use the same infrastructure as static method calls. - AFAIK putting in warnings in here may be problematic.. (and adds another run-time performance hit..) Previous Comments: ------------------------------------------------------------------------ [2004-01-12 06:56:36] jonas at datatal dot se How about adding an option the php.ini that does some stricter checking in PHP5? (must declare variables, variables must exist, static keyword must exist etc etc) ------------------------------------------------------------------------ [2004-01-12 06:44:23] sniper@php.net Wrong. It worked like that in PHP 4, of course it will work like this in PHP 5. (BC) ------------------------------------------------------------------------ [2004-01-12 03:15:15] jonas at datatal dot se Description: ------------ It is possible to call a class function directly dispite that it doesnt have the static keyword. Reproduce code: --------------- <?php class Test { function MyFunction() { echo 'Hello'; } } Test::MyFunction(); ?> Expected result: ---------------- Should only be possible if the function have been defined with the static keyword. <?php class Test { static function MyFunction() { echo 'Hello'; } } Test::MyFunction(); ?> Actual result: -------------- The code works (it shouldnt). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26875&edit=1

« previous php.bugs (#53180) next »