heiseonline / shariff-backend-php

👮 PHP backend for Shariff. Shariff enables website users to share their favorite content without compromising their privacy.
http://ct.de/-2467514
133 stars 44 forks source link

Shariff: PHP Fatal error: Uncaught exception #126

Closed bavramor closed 6 years ago

bavramor commented 7 years ago

Hi,

i am getting this error. I think this is a syntax error in my shariff.json, but i can't find the issue. Or i am wrong?

[Mon Oct 16 12:15:43.511049 2017] [:error] [pid 11958] [client 66.249.76.125:43152] PHP Fatal error: Uncaught exception 'Zend\Config\Exception\RuntimeException' with message 'Decoding failed: Syntax error' in /srv/www/seedinit/shariff-backend/vendor/zendframework/zend-config/src/Reader/Json.php:50\nStack trace:\n#0 /srv/www/seedinit/shariff-backend/index.php(21): Zend\Config\Reader\Json->fromFile('shariff.json')\n#1 /srv/www/seedinit/shariff-backend/index.php(26): Application::run()\n#2 {main}\n thrown in /srv/www/seedinit/shariff-backend/vendor/zendframework/zend-config/src/Reader/Json.php on line 50, referer: https://www.seed.uno/blog/articles/1883-building-inclusive-value-chains.html

my shariff.json file:

{ "cache": { "ttl": 60 }, "domain": "www.xxxxxxxxx.com", "services": [ "GooglePlus", "Facebook", "LinkedIn" ], "Facebook": [ "app_id" => "1796xxxxxxxxxxxxxxxxxxx", "secret" => "66448xxxxxxxxxxxxxxxxx" ] }

The Console in my Chrome Developer Tools says:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

https://www.xxxx.com/shariff-backend/?url=https%3A%2F%2Fwww.xxxx.com%2Fnews%2Farticle%2F3205-2017-xxxxxxxxxx.xxxxxx.html

Thnx

Bavra

liayn commented 7 years ago

Your Facebook definition is wrong. This is an object and not an array

 "Facebook": { "app_id" => "1796xxxxxxxxxxxxxxxxxxx", "secret" => "66448xxxxxxxxxxxxxxxxx" }
bavramor commented 7 years ago

Thx for helping me.

I have changed the Facebook part, with the same issue result.

{ "cache": { "ttl": 60 }, "domains": "www.xxxx.com", "services": [ "GooglePlus", /* "Facebook", */ "LinkedIn" ], /* "Facebook": { "app_id" =>"1796xxxxxxxxxxxxxxxxx", "secret" =>"6644xxxxxxxxxxxx" } */ }

Afterwards I have commented out the Facebook part, but there is the same error.

What did I wrong?

liayn commented 7 years ago

Comment??

Sorry, you've to refresh your knowledge about JSON. This is a (human-readable) storage data-structure and does not have such a thing like comments.

I overlooked in your JSON that you actually used PHP assignment operators, which is of course invalid as well.

{ "cache": { "ttl": 60 }, "domain": "www.xxxxxxxxx.com", "services": [ "GooglePlus", "Facebook", "LinkedIn" ], "Facebook": { "app_id": "1796xxxxxxxxxxxxxxxxxxx", "secret": "66448xxxxxxxxxxxxxxxxx" } }
compeak commented 6 years ago

Closing because of inactivity. Feel free to reopen.