diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-23 12:43:07 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-23 12:43:07 +0200 |
| commit | 4831e150c5ada631c1480098b8a42cbf024d8899 (patch) | |
| tree | 42f34492fb371f336fc123a5b7b176bd463a1eef /ext/json/tests | |
| parent | ce73841cdcfd86a2cf5d7e1c251095254985324d (diff) | |
| download | php-git-4831e150c5ada631c1480098b8a42cbf024d8899.tar.gz | |
Fixed bug #77843
Diffstat (limited to 'ext/json/tests')
| -rw-r--r-- | ext/json/tests/bug77843.phpt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/json/tests/bug77843.phpt b/ext/json/tests/bug77843.phpt new file mode 100644 index 0000000000..c525285bf5 --- /dev/null +++ b/ext/json/tests/bug77843.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #77843: Use after free with json serializer +--FILE-- +<?php + +class X implements JsonSerializable { + public $prop = "value"; + public function jsonSerialize() { + 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"}]]" |
