• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 733
  • Last Modified:

Strict Standards: Non-static method ... Want to clear it

Hello I'm getting this

Strict Standards: Non-static method  *foo:fake*  should not be called statically, assuming $this from incompatible context in

and I'm wanting to fix it..

Here is the code it refers to..


      public function GetHeaderHTML(){
            $obj =& $this->GetModuleInstance('fontin');
            if( is_object($obj) ){
                  global $gCms;
                  return $this->ProcessTemplateFromData(fontin_adminHeader::jsNcss());
            }
      }

Can some one tell me how to fix it and why the issue is?  I can't seem to google it right.. :/  thanks for the help.. Cheers -Jeremy
0
jeremyBass26
Asked:
jeremyBass26
  • 4
  • 4
  • 2
1 Solution
 
mattibuttCommented:
you have codes which are part of the application its probably you are calling the reference which is not suppose to be called the way you have
0
 
jeremyBass26Author Commented:
um sorry.. can you show me the code and restate that.. I didn't follow. tk
0
 
mattibuttCommented:
hi
i meant you are calling other references question is what are you using like the name of the cms you are using?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
jeremyBass26Author Commented:
Hello, sorry I'm not sure why the cms would matter... I want to know if the code is right.. it's listed as the cause.  I guess I'm looking for you to point at something and say that is the issue at this line

 return $this->ProcessTemplateFromData(fontin_adminHeader::jsNcss());

I guess I'm foggy here and looking for that to lift.  Thank you.
0
 
mattibuttCommented:
the code could be absolutely correct and work but the object its calling doesn't exists or do not have the same calling procedures so i asked you is there any additional codes i can understand if you dont want to share them but the problem must be ressolved within in its context this method means nothing if it has
if i am write you are using cms made simple?
0
 
jeremyBass26Author Commented:
That is correct, and I'm making my module E_STRICT friendly.  The obj is there and the code does work.  So, um is that what you where needing?
0
 
mattibuttCommented:
i am looking at the api http://www.cmsmadesimple.org/api/class_cms_module.html i am only seeing you are allowed to enter one parameter my view is you have a problem with these codes fontin_adminHeader::jsNcss() its better if you try another data to verify
0
 
HackneyCabCommented:
The only part of the above code to which that error can possibly refer is:

fontin_adminHeader::jsNcss()

This is asking for the jsNcss function to be called as though it were a static method. (Method is the name used for a function which is defined inside a class.) But the error is telling you that jsNcss is not a static method, so it must be a non-static method, which means that only an object of the class should be able to call it.

I recommend you read the PHP documentation pages about object instantiation and static methods:

http://uk2.php.net/manual/en/language.oop5.basic.php
http://uk2.php.net/manual/en/language.oop5.static.php
0
 
jeremyBass26Author Commented:
it lead me in the right direction.. tk
0
 
HackneyCabCommented:
In my opinion, PHP should terminate execution if non-static methods are called from a static context, otherwise it leads to the interpreter making risky assumptions. I'm hoping that PHP 6 starts to tighten such things.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now