Search code examples
phpjoomlastrict

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.


Solution

  • 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.