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