简体   繁体   中英

Strict Standards: Non-static method (joomla and roksprocket)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM