blob: 4568da19cd486a3bbab069ea80330af4a95df674 (
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
31
32
33
34
35
|
--TEST--
Test nullsafe in function argument
--FILE--
<?php
class Foo {
public $bar;
}
function set(&$ref, $value) {
$ref = $value;
}
function test($foo) {
try {
set($foo?->bar, 'bar');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
(strrev('tes'))($foo?->bar, 'bar2');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
}
test(null);
test(new Foo());
?>
--EXPECT--
set(): Argument #1 ($ref) cannot be passed by reference
set(): Argument #1 ($ref) cannot be passed by reference
set(): Argument #1 ($ref) cannot be passed by reference
set(): Argument #1 ($ref) cannot be passed by reference
|