xref: /PHP-5.3/Zend/tests/bug39018.phpt (revision 26cde1ee)
1--TEST--
2Bug #39018 (Error control operator '@' fails to suppress "Uninitialized string offset")
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8$a = 'foo';
9$a[11111111111];
10
11$a = '';
12
13$a[0];
14
15print $a[0]; // 12
16
17$a[-11111111111111111111111];
18
19print $a[-11111111111111111111111]; // 16
20
21$a[-0];
22
23$x = 'test';
24
25@$x[4];
26
27@$y = $x[4];
28
29@('a' == $x[4]);
30
31$x[4] == 'a'; // 28
32
33@$x[4] == 'a';
34
35(@$x[4]) == 'a';
36
37($x[4]) == 'a'; // 34
38
39(@($x[4])) == 'a';
40
41(($x[4])) == 'a'; // 38
42
43@($x[4]) == 'a';
44
45($x[4]) == 'a'; // 42
46
47@($x[4] == 'a');
48
49($x[4] == 'a'); // 46
50
51$y = 'foobar';
52
53$y[12.2];
54
55print $y[12.2]; // 52
56
57$y[3.5];
58
59print $y[3.5]; // 56
60
61print "\nDone\n";
62
63?>
64--EXPECTF--
65
66Notice: Uninitialized string offset: 0 in %s on line 12
67
68Notice: Uninitialized string offset: %i in %s on line 16
69
70Notice: Uninitialized string offset: 4 in %s on line 28
71
72Notice: Uninitialized string offset: 4 in %s on line 34
73
74Notice: Uninitialized string offset: 4 in %s on line 38
75
76Notice: Uninitialized string offset: 4 in %s on line 42
77
78Notice: Uninitialized string offset: 4 in %s on line 46
79
80Notice: Uninitialized string offset: 12 in %s on line 52
81b
82Done
83