Keyword

Catchable fatal error and Warning: Illegal offset

  • Gérald Abbadie
  • Gérald Abbadie's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #102880 by Gérald Abbadie
Catchable fatal error and Warning: Illegal offset was created by Gérald Abbadie
After manipulation on K2 categories (option changes) and the elimination of a group of additional fields, the site is completely out with error messages:
Warning: Illegal offset type in isset or empty in / xxxxxx/components/com_k2/models/item.php on line 1110
Catchable fatal error: Object of class stdClass Could not be converted to string in / xxxxxxxx/administrator/components/com_k2/lib/JSON.php on line 478


I did an update of K2 but instead of fixing the problem, it has created a new one in the administration. Component appears only on the home page but not in the administration menu components while remaining functional.

An idea about the problem?

K2: 2.5.7
Joomla 2.5.6
Versions of PHP and MYSQL recent

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102881 by Lefteris
Hi. Are you still getting this error? Try to edit and save again the item that is having the issue. Also how did you removed the extra fields? Did you use the K2 administration or you just removed it manually from the database?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Gérald Abbadie
  • Gérald Abbadie's Avatar Topic Author
  • Offline
  • New Member
More
12 years 4 weeks ago - 12 years 4 weeks ago #102882 by Gérald Abbadie
Replied by Gérald Abbadie on topic Re: Catchable fatal error and Warning: Illegal offset
Hye,

I removed the category to the Joomla administration> select> delete.
But it may be another transaction that was a problem, I cannot say with certainty.

I've try to edit each element but the bug is still there.

Nobody get the same problem ?

ps : if you try a google search like : 'warning components/com_k2/models/item.php on line 1110' you will find many websites. Weird.

Please Log in or Create an account to join the conversation.

  • Gérald Abbadie
  • Gérald Abbadie's Avatar Topic Author
  • Offline
  • New Member
More
12 years 3 weeks ago #102883 by Gérald Abbadie
Replied by Gérald Abbadie on topic Re: Catchable fatal error and Warning: Illegal offset
I found a solution.
Line 478 in administrator/components/com_k2/lib/JSON.php, $str variable has to be a string. To avoid the error I've add a very bad hack to be sure to convert the variable to string :

function reduce_string($str)
{
$str = strval($str); // added by exlineo
$str = preg_replace(array(

// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',

// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',

// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'

), '', $str);

// eliminate extraneous space
return trim($str);
}

Please Log in or Create an account to join the conversation.

More
12 years 3 weeks ago #102884 by Lefteris
Thanks for your commitment. Since you hacked the file you can also try to use json_encode and json_decode native PHP functions which are much more faster.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum