Download src/php/php-src/ext/json/tests/bug54058.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 913 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug54058.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/json/tests/bug54058.phpt
-
curl -L -o bug54058.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug54058.phpt
913 Bytes
| --TEST-- | |
| Bug #54058 (json_last_error() invalid UTF-8 produces wrong error) | |
| --FILE-- | |
| $bad_utf8 = quoted_printable_decode('=B0'); | |
| json_encode($bad_utf8); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| $a = new stdclass; | |
| $a->foo = quoted_printable_decode('=B0'); | |
| json_encode($a); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| $b = new stdclass; | |
| $b->foo = $bad_utf8; | |
| $b->bar = 1; | |
| json_encode($b); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| $c = array( | |
| 'foo' => $bad_utf8, | |
| 'bar' => 1 | |
| ); | |
| json_encode($c); | |
| var_dump(json_last_error(), json_last_error_msg()); | |
| --EXPECT-- | |
| int(5) | |
| string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" | |
| int(5) | |
| string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" | |
| int(5) | |
| string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" | |
| int(5) | |
| string(56) "Malformed UTF-8 characters, possibly incorrectly encoded" | |