File tree Expand file tree Collapse file tree 3 files changed +82
-0
lines changed Expand file tree Collapse file tree 3 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -3456,6 +3456,9 @@ static zend_always_inline zend_result _zend_update_type_info(
3456
3456
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
3457
3457
* behind, because it can't be converted to DIM_FETCH_R. */
3458
3458
break ;
3459
+ case ZEND_FREE :
3460
+ /* This may happen if the using opcode is DCEd. */
3461
+ break ;
3459
3462
EMPTY_SWITCH_DEFAULT_CASE ()
3460
3463
}
3461
3464
j = zend_ssa_next_use (ssa -> ops , ssa_op -> result_def , j );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Using string offset as object
3
+ --FILE--
4
+ <?php
5
+
6
+ $ str = "x " ;
7
+ try {
8
+ $ str [0 ]->bar = "xyz " ;
9
+ } catch (Error $ e ) {
10
+ echo $ e ->getMessage (), "\n" ;
11
+ }
12
+ try {
13
+ $ str [0 ]->bar [1 ] = "bang " ;
14
+ } catch (Error $ e ) {
15
+ echo $ e ->getMessage (), "\n" ;
16
+ }
17
+ try {
18
+ $ str [0 ]->bar += 1 ;
19
+ } catch (Error $ e ) {
20
+ echo $ e ->getMessage (), "\n" ;
21
+ }
22
+ try {
23
+ $ str [0 ]->bar = &$ b ;
24
+ } catch (Error $ e ) {
25
+ echo $ e ->getMessage (), "\n" ;
26
+ }
27
+ try {
28
+ ++$ str [0 ]->bar ;
29
+ } catch (Error $ e ) {
30
+ echo $ e ->getMessage (), "\n" ;
31
+ }
32
+ try {
33
+ --$ str [0 ]->bar ;
34
+ } catch (Error $ e ) {
35
+ echo $ e ->getMessage (), "\n" ;
36
+ }
37
+ try {
38
+ $ str [0 ]->bar ++;
39
+ } catch (Error $ e ) {
40
+ echo $ e ->getMessage (), "\n" ;
41
+ }
42
+ try {
43
+ $ str [0 ]->bar --;
44
+ } catch (Error $ e ) {
45
+ echo $ e ->getMessage (), "\n" ;
46
+ }
47
+ try {
48
+ unset($ str [0 ]->bar );
49
+ } catch (Error $ e ) {
50
+ echo $ e ->getMessage (), "\n" ;
51
+ }
52
+
53
+ ?>
54
+ --EXPECT--
55
+ Cannot use string offset as an object
56
+ Cannot use string offset as an object
57
+ Cannot use string offset as an object
58
+ Cannot use string offset as an object
59
+ Cannot use string offset as an object
60
+ Cannot use string offset as an object
61
+ Cannot use string offset as an object
62
+ Cannot use string offset as an object
63
+ Cannot use string offset as an object
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Invalid string offset use where the actual use may be optimized away
3
+ --FILE--
4
+ <?php
5
+ function test () {
6
+ $ a = "" ;
7
+ $ c = array (&$ a [0 ]);
8
+ }
9
+ test ();
10
+ ?>
11
+ --EXPECTF--
12
+ Fatal error: Uncaught Error: Cannot create references to/from string offsets in %s:%d
13
+ Stack trace:
14
+ #0 %s(%d): test()
15
+ #1 {main}
16
+ thrown in %s on line %d
You can’t perform that action at this time.
0 commit comments