Skip to content

Commit

Permalink
work on #71428
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe committed Mar 28, 2016
1 parent 28f6676 commit ee9a78a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Zend/tests/bug71428.1.phpt
Original file line number Diff line number Diff line change
@@ -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

5 changes: 5 additions & 0 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee9a78a

Please sign in to comment.