diff options
author | Joe Watkins <krakjoe@php.net> | 2016-03-29 09:57:51 +0100 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2016-03-29 09:57:51 +0100 |
commit | dd70c39556fe6efe2e1f28cecf8fc73d9588d04a (patch) | |
tree | 5a3902fdcf370421985369a0b081f472b55a20b5 | |
parent | 3f56dfe8660b45c72dee7adcd856dd9a7049cf5b (diff) | |
download | php-git-dd70c39556fe6efe2e1f28cecf8fc73d9588d04a.tar.gz |
fix bug #71428: Validation type inheritance with = NULL
-rw-r--r-- | Zend/tests/bug71428.3.phpt | 11 | ||||
-rw-r--r-- | Zend/zend_inheritance.c | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Zend/tests/bug71428.3.phpt b/Zend/tests/bug71428.3.phpt new file mode 100644 index 0000000000..2f400e5952 --- /dev/null +++ b/Zend/tests/bug71428.3.phpt @@ -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 + diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index b52f45487c..1ea38a16af 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -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) { |