summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2017-02-01 18:35:19 +0000
committerJoe Watkins <krakjoe@php.net>2017-02-01 18:35:33 +0000
commit49e9ae1fc1b5a4b0404135d1827ed64a1481d623 (patch)
treebaf3df043040ce4ced8ef5e4256931883045cd2b
parent76b2f2ff5d75a46cc07fbc852aad9e5946aabe32 (diff)
downloadphp-git-49e9ae1fc1b5a4b0404135d1827ed64a1481d623.tar.gz
Revert "Inheritance checks should not ignore parents if these implement an interface"
This reverts commit b67eb3440bb244adf6957bf2c68aeeaa6efc8c8d.
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug62358.phpt2
-rw-r--r--Zend/tests/bug73987.phpt18
-rw-r--r--Zend/tests/bug73987_1.phpt18
-rw-r--r--Zend/zend_inheritance.c9
5 files changed, 6 insertions, 43 deletions
diff --git a/NEWS b/NEWS
index 36fcffc381..5a11736deb 100644
--- a/NEWS
+++ b/NEWS
@@ -11,8 +11,6 @@ PHP NEWS
. Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester)
. Fixed bug #73994 (arginfo incorrect for unpack). (krakjoe)
. Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester)
- . Fixed bug #73987 (Method compatibility check looks to original
- definition and not parent). (pmmaga)
- DOM:
. Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes).
diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt
index 8509383d46..35bbc33835 100644
--- a/Zend/tests/bug62358.phpt
+++ b/Zend/tests/bug62358.phpt
@@ -23,4 +23,4 @@ class B extends A {
}
?>
--EXPECTF--
-Fatal error: Declaration of B::foo($var) must be compatible with A::foo() in %sbug62358.php on line 17
+Fatal error: Declaration of B::foo($var) must be compatible with I::foo() in %sbug62358.php on line 17
diff --git a/Zend/tests/bug73987.phpt b/Zend/tests/bug73987.phpt
deleted file mode 100644
index 551565650c..0000000000
--- a/Zend/tests/bug73987.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
---FILE--
-<?php
-
-interface I {
- public function example($a, $b, $c);
-}
-class A implements I {
- public function example($a, $b = null, $c = null) { } // compatible with I::example
-}
-class B extends A {
- public function example($a, $b, $c = null) { } // compatible with I::example
-}
-
-?>
---EXPECTF--
-Fatal error: Declaration of B::example($a, $b, $c = NULL) must be compatible with A::example($a, $b = NULL, $c = NULL) in %s
diff --git a/Zend/tests/bug73987_1.phpt b/Zend/tests/bug73987_1.phpt
deleted file mode 100644
index 6a0a157f29..0000000000
--- a/Zend/tests/bug73987_1.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #73987 (Method compatibility check looks to original definition and not parent)
---FILE--
-<?php
-
-interface I {
- public function example();
-}
-class A implements I {
- public function example(): int { } // compatible with I::example
-}
-class B extends A {
- public function example(): string { } // compatible with I::example
-}
-
-?>
---EXPECTF--
-Fatal error: Declaration of B::example(): string must be compatible with A::example(): int in %s
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 8ad5cc2e01..fd1345f844 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -607,12 +607,13 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
} else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
/* ctors only have a prototype if it comes from an interface */
child->common.prototype = parent->common.prototype ? parent->common.prototype : parent;
- /* and if that is the case, we want to check inheritance against it */
- if (parent->common.fn_flags & ZEND_ACC_CTOR) {
- parent = child->common.prototype;
- }
}
+ if (child->common.prototype && (
+ child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT
+ )) {
+ parent = child->common.prototype;
+ }
if (UNEXPECTED(!zend_do_perform_implementation_check(child, parent))) {
int error_level;
const char *error_verb;