Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_decode() Errors #78

Open
the-invisible-man opened this issue Aug 23, 2013 · 1 comment
Open

json_decode() Errors #78

the-invisible-man opened this issue Aug 23, 2013 · 1 comment

Comments

@the-invisible-man
Copy link

An exception should be thrown if PHP fails to decode a json string. It's possible for ElasticSearch to return a bad string.

In ES one can insert a record as follows:
curl -XPOST -d '{ field : "data"}'

When the correct way would be:
curl -XPOST -d '{ "field" : "data"}'

Note the double quotes around the field name. ES accepts this and returns "ok", "true". When querying from the PHP client ES returns the faulty json string and the client isn't able to decode it, the program execution continues and stops with a 'Call to undefined method query() in Sherlock/Sherlock'

@polyfractal
Copy link
Owner

Interesting, this is indeed bad behavior. Sherlock should definitely throw exceptions on json errors, rather than allowing execution to continue. I'll look into it later this week when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants