xref: /PHP-8.1/Zend/tests/gh12102_1.phpt (revision 748adf18)
1--TEST--
2GH-12102: Incorrect "Cannot use temporary expression in write context" error for BP_VAR_FUNC_ARG
3--FILE--
4<?php
5
6function test() {
7    byVal(func_get_args()[0]);
8    try {
9        byRef(func_get_args()[0]);
10    } catch (Error $e) {
11        echo $e->getMessage(), "\n";
12    }
13}
14
15/* Intentionally declared after test() to avoid compile-time checking of ref args. */
16
17function byVal($arg) {
18    var_dump($arg);
19}
20
21function byRef(&$arg) {
22    var_dump($arg);
23}
24
25test('y');
26
27?>
28--EXPECT--
29string(1) "y"
30Cannot use temporary expression in write context
31