com php-src: work on #71428: Zend/tests/bug71428.1.phpt Zend/zend_inheritance.c

From: Date: Mon, 28 Mar 2016 10:54:25 +0000
Subject: com php-src: work on #71428: Zend/tests/bug71428.1.phpt Zend/zend_inheritance.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91497@lists.php.net to get a copy of this message
Commit: ee9a78a033696ff9546fb1dbfecd28f20477b511 Author: Joe Watkins <krakjoe@php.net> Mon, 28 Mar 2016 11:54:25 +0100 Parents: 28f66763a436066d51b21dcf9d6ac3f5a0b33df7 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ee9a78a033696ff9546fb1dbfecd28f20477b511 Log: work on #71428 Bugs: https://bugs.php.net/71428 Changed paths: A Zend/tests/bug71428.1.phpt M Zend/zend_inheritance.c Diff: diff --git a/Zend/tests/bug71428.1.phpt b/Zend/tests/bug71428.1.phpt new file mode 100644 index 0000000..b754687 --- /dev/null +++ b/Zend/tests/bug71428.1.phpt @@ -0,0 +1,13 @@ +--TEST-- +bug #71428.1: inheritance with null default values +--FILE-- +<?php +class A { + public function m(array $a = null) {} +} +class B extends A { + public function m(array $a = []) {} +} +--EXPECTF-- +Warning: Declaration of B::m(array $a = Array) should be compatible with A::m(array $a = NULL) in %sbug71428.1.php on line 7 + diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 9eb7a0b..d904a58 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -238,6 +238,11 @@ static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_inf zend_string_release(fe_class_name); } + if (proto_arg_info->allow_null && !fe_arg_info->allow_null) { + /* incompatible nullability */ + return 0; + } + if (fe_arg_info->type_hint != proto_arg_info->type_hint) { /* Incompatible type */ return 0;

« previous php.cvs (#91497) next »