mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed bug #69767 (Default parameter value with wrong type segfaults)
This commit is contained in:
parent
61de771afa
commit
cea801cce2
2
NEWS
2
NEWS
@ -9,6 +9,8 @@
|
||||
. Added support for SEARCH WebDav method. (Mats Lindh)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69767 (Default parameter value with wrong type segfaults).
|
||||
(cmb, Laruence)
|
||||
. Fixed bug #69756 (Fatal error: Nesting level too deep - recursive dependency
|
||||
? with ===). (Dmitry, Laruence)
|
||||
. Fixed bug #69758 (Item added to array not being removed by array_pop/shift
|
||||
|
8
Zend/tests/bug69767.phpt
Normal file
8
Zend/tests/bug69767.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #69767 (Default parameter value with wrong type segfaults)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo(string $bar = 0) {}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Default value for parameters with a string type hint can only be string or NULL in %sbug69767.php on line %d
|
@ -4374,7 +4374,8 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
|
||||
"with a class type hint can only be NULL");
|
||||
} else if (!ZEND_SAME_FAKE_TYPE(arg_info->type_hint, Z_TYPE(default_node.u.constant))) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
|
||||
"with a %s type hint can only be %s or NULL", arg_info->class_name->val, arg_info->class_name->val);
|
||||
"with a %s type hint can only be %s or NULL",
|
||||
zend_get_type_by_const(arg_info->type_hint), zend_get_type_by_const(arg_info->type_hint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user