xref: /php-src/ext/opcache/tests/opt/sccp_024.phpt (revision e48a5c14)
1--TEST--
2SCCP 024: Const replacing to op2 of INSTANCEOF
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
14class A {
15    function t($obj) {
16        $a = "A";
17        $b = "self";
18        $c = 1;
19        echo ($obj instanceof $a);
20        echo ($obj instanceof $b);
21        echo ($obj instanceof $c);
22    }
23}
24?>
25--EXPECTF--
26$_main:
27     ; (lines=1, args=0, vars=0, tmps=0)
28     ; (after optimizer)
29     ; %ssccp_024.php:1-13
300000 RETURN int(1)
31
32A::t:
33     ; (lines=10, args=1, vars=2, tmps=2)
34     ; (after optimizer)
35     ; %ssccp_024.php:3-10
360000 CV0($obj) = RECV 1
370001 CV1($c) = QM_ASSIGN int(1)
380002 T2 = INSTANCEOF CV0($obj) string("A")
390003 ECHO T2
400004 T2 = INSTANCEOF CV0($obj) string("self")
410005 ECHO T2
420006 V3 = FETCH_CLASS (no-autoload) (silent) (exception) CV1($c)
430007 T2 = INSTANCEOF CV0($obj) V3
440008 ECHO T2
450009 RETURN null
46