Strict Standards: Non-static method K2ModelItemlist::getCategoryTree() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\virgin\components\com_roksprocket\lib\RokSprocket\Provider\K2\Filter.php on line 151

All

I have this error...I am using RokSprocket, Joomla and received the above error... It seems to have originated from

protected function category($data)
{
if(file_exists(JPATH_SITE.'/components/com_k2/models/itemlist.php'))
require_once (JPATH_SITE.'/components/com_k2/models/itemlist.php');
$wheres = array();
foreach($data as $match){
$categories = K2ModelItemlist::getCategoryTree($match);

Any idea how to fix this.

有帮助吗?

解决方案

Making Joomla compatible with the strict requirements are still work in progress. The core has come a long way on that road, but many extension developers are still not aware of current best practices.

Development Environment

Stay with the maximum error_level, just repair the broken code by prepending the function keyword with public static. You'll loose that on updates, but your VCS will help you to re-fix that quickly.

Production Environment

On productive systems, error_reporting can be lowered to not include strict warnings. Configure the server to log errors instead of displaying them.

其他提示

K2ModelItemlist::getCategoryTree not defined as static. There for you got that error message.

Yes, you can define it as static yourself inside file components/com_k2/models/itemlist.php

function getCategoryTree($categories) // line 576

replace with

static function getCategoryTree($categories)

But you must remember every your own patch of foreign components cause you can lose it after upgrading.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top