Download src/php/php-src/ext/json/tests/007.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 820 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/007.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/json/tests/007.phpt
-
curl -L -o 007.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/007.phpt
820 Bytes
| --TEST-- | |
| json_last_error() tests | |
| --FILE-- | |
| <?php | |
| var_dump(json_decode("[1]")); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| var_dump(json_decode("[[1]]", false, 2)); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| var_dump(json_decode("[1}")); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| var_dump(json_decode('["' . chr(0) . 'abcd"]')); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| var_dump(json_decode("[1")); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| echo "Done\n"; | |
| ?> | |
| --EXPECT-- | |
| array(1) { | |
| [0]=> | |
| int(1) | |
| } | |
| int(0) | |
| string(8) "No error" | |
| NULL | |
| int(1) | |
| string(28) "Maximum stack depth exceeded" | |
| NULL | |
| int(2) | |
| string(42) "State mismatch (invalid or malformed JSON)" | |
| NULL | |
| int(3) | |
| string(53) "Control character error, possibly incorrectly encoded" | |
| NULL | |
| int(4) | |
| string(12) "Syntax error" | |
| Done | |