Skip to content

Navigation Menu

Sign in
Sign up

Return null on empty json string in PHP7 - #712

Open
thomaslorentsen wants to merge 1 commit into
rackspace:working from
thomaslorentsen:working
Open

Return null on empty json string in PHP7 #712
thomaslorentsen wants to merge 1 commit into
rackspace:working from
thomaslorentsen:working

Conversation

@thomaslorentsen

@thomaslorentsen thomaslorentsen commented Aug 26, 2017

Copy link
Copy Markdown

PHP7 no longer considers an empty string as valid JSON.

When passing an empty string to json_decode an exception is raised instead of returning null.

This is documented on the PHP7 Backward incompatible changes page.

I have updated the method to check for an empty response string and return null instead.

PHP7 uses the JSOND extension for parsing JSON which now throws an error
on an empty string. The JSON response is checked whether it is empty
before decoding it and returns null for backwards compatibility.
@thomaslorentsen thomaslorentsen changed the title (削除) Fix return null on empty json string in PHP7 (削除ここまで) (追記) Return null on empty json string in PHP7 (追記ここまで) Aug 26, 2017

coveralls commented Aug 26, 2017
edited
Loading

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 88.777% when pulling 07a84ab on thomaslorentsen:working into ea17eff on rackspace:working.

1 similar comment

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 88.777% when pulling 07a84ab on thomaslorentsen:working into ea17eff on rackspace:working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /