Strict Standards: Non-static method modJumiHelper:

2019-09-15 16:44发布

问题:

I having these errors on my website:

Strict Standards: Non-static method modJumiHelper::getCodeWritten() should not be called statically in /home/kmxsiksf/www/modules/mod_jumi/mod_jumi.php on line 17

Strict Standards: Non-static method modJumiHelper::getStorageSource() should not be called statically in /home/kmxsiksf/www/modules/mod_jumi/mod_jumi.php on line 18

Here is the mod_jumi.php (line 17 and 18 start respectively with $code_written and $storage_source)

defined('_JEXEC') or die('Restricted access');
if(!defined('DS')){
    define('DS',DIRECTORY_SEPARATOR);
}
// Include the functions only once
require_once(dirname(__FILE__).DS.'helper.php');


$code_written   = modJumiHelper::getCodeWritten($params); //code written or ""
$storage_source = modJumiHelper::getStorageSource($params); //filepathname or record id or ""

if(is_int($storage_source)) { //it is record id
    $code_stored = modJumiHelper::getCodeStored($storage_source); //code or null(error]
}

require(JModuleHelper::getLayoutPath('mod_jumi'));

I found many solution for this problem to transform the function into a non static one but because I don't know much about PHP, I couldn't find a way to make them work.

Thanks a lot for your help!

回答1:

This error is caused because the functions getCodeWritten and getStorageSource are not static functions.

i.e.

Instead of being declared like so:

public static function getCodeWritten()

They are being declared like this:

public function getCodeWritten()

Be warned that "fixing" this might cause other issues. Your best bet is to contact the people who created the extension.