mChat

syntaxerror - mChat

syntaxerror

by nakna » Mon Aug 07, 2017 1:36 pm

Hi there, i just installed phpBB 3.1.11 with this Mchat. everything is working but time to time this error will show up :
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
when i disable this extension its ok, but i love it and i wanna keep it enabled. can U help me with this ? thanks
nakna
Registered User
Posts: 5
Joined: Mon Apr 28, 2008 12:06 pm
Contact:

Re: syntaxerror

by kasimi » Mon Aug 07, 2017 1:46 pm

How often does this happen? I'd have to take a look at this myself. Send me a PM with a link to your board and an account that has access to mChat.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 4579
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: syntaxerror

by nakna » Mon Aug 07, 2017 2:05 pm

not so often, but when i click on white text field it will show up in a second but it looks like only in firefox browser.
pm was sent
nakna
Registered User
Posts: 5
Joined: Mon Apr 28, 2008 12:06 pm
Contact:

Re: syntaxerror

by kasimi » Mon Aug 07, 2017 2:13 pm

Your web server adds this error message before the JSON data which causes mChat to fail when parsing it. If you're on a shared hosting plan, you should contact your hoster to fix this issue.
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead.
Until it gets fixed, you can disable who is chatting in the ACP, as this error only happens for who is chatting updates.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 4579
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: syntaxerror

by nakna » Mon Aug 07, 2017 2:39 pm

thank you for really fast respond and full support. Problem solved. Thanks
nakna
Registered User
Posts: 5
Joined: Mon Apr 28, 2008 12:06 pm
Contact:

Re: syntaxerror

by bug-i » Mon Oct 09, 2017 6:09 am

Hello, I have a similar issue with this error, but now the error comes permanent (and I have "Who is chatting" disabled).

This might be related to another extension I have installed (top poster of the month - TPOTM)

The mchat-error happens at my installation when I activate the latest version of TPOTM-Extension
https://github.com/3D-I/tpotm/files/136 ... _201RC.zip

I have described the mchat-error detailed here, it would be nice if someone would have a deeper look into it
viewtopic.php?f=456&t=2438406&start=60#p14841981
bug-i
Registered User
Posts: 133
Joined: Fri Feb 17, 2017 12:45 pm
Contact:

Re: syntaxerror

by 3Di » Mon Oct 09, 2017 6:27 pm

What has been changed between 1.1.5 and 1.1.6 of TPOTM it is one of the subscribed events in the listener (which could be of interest), now uses

'core.user_setup_after' instead of 'core.page_footer'

Nothing else about events(PHP or HTML ones)

I tried multiple combo there, today I went to disable everything and use only MChat, the error here described doesn't occur on my fresh 3.2.1 at least in local host (PC). I noticed though a discrepance with the "Who's chatting" bit, here is a screenshot of the app.php page where the issue happens https://prnt.sc/gvan95 , instead on index page it shows correctly.

As I said with TPOTM enabled the behaviour does not change.

@ bug-i - you could try this advice and see if the error goes away.
kasimi wrote:Until it gets fixed, you can disable who is chatting in the ACP, as this error only happens for who is chatting updates.
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity ยบ PhpStorm's proud user ยบ Extensions, Scripts, MOD porting, Update/Upgrades
๐Ÿš€ Looking for a specific feature or alternative option? We will rock you! ๐Ÿš€
User avatar
3Di
Former Team Member
Posts: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: syntaxerror

by kasimi » Mon Oct 09, 2017 7:50 pm

I can't reproduce this, although TPOTM says
At the present time is not yet available out of 2
bug-i wrote:The mchat-error happens at my installation when I activate the latest version of TPOTM-Extension
Can you post or PM me a link (and an account if needed) to your board where this happens?
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 4579
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: syntaxerror

by 3Di » Mon Oct 09, 2017 11:32 pm

kasimi wrote: although TPOTM says
At the present time is not yet available out of 2
That's pretty normal on a fresh installation, Founders aren't included as per default in ACP.
(2 are the total post of the board within a timegap, the current month).. I should amend the wording of that last response in this case. Thx.

Irrilevant though, MChat should list you if you are in chat in both situations: index or app.php IMO.
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity ยบ PhpStorm's proud user ยบ Extensions, Scripts, MOD porting, Update/Upgrades
๐Ÿš€ Looking for a specific feature or alternative option? We will rock you! ๐Ÿš€
User avatar
3Di
Former Team Member
Posts: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: syntaxerror

by 3Di » Tue Oct 10, 2017 7:48 am

Sorted out the MChat error is due
file_exists(): open_basedir restriction in effect. File(./../../../ext/threedi/tpotm/styles/prosilver/theme/images/tpotm_badge.png) is not within the allowed path(s):
That doesn't happens on my env, I told bug-i to ask the host.

edit: see below, pls.
Last edited by 3Di on Tue Oct 10, 2017 8:11 am
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity ยบ PhpStorm's proud user ยบ Extensions, Scripts, MOD porting, Update/Upgrades
๐Ÿš€ Looking for a specific feature or alternative option? We will rock you! ๐Ÿš€
User avatar
3Di
Former Team Member
Posts: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: syntaxerror

by 3Di » Tue Oct 10, 2017 8:05 am

And this is the report of the debugger instead

The strange bit is: TPOTM got perms for guests there, MChat no.
While you are logged out (guest) this error doesn't happens visiting the hall of fame or doing whatever else. Debugger is clean.

AJAX error. status: parsererror, message: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data {"refresh":true,"log":0}) mchat.js:145:5

Code: Select all

if (typeof console !== 'undefined' && console.log) {
	console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown + ' (' + xhr.responseText + ')');
Here's the full message in console JS activated
AJAX error. status: parsererror, message: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data <b>file_exists(): open_basedir restriction in effect. File(./../../../ext/threedi/tpotm/styles/prosilver/theme/images/tpotm_badge.png) is not within the allowed path(s): (/var/www/vhosts/sitename.tld/:/tmp/)</b><br />{"refresh":true,"log":0}) mchat.js:145:5
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity ยบ PhpStorm's proud user ยบ Extensions, Scripts, MOD porting, Update/Upgrades
๐Ÿš€ Looking for a specific feature or alternative option? We will rock you! ๐Ÿš€
User avatar
3Di
Former Team Member
Posts: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: syntaxerror

by kasimi » Tue Oct 10, 2017 8:37 am

It doesn't look like this issue is related with mChat, but I'm confused why it only happens when mChat is enabled. Where and how is this path constructed?

Code: Select all

./../../../ext/threedi/tpotm/styles/prosilver/theme/images/tpotm_badge.png
I can do some debugging myself at the end of the day.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 4579
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: syntaxerror

by 3Di » Tue Oct 10, 2017 8:47 am

Is here: https://github.com/3D-I/tpotm/blob/mast ... m.php#L141


and where is here: https://github.com/3D-I/tpotm/blob/mast ... #L524-L534

When MChat is activated (no Guests)
and TPOTM also (Guests)

and you visit the board as Guest, that doesn't happen.

I will PM you the logins to there. ;)
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity ยบ PhpStorm's proud user ยบ Extensions, Scripts, MOD porting, Update/Upgrades
๐Ÿš€ Looking for a specific feature or alternative option? We will rock you! ๐Ÿš€
User avatar
3Di
Former Team Member
Posts: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: syntaxerror

by bug-i » Wed Oct 11, 2017 8:01 am

Excellent work. Thanks to 3Di and kasimin for all the time and work done so far to find the bug and fixing it!

mChat is now working perfectly smooth togehter with Top Poster of the Month - TPOTM.
bug-i
Registered User
Posts: 133
Joined: Fri Feb 17, 2017 12:45 pm
Contact:

Re: syntaxerror

by ***Blaze*** » Sun Dec 09, 2018 8:52 am

After switch version of php from 5.6 to 7.2 at our board we have this error:

Code: Select all

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Installed extensions:

Code: Select all

Advertisement Management 	1.1.0
AntiBot100500 	0.0.9
Convert Local Url To Link Name 	0.3.0
External Links 	1.0.5
First post on every page 	2.0.2
Google Code Prettify 1.1.0
Extension Highslide 0.0.2
mChat 2.1.1
phpBB3 SEO Sitemap 	1.1.1
Posts merging 	2.1.0
Precise Similar Topics 	1.4.2
QuickReply Reloaded 	2.0.0-beta3
SEO Meta Description 	1.0.0 
Version of phpBB is 3.2.2

I sent PM with a link and with created account for you.

Screenshots:
http://sh.uploads.ru/Q6y9J.png
http://sg.uploads.ru/qVGcg.png
http://s3.uploads.ru/MrA1q.png

Thanks.
My website ublaze.ru
User avatar
***Blaze***
Registered User
Posts: 53
Joined: Tue May 22, 2007 6:21 am
Location: Dankov, Russia
Name: Aleksej
Contact: