File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ PHP NEWS
37
37
. Fixed bug #73654 (Segmentation fault in zend_call_function). (Nikita)
38
38
. Fixed bug #73668 ("SIGFPE Arithmetic exception" in opcache when divide by
39
39
minus 1). (Nikita)
40
+ . Fixed bug #73847 (Recursion when a variable is redefined as array). (Nikita)
40
41
41
42
- PDO_Firebird:
42
43
. Fixed bug #72931 (PDO_FIREBIRD with Firebird 3.0 not work on returning
Original file line number Diff line number Diff line change @@ -356,6 +356,12 @@ static zend_bool opline_supports_assign_contraction(
356
356
return opline -> op1_type != IS_CV || opline -> op1 .var != cv_var ;
357
357
}
358
358
359
+ if (opline -> opcode == ZEND_INIT_ARRAY ) {
360
+ /* INIT_ARRAY initializes the result array before reading key/value. */
361
+ return (opline -> op1_type != IS_CV || opline -> op1 .var != cv_var )
362
+ && (opline -> op2_type != IS_CV || opline -> op2 .var != cv_var );
363
+ }
364
+
359
365
return 1 ;
360
366
}
361
367
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #73847: Recursion when a variable is redefined as array
3
+ --FILE--
4
+ <?php
5
+ function test () {
6
+ $ a = 42 ;
7
+ $ a = array ($ a );
8
+ var_dump ($ a );
9
+
10
+ $ a = 42 ;
11
+ $ a = array ($ a => 24 );
12
+ var_dump ($ a );
13
+
14
+ $ a = 42 ;
15
+ $ a = array ($ a , 24 );
16
+ var_dump ($ a );
17
+
18
+ $ a = 42 ;
19
+ $ a = array (24 , $ a );
20
+ var_dump ($ a );
21
+ }
22
+ test ();
23
+ ?>
24
+ --EXPECT--
25
+ array(1) {
26
+ [0]=>
27
+ int(42)
28
+ }
29
+ array(1) {
30
+ [42]=>
31
+ int(24)
32
+ }
33
+ array(2) {
34
+ [0]=>
35
+ int(42)
36
+ [1]=>
37
+ int(24)
38
+ }
39
+ array(2) {
40
+ [0]=>
41
+ int(24)
42
+ [1]=>
43
+ int(42)
44
+ }
You can’t perform that action at this time.
0 commit comments