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

我的梦境 提交于 2019-12-13 04:20:49

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/16533288/strict-standards-non-static-method-joomla-and-roksprocket

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!