Download src/php/php-src/ext/json/tests/bug71835.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug71835.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/json/tests/bug71835.phpt
-
curl -L -o bug71835.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug71835.phpt
576 Bytes
| --TEST-- | |
| Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSerializable) | |
| --FILE-- | |
| class SomeClass implements JsonSerializable { | |
| public function jsonSerialize(): mixed { | |
| return [get_object_vars($this)]; | |
| } | |
| } | |
| $class = new SomeClass; | |
| $arr = [$class]; | |
| var_dump(json_encode($arr)); | |
| class SomeClass2 implements JsonSerializable { | |
| public function jsonSerialize(): mixed { | |
| return [(array)$this]; | |
| } | |
| } | |
| $class = new SomeClass2; | |
| $arr = [$class]; | |
| var_dump(json_encode($arr)); | |
| --EXPECT-- | |
| string(6) "[[[]]]" | |
| string(6) "[[[]]]" | |