mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
748adf18fc
Fixes GH-12102 Closees GH-12140
33 lines
550 B
PHP
33 lines
550 B
PHP
--TEST--
|
|
GH-12102: Incorrect "Cannot use temporary expression in write context" error for BP_VAR_FUNC_ARG
|
|
--FILE--
|
|
<?php
|
|
|
|
function test() {
|
|
byVal(C[0]);
|
|
try {
|
|
byRef(C[0]);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
}
|
|
|
|
/* Intentionally declared after test() to avoid compile-time checking of ref args. */
|
|
|
|
const C = ['foo'];
|
|
|
|
function byVal($arg) {
|
|
var_dump($arg);
|
|
}
|
|
|
|
function byRef(&$arg) {
|
|
var_dump($arg);
|
|
}
|
|
|
|
test('y');
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(3) "foo"
|
|
Cannot use temporary expression in write context
|