-
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.
Handle promoted exception in int|string type
Fixes oss-fuzz #35790.
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Zend/tests/float_to_int/union_int_string_type_arg_promote_exception.phpt
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,20 @@ | ||
--TEST-- | ||
Promote deprecation warning for int|string type into exception | ||
--FILE-- | ||
<?php | ||
|
||
function test(int|string $arg) {} | ||
|
||
set_error_handler(function($_, $msg) { | ||
throw new Exception($msg); | ||
}); | ||
|
||
try { | ||
test(0.5); | ||
} catch (Exception $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
Implicit conversion from float 0.5 to int loses precision |
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