xref: /PHP-8.1/Zend/tests/bug54268.phpt (revision c5401854)
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?>
12--FILE--
13<?php
14class DestructableObject
15{
16        public function __destruct()
17        {
18                DestructableObject::__destruct();
19        }
20}
21class DestructorCreator
22{
23        public function __destruct()
24        {
25                $this->test = new DestructableObject;
26        }
27}
28class Test
29{
30        public static $mystatic;
31}
32$x = new Test();
33Test::$mystatic = new DestructorCreator();
34?>
35--EXPECTF--
36Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d
37