xref: /php-src/ext/opcache/tests/opt/sccp_022.phpt (revision e48a5c14)
1--TEST--
2SCCP 022: Invalid types
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo(int $x) {
15    $a[0] = $x;
16    $a[1] = 5;
17    echo $a[1];
18    $a->foo = 5;
19    echo $a[1];
20}
21function bar() {
22    foreach ($a as $v) {
23        foreach ($v as $v2) {}
24    }
25}
26?>
27--EXPECTF--
28$_main:
29     ; (lines=1, args=0, vars=0, tmps=0)
30     ; (after optimizer)
31     ; %s
320000 RETURN int(1)
33
34foo:
35     ; (lines=11, args=1, vars=2, tmps=1)
36     ; (after optimizer)
37     ; %s
380000 CV0($x) = RECV 1
390001 ASSIGN_DIM CV1($a) int(0)
400002 OP_DATA CV0($x)
410003 ASSIGN_DIM CV1($a) int(1)
420004 OP_DATA int(5)
430005 ECHO string("5")
440006 ASSIGN_OBJ CV1($a) string("foo")
450007 OP_DATA int(5)
460008 T2 = FETCH_DIM_R CV1($a) int(1)
470009 ECHO T2
480010 RETURN null
49
50bar:
51     ; (lines=9, args=0, vars=3, tmps=2)
52     ; (after optimizer)
53     ; %s
540000 V3 = FE_RESET_R CV0($a) 0007
550001 FE_FETCH_R V3 CV1($v) 0007
560002 V4 = FE_RESET_R CV1($v) 0005
570003 FE_FETCH_R V4 CV2($v2) 0005
580004 JMP 0003
590005 FE_FREE V4
600006 JMP 0001
610007 FE_FREE V3
620008 RETURN null
63LIVE RANGES:
64     3: 0001 - 0007 (loop)
65     4: 0003 - 0005 (loop)
66