summaryrefslogtreecommitdiff
path: root/ext/opcache/tests/jit/fetch_dim_r_004.phpt
blob: b781dc2cc4b42da01553f0a0dbb151f54acbe6ed (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--TEST--
JIT FETCH_DIM_R: 004
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
;opcache.jit_debug=257
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function foo($n) {
    $a = "ABCDEF";
    var_dump($a[$n]);
}
foo(0);
foo(2);
foo(1.0);
foo("0");
foo("2");
foo(false);
foo(true);
foo(null);
foo("ab");
$x="a";
$y="b";
foo($x.$y);
foo("2x");
$x=2;
$y="x";
foo($x.$y);
--EXPECTF--
string(1) "A"
string(1) "C"

Warning: String offset cast occurred in %s on line %d
string(1) "B"
string(1) "A"
string(1) "C"

Warning: String offset cast occurred in %s on line %d
string(1) "A"

Warning: String offset cast occurred in %s on line %d
string(1) "B"

Warning: String offset cast occurred in %s on line %d
string(1) "A"

Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
string(1) "A"

Warning: Illegal string offset "ab" in %sfetch_dim_r_004.php on line 4
string(1) "A"

Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
string(1) "C"

Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
string(1) "C"