xref: /php-src/ext/opcache/tests/gh16186_002.phpt (revision 82f70dba)
1--TEST--
2GH-16186 002 (Non-tracing JIT uses Closure scope)
3--EXTENSIONS--
4opcache
5--INI--
6opcache.enable=1
7opcache.enable_cli=1
8opcache.jit_buffer_size=64M
9opcache.jit=0214
10opcache.file_update_protection=0
11opcache.revalidate_freq=0
12opcache.protect_memory=1
13--FILE--
14<?php
15
16class A {
17    private $x;
18    public function getIncrementor() {
19        return function() { $this->x++; };
20    }
21}
22$a = new A();
23$f = $a->getIncrementor();
24$c = new stdClass();
25$f();
26$f2 = Closure::bind($f, $c);
27$f2();
28$f2();
29
30var_dump($c);
31
32?>
33--EXPECTF--
34Warning: Undefined property: stdClass::$x in %s on line %d
35object(stdClass)#%d (1) {
36  ["x"]=>
37  int(2)
38}
39