php-src/Zend/tests/gh12102_1.phpt
Ilija Tovilo 748adf18fc
Fix zend_separate_if_call_and_write for FUNC_ARGs
Fixes GH-12102
Closees GH-12140
2023-09-07 14:25:11 +02:00

31 lines
556 B
PHP

--TEST--
GH-12102: Incorrect "Cannot use temporary expression in write context" error for BP_VAR_FUNC_ARG
--FILE--
<?php
function test() {
byVal(func_get_args()[0]);
try {
byRef(func_get_args()[0]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
}
/* Intentionally declared after test() to avoid compile-time checking of ref args. */
function byVal($arg) {
var_dump($arg);
}
function byRef(&$arg) {
var_dump($arg);
}
test('y');
?>
--EXPECT--
string(1) "y"
Cannot use temporary expression in write context