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

Throw error if json encoding fails #18

Closed
wants to merge 1 commit into from
Closed

Conversation

harryf
Copy link

@harryf harryf commented May 12, 2015

This would help debugging.

Ran into an issue where the content we were trying to encode was not UTF-8 encoded. This lead to this mysterious error...

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Invalid resource type: boolean'

Be warned that using json_last_error() requires PHP > 5.5.0 although it's easy to roll your own http://php.net/manual/en/function.json-last-error-msg.php#113243

@tbarbugli
Copy link
Member

thank you for pointing this out. I am going to roll a solution for this that works on PHP 5.4

@TerjeBr
Copy link

TerjeBr commented Feb 22, 2016

Since you are already depending on Guzzle, may be make use of the json error handling routine that is implemented in Guzzle?

@hannesvdvreken
Copy link
Contributor

@TerjeBr see #49

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

Successfully merging this pull request may close these issues.

None yet

4 participants