xref: /PHP-8.0/ext/opcache/tests/jit/bug81512.phpt (revision b47a48ff)
1--TEST--
2Bug #81512: Unexpected behavior with arrays and JIT
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8--FILE--
9<?php
10$pipe = [['val1'],['val2'],];
11
12for ($i = 0; $i < 30; ++$i) {
13        echo "$i ";
14        if (!is_pipeline($pipe)) {
15                echo 'ERROR ';
16        }
17}
18
19function is_pipeline($pipeline): bool {
20        foreach ($pipeline as $stage) {
21                if (!is_array($stage)) {
22                		var_dump($stage);
23                        return false; // must never happen
24                }
25
26                $stage = (array) $stage;
27                reset($stage);
28        }
29
30        return true;
31}
32?>
33--EXPECT--
340 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
35