1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/pipe_operator_reference_context.phpt

27 lines
437 B
PHP

--TEST--
Fix GH-19476: Pipe operator with function returning by reference
--FILE--
<?php
function &get_ref($_): string {
static $a = "original";
$a .= " ".$_;
return $a;
}
function &test_pipe_ref(): string {
return "input" |> get_ref(...);
}
$ref = &test_pipe_ref();
echo "Before: " . $ref . "\n";
$ref = "changed";
echo "After: " . test_pipe_ref() . "\n";
?>
--EXPECT--
Before: original input
After: changed input