xref: /PHP-8.1/ext/opcache/tests/opt/sccp_024.phpt (revision e9f783fc)
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=
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13class A {
14    function t($obj) {
15        $a = "A";
16        $b = "self";
17        $c = 1;
18        echo ($obj instanceof $a);
19        echo ($obj instanceof $b);
20        echo ($obj instanceof $c);
21    }
22}
23?>
24--EXPECTF--
25$_main:
26     ; (lines=1, args=0, vars=0, tmps=0)
27     ; (after optimizer)
28     ; %ssccp_024.php:1-13
290000 RETURN int(1)
30
31A::t:
32     ; (lines=10, args=1, vars=2, tmps=2)
33     ; (after optimizer)
34     ; %ssccp_024.php:3-10
350000 CV0($obj) = RECV 1
360001 CV1($c) = QM_ASSIGN int(1)
370002 T2 = INSTANCEOF CV0($obj) string("A")
380003 ECHO T2
390004 T2 = INSTANCEOF CV0($obj) string("self")
400005 ECHO T2
410006 V3 = FETCH_CLASS (no-autoload) (silent) (exception) CV1($c)
420007 T2 = INSTANCEOF CV0($obj) V3
430008 ECHO T2
440009 RETURN null
45