mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
25 lines
370 B
PHP
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
|