Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Non-static method X should not be called statically?!

    Hello,

    I am having this error suddenly out of the blue:

    Code:
    Non-static method SpawConfig::getStaticConfigItem() should not be called statically, assuming $this from incompatible context
    I'm using www.spaweditor.com in my PHP 5.2 website. My error reporting is set so that it does not display E_STRICT errors:

    PHP Code:
    if (substr(phpversion(),0,1) != '6')
     
    error_reporting(E_ALL);
    else
     
    error_reporting(E_ALL & ~E_STRICT); 
    by _Aerospace_Eng_ from: http://codingforums.com/showthread.php?t=139835
    PHP 5 & MySQL 5 (Y)

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •