xref: /PHP-8.2/ext/opcache/tests/bug73847.phpt (revision e9f783fc)
1--TEST--
2Bug #73847: Recursion when a variable is redefined as array
3--EXTENSIONS--
4opcache
5--FILE--
6<?php
7function test() {
8    $a = 42;
9    $a = array($a);
10    var_dump($a);
11
12    $a = 42;
13    $a = array($a => 24);
14    var_dump($a);
15
16    $a = 42;
17    $a = array($a, 24);
18    var_dump($a);
19
20    $a = 42;
21    $a = array(24, $a);
22    var_dump($a);
23}
24test();
25?>
26--EXPECT--
27array(1) {
28  [0]=>
29  int(42)
30}
31array(1) {
32  [42]=>
33  int(24)
34}
35array(2) {
36  [0]=>
37  int(42)
38  [1]=>
39  int(24)
40}
41array(2) {
42  [0]=>
43  int(24)
44  [1]=>
45  int(42)
46}
47