xref: /PHP-8.1/ext/opcache/tests/bug70423.phpt (revision 3585f5aa)
1--TEST--
2Bug #70423 Warning Internal error: wrong size calculation
3--INI--
4open_basedir=.
5opcache.enabled=1
6opcache.enable_cli=1
7opcache.log_verbosity_level=2
8opcache.interned_strings_buffer=8
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13
14/* forked from Zend\tests\bug53958.phpt */
15
16
17// TEST 1
18$a = 1;
19$fn1 = function() use ($a) {echo "$a\n"; $a++;};
20$fn2 = function() use ($a) {echo "$a\n"; $a++;};
21$a = 5;
22$fn1(); // 1
23$fn2(); // 1
24$fn1(); // 1
25$fn2(); // 1
26
27// TEST 2
28$b = 1;
29$fn1 = function() use (&$b) {echo "$b\n"; $b++;};
30$fn2 = function() use (&$b) {echo "$b\n"; $b++;};
31$b = 5;
32$fn1(); // 5
33$fn2(); // 6
34$fn1(); // 7
35$fn2(); // 8
36
37// TEST 3
38$c = 1;
39$fn1 = function() use (&$c) {echo "$c\n"; $c++;};
40$fn2 = function() use ($c) {echo "$c\n"; $c++;};
41$c = 5;
42$fn1(); // 5
43$fn2(); // 1
44$fn1(); // 6
45$fn2(); // 1
46
47// TEST 4
48$d = 1;
49$fn1 = function() use ($d) {echo "$d\n"; $d++;};
50$fn2 = function() use (&$d) {echo "$d\n"; $d++;};
51$d = 5;
52$fn1(); // 1
53$fn2(); // 5
54$fn1(); // 1
55$fn2(); // 6
56?>
57--EXPECT--
581
591
601
611
625
636
647
658
665
671
686
691
701
715
721
736
74