Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
zval_ptr_dtor(arg);
ZVAL_LONG(arg, lval);
return 1;
} else if (UNEXPECTED(EG(exception))) {
return 0;
}
}
if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval, 0)) {
Expand Down