]> granicus.if.org Git - php/commitdiff
Bug #71428 work ... hopefully, fix drupal 8
authorJoe Watkins <krakjoe@php.net>
Tue, 29 Mar 2016 08:36:08 +0000 (09:36 +0100)
committerJoe Watkins <krakjoe@php.net>
Tue, 29 Mar 2016 08:36:08 +0000 (09:36 +0100)
Zend/tests/bug71428.2.phpt [new file with mode: 0644]
Zend/zend_inheritance.c

diff --git a/Zend/tests/bug71428.2.phpt b/Zend/tests/bug71428.2.phpt
new file mode 100644 (file)
index 0000000..3d8b257
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+bug #71428.2: inheritance of ye olde dynamic interfaces
+--SKIPIF--
+<?php if (!extension_loaded('pdo')) ?>
+--FILE--
+<?php
+interface StatementInterface {
+       public function fetch($first = null, $second, $third);
+}
+
+class Statement extends PDOStatement implements StatementInterface {}
+
+interface StatementInterface1 {
+       public function fetch($first = null, $second = null, $third = null);
+}
+
+class Statement1 extends PDOStatement implements StatementInterface1 {}
+
+echo "ok";
+?>
+--EXPECT--
+ok
+
index d904a587a160e8ff33d9734f73d4112184df308a..b52f45487cb0e3eefd9a4658b4c78afdc35dd75d 100644 (file)
@@ -167,7 +167,7 @@ char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
 }
 /* }}} */
 
-static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_info *fe_arg_info, const zend_function *proto, zend_arg_info *proto_arg_info) /* {{{ */
+static int zend_do_perform_type_hint_check(const zend_function *fe, uint32_t arg_num, zend_arg_info *fe_arg_info, const zend_function *proto, zend_arg_info *proto_arg_info) /* {{{ */
 {
        if (ZEND_LOG_XOR(fe_arg_info->class_name, proto_arg_info->class_name)) {
                /* Only one has a type declaration and the other one doesn't */
@@ -238,13 +238,13 @@ 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 */
+       if (fe_arg_info->type_hint != proto_arg_info->type_hint) {
+               /* Incompatible type */
                return 0;
        }
 
-       if (fe_arg_info->type_hint != proto_arg_info->type_hint) {
-               /* Incompatible type */
+       if (proto_arg_info->type_hint && proto_arg_info->allow_null && !fe_arg_info->allow_null) {
+               /* incompatible nullability */
                return 0;
        }
 
@@ -320,7 +320,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
                        proto_arg_info = &proto->common.arg_info[proto->common.num_args];
                }
 
-               if (!zend_do_perform_type_hint_check(fe, fe_arg_info, proto, proto_arg_info)) {
+               if (!zend_do_perform_type_hint_check(fe, i, fe_arg_info, proto, proto_arg_info)) {
                        return 0;
                }
 
@@ -338,7 +338,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
                        return 0;
                }
 
-               if (!zend_do_perform_type_hint_check(fe, fe->common.arg_info - 1, proto, proto->common.arg_info - 1)) {
+               if (!zend_do_perform_type_hint_check(fe, i, fe->common.arg_info - 1, proto, proto->common.arg_info - 1)) {
                        return 0;
                }
        }