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/gh18736.phpt
Ilija Tovilo d0fad34230 Fix circumvented type check with return by ref + finally
Fixes GH-18736
Closes GH-19172
2025-08-01 00:35:48 +02:00

25 lines
370 B
PHP

--TEST--
GH-18736: Circumvented type check with return by ref + finally
--FILE--
<?php
function &test(): int {
$x = 0;
try {
return $x;
} finally {
$x = 'test';
}
}
try {
$x = &test();
var_dump($x);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
test(): Return value must be of type int, string returned