xref: /php-src/Zend/tests/gh17162.phpt (revision ee0daa59)
1--TEST--
2GH-17162 (zend_array_try_init() with dtor can cause engine UAF)
3--FILE--
4<?php
5class Test {
6    function __destruct() {
7        global $box;
8        $box->value = null;
9    }
10}
11$box = [new Test];
12// Using getimagesize() for the test because it's always available,
13// but any function that uses zend_try_array_init() would work.
14try {
15    getimagesize("dummy", $box);
16} catch (Error $e) {
17    echo $e->getMessage(), "\n";
18}
19?>
20--EXPECT--
21Attempt to assign property "value" on null
22