Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-15-2008, 06:52 PM #1
- Join Date
- Jan 2006
- Finland, Hollola
- Thanked 0 Times in 0 Posts
Non-static method X should not be called statically?!
I am having this error suddenly out of the blue:
Non-static method SpawConfig::getStaticConfigItem() should not be called statically, assuming $this from incompatible context
if (substr(phpversion(),0,1) != '6')
error_reporting(E_ALL & ~E_STRICT);
PHP 5 & MySQL 5 (Y)
05-15-2008, 08:21 PM #2
- Join Date
- May 2008
- Thanked 21 Times in 21 Posts
Something tells me that you should ask the people at spaweditor.com - they would know their code a lot better than we would.
On a high level: A static method is a method that works on the class as a whole, not an instance of the class. Like in Java how you can have a Math object so that you can call Math.pow(2,4) (calculates 2^4). It would be silly to have to instantiate the math object just to do powers - instead you can call it independently of the object. What that error implies is that you have a class that has a static method. The static method is calling a function that is associated with an instance of the class, not the class itself. That would be like if Math.pow required an instance of the Math class to be instantiated.