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

More
8 years 4 weeks ago - 8 years 4 weeks 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...
Last edit: 8 years 4 weeks ago by ggppdk.
The following user(s) said Thank You: Chabi01

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

More
8 years 4 weeks 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
8 years 3 weeks 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...
The following user(s) said Thank You: davidote

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

More
8 years 3 weeks 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.

More
8 years 3 weeks ago #64755 by ggppdk
Hello

it is 'items' not 'item'

It is the 4th file

administrator/components/com_flexicontent/models/item.php
administrator/components/com_flexicontent/models/itemcompare.php
administrator/components/com_flexicontent/models/itemelement.php
administrator/components/com_flexicontent/models/items.php

it is some times easy to open wrong file:
(item.php if for backend item form)
(items.php is backend items manager)


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

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

More
8 years 3 weeks ago #64756 by Chabi01
sorry, i'm a dush : you wrote items, not item...
I try...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.449 seconds
Save
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