mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
fix bug #71428: Validation type inheritance with = NULL
This commit is contained in:
parent
3f56dfe866
commit
dd70c39556
2 changed files with 13 additions and 0 deletions
11
Zend/tests/bug71428.3.phpt
Normal file
11
Zend/tests/bug71428.3.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
bug #71428: Validation type inheritance with = NULL
|
||||
--FILE--
|
||||
<?php
|
||||
class A { }
|
||||
class B { public function m(A $a = NULL, $n) { echo "B.m";} };
|
||||
class C extends B { public function m(A $a , $n) { echo "C.m";} };
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Declaration of C::m(A $a, $n) should be compatible with B::m(A $a = NULL, $n) in %sbug71428.3.php on line 4
|
||||
|
|
@ -488,6 +488,8 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
|
|||
} else {
|
||||
smart_str_appends(&str, "NULL");
|
||||
}
|
||||
} else if (arg_info->type_hint && arg_info->allow_null) {
|
||||
smart_str_appends(&str, " = NULL");
|
||||
}
|
||||
|
||||
if (++i < num_args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue