-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix return type verification with undef var
This was loading EG(uninitialized_value) into r0 rather than FCARG1a. However, if we fix this issue an existing test fails because the undef var warning promoted to exception is not caught early enough, so we need to explicitly check for the exception before performing the type check.
- Loading branch information
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
VERIFY_RETURN with undef var | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.file_update_protection=0 | ||
opcache.jit_buffer_size=1M | ||
--FILE-- | ||
<?php | ||
|
||
function test(): int { | ||
return $undef; | ||
} | ||
|
||
try { | ||
test(); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: Undefined variable $undef in %s on line %d | ||
test(): Return value must be of type int, null returned |