[SOLVED] Error after J3.6.4 update: Error decoding JSON data: unexpected end of data

More
9 years 3 months ago - 9 years 1 month ago #64740 by Chabi01
Hi, after update to J3.6.4, i get in administrator when trying to access content items :
Error decoding JSON data: unexpected end of data
I tried to update to FC3.1.0.
No change...

Browser cache and site cache cleared without any change...
Any clue ?
Thanks
Xavier
Last edit: 9 years 1 month ago by ggppdk.

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

More
9 years 3 months ago - 9 years 3 months ago #64741 by Chabi01
Ok.
If i try to access to all content in the admin, i get the error.
I i acces the categories and then click on the number showing the number of items, i can have the list, modifying, etc..
But if i removed all the filter, i have then the error.
???
Last edit: 9 years 3 months ago by ggppdk.

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

More
9 years 3 months ago - 9 years 3 months ago #64742 by ggppdk
Hello

- J3.6.4 has changed the code and when a bad JSON string is encountered, and it will throw an exception
(and if extension does not catch the exception, the page breaks)

There is long discussion about it in Joomla issue tracker:
github.com/joomla/joomla-cms/issues/12460

To get more info e.g. for Joomla backend if using ISIS Template:
edit file:
administrator/templates/isis/error.php

Find:
Code:
<blockquote> <span class="label label-inverse"><?php echo $this->error->getCode(); ?></span> <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8');?>

and after it add:
Code:
<br/> <span class="label label-inverse"><?php echo $this->error->getLine(); ?></span> <?php echo $this->error->getFile();?>

This way we can know where the error has occured


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 9 years 3 months ago by ggppdk.

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

More
9 years 3 months ago - 9 years 3 months ago #64743 by ggppdk
Hello

actually you only need to enable "DEBUG" in Joomla global configuration

and then visit the page that should tell us where the error is thrown
- copy paste here the "Trace" that will be printed


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 9 years 3 months ago by ggppdk.

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

More
9 years 3 months ago #64745 by Chabi01
Hi Georges,
First, after modifying isis error page, i get with the debug (replace my site name by "mysite" :

0 Error decoding JSON data: unexpected end of data
72 /var/www/vhosts/mysite.com/httpdocs/libraries/vendor/joomla/registry/src/Format/Json.php

Call stack
# Function Location
1 JApplicationCms->execute() /var/www/vhosts/mysite.com/httpdocs/administrator/index.php:51
2 JApplicationAdministrator->doExecute() /var/www/vhosts/mysite.com/httpdocs/libraries/cms/application/cms.php:261
3 JApplicationAdministrator->dispatch() /var/www/vhosts/mysite.com/httpdocs/libraries/cms/application/administrator.php:152
4 JComponentHelper::renderComponent() /var/www/vhosts/mysite.com/httpdocs/libraries/cms/application/administrator.php:98
5 JComponentHelper::executeComponent() /var/www/vhosts/mysite.com/httpdocs/libraries/cms/component/helper.php:380
6 require_once() /var/www/vhosts/mysite.com/httpdocs/libraries/cms/component/helper.php:405
7 require_once() /var/www/vhosts/mysite.com/httpdocs/administrator/components/com_flexicontent/flexicontent.php:22
8 JControllerLegacy->execute() /var/www/vhosts/mysite.com/httpdocs/administrator/components/com_flexicontent/admin.flexicontent.php:291
9 FlexicontentController->display() /var/www/vhosts/mysite.com/httpdocs/libraries/legacy/controller/legacy.php:702
10 JControllerLegacy->display() /var/www/vhosts/mysite.com/httpdocs/administrator/components/com_flexicontent/controller.php:323
11 FlexicontentViewItems->display() /var/www/vhosts/mysite.com/httpdocs/libraries/legacy/controller/legacy.php:664
12 JViewLegacy->get() /var/www/vhosts/mysite.com/httpdocs/administrator/components/com_flexicontent/views/items/view.html.php:362
13 FlexicontentModelItems->getData() /var/www/vhosts/mysite.com/httpdocs/libraries/legacy/view/legacy.php:408
14 Joomla\Registry\Registry->__construct() /var/www/vhosts/mysite.com/httpdocs/administrator/components/com_flexicontent/models/items.php:369
15 Joomla\Registry\Registry->loadString() /var/www/vhosts/mysite.com/httpdocs/libraries/vendor/joomla/registry/src/Registry.php:72
16 Joomla\Registry\Format\Json->stringToObject() /var/www/vhosts/mysite.com/httpdocs/libraries/vendor/joomla/registry/src/Registry.php:366

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

More
9 years 3 months ago #64746 by Chabi01
After reading the post you gave me, i have tried "update xxxx_modules set params="" WHERE params = "{\"\"}";" without any results..

Can give me a hand on this ?
I check other sites : no issues of this type on FC items in backend.
Only one site have the issue. The strange thing : that's not a migrated site from J1 or j2, just an update from 3.6.2 to 3.6.4...
Thanks Georges,
Xavier

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

More
9 years 3 months ago - 9 years 3 months ago #64747 by ggppdk
Hello

the trace that you posted tell us exactly where the error is :) ;)

actually the fix is simple in case of bad data we need to catch the exception thrown by

new JRegistry(...);

and prevent the fatal error,

- also proper thing is to automate fixing this, if we detect bad JSON data then we clear the data from DB so that user does not need to do it manually

i will give you shortly or later today (because i also want to write a few lines of code to automate fix it in the DB),

and then of course will add the fix to our next release, so that the check benefits other users too


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 9 years 3 months ago by ggppdk.

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

More
9 years 3 months ago #64748 by Chabi01
Georges, i'm not a "full beginner" but in this case, you are so far in the sky amongst me :D
You write "the trace tell you exactly where is the error".
Well i'm sure you see it but i don't get the full knowledge to see what you see in debug :)
I don't know yet how to handle this message and resolve it.
I wait hungerly for your script and, if and only if you have the time for, the explanation on how to read and resolve this kind of issue in general with the debug info :)
Thanks to you Georges :)
Xavier

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

More
9 years 3 months ago #64749 by ggppdk
Hello

edit file: (at line 369)
administrator/components/com_flexicontent/models/items.php:

Replace line:
Code:
$item->config = new JRegistry($item->config);

with:
Code:
try { $item->config = new JRegistry($item->config); } catch (Exception $e) { $item->config = new JRegistry(); $this->_db->setQuery('UPDATE #__content SET attribs = "{}" WHERE id = ' . (int) $item->id); $this->_db->execute(); }

Then view the backend items manager page 2 times

- note there are more places to add checks

e.g. if you try to view the item with the broken JSON attributes in the frontend then you will get an error

but if you list it in the backend items manager then it will be fixed (thanks to above fix) then it will be fixed and you can then view it in frontend


- I will manually break the attributes of an item to see where the error is triggered to add check to all needed places ...

all these will be in v3.1.1 (coming this weekend) (v3.1.1 will only have a handful of fixes for rare issues and no new features)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

More
9 years 3 months ago #64754 by Chabi01
Hi Georges,
Uh.... in the file item.php i only have 44 lines...

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

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save