Skip to content

Commit 7fd04bd

Browse files
author
Arthur Cinader
authored
Merge pull request #308 from montymxb/bad-json
Added check for invalid responses which are not empty.
2 parents d4e03fd + 2124d2c commit 7fd04bd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Parse/ParseClient.php

+10
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,16 @@ public static function _request(
493493
}
494494

495495
$decoded = json_decode($response, true);
496+
497+
if(!isset($decoded) && $response !== '') {
498+
throw new ParseException(
499+
'Bad Request. Could not decode Response: '.
500+
'('.json_last_error().') '.json_last_error_msg(),
501+
-1
502+
);
503+
504+
}
505+
496506
if (isset($decoded['error'])) {
497507
// check to convert error to a string, if an array
498508
// used to handle an Array 'error' from back4app.com

0 commit comments

Comments
 (0)