ID: 40886 User updated by: andrea at 3site dot it Reported By: andrea at 3site dot it Status: Open Bug Type: Class/Object related Operating System: Windows XP SP2 PHP Version: 5.2.1 New Comment:
damn ... http://www.php.net/manual/en/language.oop5.static.php "Declaring class members or methods as static makes them accessible without needing an instantiation of the class. A member declared as static can not be accessed with an instantiated class object (though a static method can)." Well ... C# and other languages doesn't assign static methods to instances. C++ does it but it assign static parameters too. With PHP 5 we can't use the same name for 2 different methods (for example one static and one public) but we can call a static method without static declaration (only E_STRICT tells us there's something wrong) while C++ can't call a public method, or parameter, with a class if it's not declared as static. At this point, why did You introduce the static method/property type? This implementation is not Object Oriented, it's quite "Hilarius" Oriented. Sorry for this bug (and for me it's really a bug!). Regards. Previous Comments: ------------------------------------------------------------------------ [2007-03-21 18:56:54] andrea at 3site dot it Description: ------------ Description: ------------ I don't know if it is by design, but this is not what I would expect logically ... (and with static variables it doesn't happen so it should be a _strange_ logic) I suppose this problem is related with this one: http://bugs.php.net/bug.php?id=40837 but I think this one is *not* callable Irrelevant Reproduce code: --------------- <?php class ExampleClass { public static function StaticExample(){ echo "StaticExample", "<br />"; } public function InstanceExample(){ echo "InstanceExample", "<br />"; } } $test = new ExampleClass(); ExampleClass::StaticExample(); // ok $test->InstanceExample(); // ok $test->StaticExample(); // what the hell? ?> Expected result: ---------------- StaticExample InstanceExample FATAL ERROR ... undefined method StaticExample Actual result: -------------- StaticExample InstanceExample StaticExample ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40886&edit=1