jacobwb / hashover-next

This branch will be HashOver 2.0
GNU Affero General Public License v3.0
420 stars 87 forks source link

Uncaught SyntaxError: Unexpected end of JSON input #264

Open girtsazis opened 5 years ago

girtsazis commented 5 years ago

I installed Hashover, but the comments do not appear at all. I looked up the console on Chrome and it shoved this error.

VM2115:1 Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse () at XMLHttpRequest.onSuccess (comments.php:269) at XMLHttpRequest.xhr.onreadystatechange (comments.php:300)

How to fix this issue?

jeremyjohn commented 5 years ago

I got the same error if I'm initiating the script from a sub folder. If from the root folder it works.

jorgesumle commented 5 years ago

I also have this issue when I try to post a comment.

Screenshot at 2019-08-27 00:18:18

jacobwb commented 5 years ago

Sorry to see this is still an issue.

@jorgesumle, I tried to post a comment on your website and received this error as well, but the error itself is not useful, the request response is what would contain more info. However, the request response is empty, likely because your server is configured to hide PHP errors. If you can enable PHP errors or check your server logs for the error and post it here that would help.

My best guess without more information is that an extension is missing. However, judging from how HashOver is behaving on your website, I would say you have XML, JSON, and OpenSSL support, so HashOver should be working. It could also be improper file permissions.

Or another possibility is that you are running a PHP version older than 7.0. HashOver is intended for PHP versions as old as 5.3.3, but I have let 7.0-only features slip into the codebase temporarily before. Since your website is not using the latest code, this could be the cause of the issue.

If you can, please get the request response and post it here.

jacobwb commented 5 years ago

@jorgesumle Upon closer inspection, I see that your website is using two different versions of HashOver. The page you show is loading the JavaScript front-end from one version, while requesting the comments from another version. This is probably the cause of the issue.

You can fix this by either...

  1. Moving /programas/pruebas/hashover-next to /hashover-next2, for example. Or...

  2. Adding 'http-root' => '/programas/pruebas/hashover-next' to the settings JSON file at /programas/pruebas/hashover-next/config/settings.json

girtsazis commented 5 years ago

Or another possibility is that you are running a PHP version older than 7.0. HashOver is intended for PHP versions as old as 5.3.3, but I have let 7.0-only features slip into the codebase temporarily before. Since your website is not using the latest code, this could be the cause of the issue.

This is my Current PHP version: 5.4.45-0+deb7u14 Will it work?

jacobwb commented 5 years ago

@girtsazis Yes, that version is fine. If you are using the latest HashOver code it should not matter what version of PHP you are using as long as it is newer than 5.3.

Are you able to create a page on your website with HashOver on it for me to test?

That might help me find the issue for you.

jorgesumle commented 5 years ago

@jacobwb, thanks a lot for your help. I solved my issue, and I'm very happy with the new design of Hashover, the "default-dark" theme is awesome! I can also try to help you if you link to a website, @girtsazis.

girtsazis commented 5 years ago

@girtsazis Yes, that version is fine. If you are using the latest HashOver code it should not matter what version of PHP you are using as long as it is newer than 5.3.

Are you able to create a page on your website with HashOver on it for me to test?

That might help me find the issue for you.

I installed a fresh copy of the latest Hashover. Here is a test page https://www.watchathletics.com/test.php

jacobwb commented 5 years ago

The error on the page:

HashOver: File "intldateformatter.php" could not be included!

Tells me that your server does not have a common extension for internationalization, this is an extension used to display the comment post date and time in an appropriate format for the current locale. The extension is often part of a standard PHP installation as it is part of the bundle.

However, it looks like you don't have it installed. The extension is named "intl", on Debian/Ubuntu systems it is available as a package named "php-intl", other distributions will likely have a different but similar name for the package, and you might be able to install it from cPanel.

gour commented 3 years ago

Hello,

I've problem with the latest code on my server:

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    onSuccess https://demo.atmarama.net/hashover/comments.php:281
    onreadystatechange https://demo.atmarama.net/hashover/comments.php:312
    ajax https://demo.atmarama.net/hashover/comments.php:303
    instantiator https://demo.atmarama.net/hashover/comments.php:410
    createThread https://demo.atmarama.net/hashover/comments.php:472
    onReady https://demo.atmarama.net/hashover/comments.php:55
    onReady https://demo.atmarama.net/hashover/comments.php:54
    createThread https://demo.atmarama.net/hashover/comments.php:471
    HashOver https://demo.atmarama.net/hashover/comments.php:27
    <anonymous> https://demo.atmarama.net/hashover/comments.php:3852
    <anonymous> https://demo.atmarama.net/hashover/comments.php:3853

Any hint?

All the required modules are installed and server is running Debian/php-7.4.15.

jacobwb commented 3 years ago

@gour The error you're getting is "Parse error: syntax error, unexpected 'mysql' (T_STRING), expecting ';' or ',' in /home/atmarama/public_html/demo/hashover/backend/classes/secrets.php on line 50".

You probably mistyped something when editing the /hashover/backend/classes/secrets.php file, likely a missing closing single quote for the value of the $databaseType setting. Please check if that line is correct, if you don't know, please post it here.

gour commented 3 years ago

@jacobwb Thank you! Yes, I forgot to quote adminPassword :disappointed: