xref: /PHP-8.0/Zend/tests/bug72038.phpt (revision 9975986b)
1--TEST--
2Bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
3--FILE--
4<?php
5
6try {
7    test($foo = new stdClass);
8    var_dump($foo);
9} catch (Error $e) {
10    echo $e->getMessage() . "\n";
11}
12try {
13    test($bar = 2);
14    var_dump($bar);
15} catch (Error $e) {
16    echo $e->getMessage() . "\n";
17}
18
19test($baz = &$bar);
20var_dump($baz);
21
22function test(&$param) {
23        $param = 1;
24}
25
26?>
27--EXPECT--
28test(): Argument #1 ($param) cannot be passed by reference
29test(): Argument #1 ($param) cannot be passed by reference
30int(1)
31