Download src/php/php-src/ext/json/tests/bug77843.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 437 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug77843.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/json/tests/bug77843.phpt
-
curl -L -o bug77843.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/json/tests/bug77843.phpt
437 Bytes
| --TEST-- | |
| Bug #77843: Use after free with json serializer | |
| --FILE-- | |
| class X implements JsonSerializable { | |
| public $prop = "value"; | |
| public function jsonSerialize(): mixed { | |
| global $arr; | |
| unset($arr[0]); | |
| var_dump($this); | |
| return $this; | |
| } | |
| } | |
| $arr = [new X()]; | |
| var_dump(json_encode([&$arr])); | |
| --EXPECT-- | |
| object(X)#1 (1) { | |
| ["prop"]=> | |
| string(5) "value" | |
| } | |
| string(20) "[[{"prop":"value"}]]" | |