xref: /PHP-8.4/Zend/tests/bug54268.phpt (revision 6d596207)
1--TEST--
2Bug #54268 (Double free when destroy_zend_class fails)
3--INI--
4memory_limit=8M
5--SKIPIF--
6<?php
7$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
8if ($zend_mm_enabled === "0") {
9    die("skip Zend MM disabled");
10}
11$tracing = extension_loaded("Zend OPcache")
12    && ($conf = opcache_get_configuration()["directives"])
13    && array_key_exists("opcache.jit", $conf)
14    &&  $conf["opcache.jit"] === "tracing";
15if (PHP_OS_FAMILY === "Windows" && PHP_INT_SIZE == 8 && $tracing) {
16    $url = "https://github.com/php/php-src/issues/15709";
17    die("xfail Test fails on Windows x64 (VS17) and tracing JIT; see $url");
18}
19?>
20--FILE--
21<?php
22class DestructableObject
23{
24        public function __destruct()
25        {
26                DestructableObject::__destruct();
27        }
28}
29class DestructorCreator
30{
31        public $test;
32        public function __destruct()
33        {
34                $this->test = new DestructableObject;
35        }
36}
37class Test
38{
39        public static $mystatic;
40}
41$x = new Test();
42Test::$mystatic = new DestructorCreator();
43?>
44--EXPECTF--
45Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d
46