Skip to content

Commit a3eb6cf

Browse files
committed
Fixing json_decode error handling in README
1 parent 1427a4e commit a3eb6cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if ($content === false) {
3535
throw new FileLoadingException('Could not load file foobar.json');
3636
}
3737
$foobar = json_decode($content);
38-
if ($foobar === null) {
38+
if (json_last_error() !== JSON_ERROR_NONE) {
3939
throw new FileLoadingException('foobar.json does not contain valid JSON: '.json_last_error());
4040
}
4141
```

0 commit comments

Comments
 (0)