xref: /PHP-7.4/Zend/tests/bug72598.phpt (revision 62ab40bc)
1--TEST--
2Bug #72598 (Reference is lost after array_slice())
3--FILE--
4<?php
5function ref(&$ref) {
6	var_dump($ref);
7}
8
9new class {
10        function __construct() {
11                $args = [&$this];
12                for ($i = 0; $i < 2; $i++) {
13                        $a = array_slice($args, 0, 1);
14                        call_user_func_array('ref', $a);
15                }
16        }
17};
18?>
19--EXPECTF--
20Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
21object(class@anonymous)#1 (0) {
22}
23
24Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
25object(class@anonymous)#1 (0) {
26}
27