1--TEST-- 2Test nullsafe in function argument 3--FILE-- 4<?php 5 6class Foo { 7 public $bar; 8} 9 10function set(&$ref, $value) { 11 $ref = $value; 12} 13 14function test($foo) { 15 try { 16 set($foo?->bar, 'bar'); 17 } catch (Error $e) { 18 echo $e->getMessage() . "\n"; 19 } 20 try { 21 (strrev('tes'))($foo?->bar, 'bar2'); 22 } catch (Error $e) { 23 echo $e->getMessage() . "\n"; 24 } 25} 26 27test(null); 28test(new Foo()); 29 30?> 31--EXPECT-- 32set(): Argument #1 ($ref) cannot be passed by reference 33set(): Argument #1 ($ref) cannot be passed by reference 34set(): Argument #1 ($ref) cannot be passed by reference 35set(): Argument #1 ($ref) cannot be passed by reference 36