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