xref: /php-src/ext/opcache/tests/jit/cmp_006.phpt (revision c16ad918)
1--TEST--
2JIT CMP: 006 Undefined variable checks
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.protect_memory=1
8--FILE--
9<?php
10function test1($c) {
11    if ($c) {
12        $x = 1;
13    }
14    var_dump($x == 1);
15}
16function test2($c) {
17    if ($c) {
18        $x = 1.0;
19    }
20    var_dump($x == 1.0);
21}
22function test3($c) {
23    if (!$c) {
24        $x = 1;
25    }
26    if ($c) {
27        $y = 1;
28    }
29    var_dump($x == $y);
30}
31function test4($c) {
32    if (!$c) {
33        $x = 1.0;
34    }
35    if ($c) {
36        $y = 1.0;
37    }
38    var_dump($x == $y);
39}
40test1(false);
41test2(false);
42test3(false);
43test4(false);
44?>
45--EXPECTF--
46Warning: Undefined variable $x in %s on line %d
47bool(false)
48
49Warning: Undefined variable $x in %s on line %d
50bool(false)
51
52Warning: Undefined variable $y in %s on line %d
53bool(false)
54
55Warning: Undefined variable $y in %s on line %d
56bool(false)
57