xref: /php-src/ext/opcache/tests/jit/bug80802.phpt (revision c16ad918)
1--TEST--
2Bug #80802: zend_jit_fetch_indirect_var assert failure with tracing JIT
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.jit=tracing
7--EXTENSIONS--
8opcache
9--FILE--
10<?php
11abstract class AsyncTask{
12        private static $threadLocalStorage = null;
13
14        protected function storeLocal(string $key, $complexData) : void{
15                if(self::$threadLocalStorage === null){
16                        self::$threadLocalStorage = new \ArrayObject();
17                }
18                self::$threadLocalStorage[spl_object_id($this)][$key] = $complexData;
19        }
20
21        final public function __destruct(){
22                $this->reallyDestruct();
23                if(self::$threadLocalStorage !== null and isset(self::$threadLocalStorage[$h = spl_object_id($this)])){
24                        unset(self::$threadLocalStorage[$h]);
25                        if(self::$threadLocalStorage->count() === 0){
26                                self::$threadLocalStorage = null;
27                        }
28                }
29        }
30
31        protected function reallyDestruct() : void{
32
33        }
34}
35
36class Task extends AsyncTask{
37        public function __construct(){
38                $this->storeLocal("thing1", new stdClass);
39        }
40}
41
42for($i = 0; $i < 10000; ++$i){
43        new Task;
44}
45echo "OK\n";
46?>
47--EXPECT--
48OK
49