Non-static method should not be called statically

Need to resolve a pesky “Non-static method should not be called statically” error?

Strict Standards: Non-static method PEAR::isError() should not be called statically in /var/www/index.php on line 30

First, go to the specific file and line number mentioned in the error. Chances are you will see something like “CLASSNAME::functionName($variable, $array, $other_things)”

To resolve the error, first create a new instance of the class:

$CLASSNAME = new CLASSNAME();

Then, call the function like normal:

$result = $CLASSNAME->functionName($variable, $array, $other_things)

It’s as simple as that.

About jakimfett

I have been working with computers for over a decade. I was a computer lab administrator for a number of years, I am familiar with Microsoft and Unix based operating systems, and have worked as a Geek Squad Agent. In addition, I have been designing and administrating websites for the last half a dozen years. I started out programming straight HTML, but for the last year and a half have been studying PHP and SQL in the pursuit of my Information Systems degree. My programming environment of choice is PHP code combined with a MySQL backend, formatted using CSS. I also posses a solid working knowledge of Wordpress and have developed a number of custom plugins, themes, and widgets for that framework.
This entry was posted in Code Monkey Report and tagged . Bookmark the permalink.

Leave a Reply