Skip to content

Commit 5d64aa5

Browse files
committed
fixed php json empty input behavior
1 parent cf242a0 commit 5d64aa5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Qiniu/functions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ function json_decode($json, $assoc = false, $depth = 512)
8787
JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
8888
);
8989

90+
if (empty($json)) {
91+
return null;
92+
}
9093
$data = \json_decode($json, $assoc, $depth);
9194

9295
if (JSON_ERROR_NONE !== json_last_error()) {

0 commit comments

Comments
 (0)