ID:               44944
 Updated by:       [EMAIL PROTECTED]
 Reported By:      som dot guha at yahoo dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Class/Object related
 Operating System: linux
 PHP Version:      5.2.6
 New Comment:

I agree with you, but it was decided not to make this a fatal error. If
you have E_STRICT turned on (which I think you should), you will see
this:

Strict standards: Non-static method MyClass::showMyName() should not be
called statically in /home/derick/- on line 8



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

[2008-05-08 10:12:51] som dot guha at yahoo dot com

Description:
------------
I am using php 5.2.5 version. I was testing the functionality of the
scope resolution operator. In php.net site it stated that "The Scope
Resolution Operator (also called Paamayim Nekudotayim) or in simpler
terms, the double colon, is a token that allows access to static,
constant, and overridden members or methods of a class.". Now if you
check my following code:

class MyClass{
   public function showMyName(){
     echo "My Name";
   }
}

>From the above code, I am able to access the showMyName() method
without creating any object, with the help of scope resolution operator,
like:
MyClass::showMyName();
If you check my code you can see that I have never declared the method
as a static method. Show how I am able to access that method with the
scope resolution operator. I think this is violating the OOPs rule.

 
 


Reproduce code:
---------------
class MyClass{
   public function showMyName(){
     echo "My Name";
   }
}

MyClass::showMyName();

Expected result:
----------------
Should generate an error.

Actual result:
--------------
My Name


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


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

Reply via email to