Strict Standards

Strict Standards: Non-static method XoopsErrorHandler::getInstance() should not be called statically in [wwwServerURL]/xoops/class/errorhandler.php on line 202


php5.4を使用してxoopsを構築した際に発生。
php5.3の仕様とphp5.4の仕様では大きな違いがある為に発生する。(←インスタンスを“public static”にする必要がある為?)
一番楽なのはphp5.3を使用する事だが、それが出来ない場合には以下のxoopsソースの一部(具体的にはgetInstance()を使用する関数指定を変更)を書き換える事でエラーが出なくなる。

# vi [XOOPS_ROOT_PATH]/class/errorhandler.php
  • クラス名:XoopsErrorHandler
    -    function &getInstance()
    -    {
    -        static $instance = null;
    -        if (empty($instance)) {
    -            $instance = new XoopsErrorHandler;
    -        }
    -        return $instance;
    -    }
    _/_/_/_/_/
    +    public static function &getInstance()
    +    {
    +        static $instance = null;
    +        if (empty($instance)) {
    +            $instance = new XoopsErrorHandler;
    +        }
    +        return $instance;
    +    }

# vi [XOOPS_ROOT_PATH]/class/database/database.php
  • クラス名:Database
    -    function &getInstance()
    -    {
    -        $instance =& XoopsDatabaseFactory::getDatabaseConnection();
    -        return $instance;
    -    }
    _/_/_/_/_/
    +    public static function &getInstance()
    +    {
    +        $instance =& XoopsDatabaseFactory::getDatabaseConnection();
    +        return $instance;
    +    }