com php-src: fix bug #71428: Validation type inheritance with = NULL: Zend/tests/bug71428.3.phpt Ze nd/zend_inheritance.c

From: Date: Tue, 29 Mar 2016 08:57:51 +0000
Subject: com php-src: fix bug #71428: Validation type inheritance with = NULL: Zend/tests/bug71428.3.phpt Ze nd/zend_inheritance.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91521@lists.php.net to get a copy of this message
Commit: dd70c39556fe6efe2e1f28cecf8fc73d9588d04a Author: Joe Watkins <krakjoe@php.net> Tue, 29 Mar 2016 09:57:51 +0100 Parents: 3f56dfe8660b45c72dee7adcd856dd9a7049cf5b Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd70c39556fe6efe2e1f28cecf8fc73d9588d04a Log: fix bug #71428: Validation type inheritance with = NULL Bugs: https://bugs.php.net/71428 Changed paths: A Zend/tests/bug71428.3.phpt M Zend/zend_inheritance.c Diff: diff --git a/Zend/tests/bug71428.3.phpt b/Zend/tests/bug71428.3.phpt new file mode 100644 index 0000000..2f400e5 --- /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 b52f454..1ea38a1 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) {

« previous php.cvs (#91521) next »