XOOPS Strict Standards error

Asked

Viewed 304 times

2

XOOPS gave this error in script installed:

Strict Standards: Non-static method Xoopslogger::instance() should not be called statically in /home/b81inudo/public_html/portal/include/common.php on line 109

Strict Standards: Non-static method Xoopslogger::instance() should not be called statically in /home/b81inudo/public_html/portal/class/logger.php on line 228


I couldn’t solve it, the line of code is from logger.php:

function addBlock($name, $cached = false, $cachetime = 0) {
    if ( $this->activated )     $this->blocks[] = array('name' => $name, 'cached' => $cached, 'cachetime' => $cachetime);
}

And that of common.php:

if ( empty( $_SERVER[ 'REQUEST_URI' ] ) ) {         // Not defined by IIS
    // Under some configs, IIS makes SCRIPT_NAME point to php.exe :-(
    if ( !( $_SERVER[ 'REQUEST_URI' ] = @$_SERVER['PHP_SELF'] ) ) {
        $_SERVER[ 'REQUEST_URI' ] = $_SERVER['SCRIPT_NAME'];
    }
    if ( isset( $_SERVER[ 'QUERY_STRING' ] ) ) {
        $_SERVER[ 'REQUEST_URI' ] .= '?' . $_SERVER[ 'QUERY_STRING' ];
    }
}
  • Also tell us which version of php and xoops.

  • 1

    This is PHP version conflict. You won’t solve it without rewriting the Xoopslogger class. Take a look in it. It was made for PHP 4 which was discontinued 7 years ago. Now look what it says on the download page of the new version of XOOPS: You’ll need PHP 5.3.7+ (PHP 5.3.7 or higher required). And yet it is quite likely that without hiding the Strict Standards as I said the error remains. I downloaded the current version and it is still written for PHP 4.

  • when I hide the mistakes he gets the white page.

  • updated the files and it only gave this error: Fatal error: Class 'Xoopspreload' not found in /home/b81inudo/public_html/portal/include/common.php on line 50

1 answer

4

A static method is defined thus:

class NomeDaClasse {

    public static function nomeDoMetodo( $argumento ) {}
}

And must be invoked so:

NomeDaClasse::nomedoMetodo( $valorDoArgumento );

In older versions of PHP you could even invoke a class method as above even if its statement did not have the keyword Static.

Newer versions have come to characterize this as error and whenever this happens a Strict Standards is fired to inform you, programmer, that what you are doing does not make sense, without a method is static, invoke it statically. If it is not, please instate the object.

Most likely you are using a version of XOOPS developed for older versions or at least not so modern. Or even worse, the project was discontinued and does not receive updates.

And you’re running this dinosaur in a facility, local or not, with a higher PHP version than recommended by the XOOPS developer.

You can even disable this error by setting earlier, in the scripts, the following statement:

error_reporting( E_ALL ^ E_STRICT );

But this is extremely nay recommended!

Looking more calmly and in depth, this is even a conflict of versions. I downloaded the current version of XOOPS (2.5.7) which says it requires PHP 5.3.7+ and is compatible with PHP 5.5.x.

It may be, but not following the good practices of programming because, analyzing the class Xoopslogger located in /class/logger/xoopslogger.php, it is still written in PHP 4, discontinued 7 years ago.

See Wordpress, for example. It works perfectly, the way it works, but it works. And suffers from the same problem because just enable the report Strict Standards that begins to rain error, mainly in the Dashboard.

  • 1

    Would not be public static function?

  • 1

    I could have sworn I wrote the word... thank you!

  • 1

    Not wanting to be boring but got static function function :P

  • 1

    More than Zica. Now I’m done.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.