xref: /PHP-8.0/Zend/tests/bug34064.phpt (revision f8d79582)
1--TEST--
2Bug #34064 (arr[] as param to function in class gives invalid opcode)
3--FILE--
4<?php
5class XmlTest {
6
7    function test_ref(&$test)
8    {
9        $test = "ok";
10    }
11
12    function test($test)
13    {
14    }
15
16    function run()
17    {
18        $ar = array();
19        $this->test_ref($ar[]);
20        var_dump($ar);
21        $this->test($ar[]);
22    }
23}
24
25$o = new XmlTest();
26$o->run();
27?>
28--EXPECTF--
29array(1) {
30  [0]=>
31  string(2) "ok"
32}
33
34Fatal error: Uncaught Error: Cannot use [] for reading in %sbug34064.php:18
35Stack trace:
36#0 %s(%d): XmlTest->run()
37#1 {main}
38  thrown in %sbug34064.php on line 18
39