blob: 2a66b68cc5493f4262c9063fa5bc950db77f7c92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--TEST--
If the LHS of ref-assign ERRORs, that takes precedence over the "only variables" notice
--FILE--
<?php
function val() {
return 42;
}
$var = 24;
$arr = [PHP_INT_MAX => "foo"];
try {
var_dump($arr[] =& $var);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(count($arr));
try {
var_dump($arr[] =& val());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(count($arr));
?>
--EXPECT--
Cannot add element to the array as the next element is already occupied
int(1)
Cannot add element to the array as the next element is already occupied
int(1)
|