Skip to content

Commit 46de334

Browse files
committed
Revert "Inheritance checks should not ignore parents if these implement an interface"
This reverts commit b67eb34.
1 parent 648238d commit 46de334

File tree

5 files changed

+6
-43
lines changed

5 files changed

+6
-43
lines changed

NEWS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ PHP NEWS
1515
. Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester)
1616
. Fixed bug #73994 (arginfo incorrect for unpack). (krakjoe)
1717
. Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester)
18-
. Fixed bug #73987 (Method compatibility check looks to original
19-
definition and not parent). (pmmaga)
2018

2119
- DOM:
2220
. Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes).

Zend/tests/bug62358.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ class B extends A {
2323
}
2424
?>
2525
--EXPECTF--
26-
Fatal error: Declaration of B::foo($var) must be compatible with A::foo() in %sbug62358.php on line 17
26+
Fatal error: Declaration of B::foo($var) must be compatible with I::foo() in %sbug62358.php on line 17

Zend/tests/bug73987.phpt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Zend/tests/bug73987_1.phpt

Lines changed: 0 additions & 18 deletions
This file was deleted.

Zend/zend_inheritance.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,13 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
607607
} else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) {
608608
/* ctors only have a prototype if it comes from an interface */
609609
child->common.prototype = parent->common.prototype ? parent->common.prototype : parent;
610-
/* and if that is the case, we want to check inheritance against it */
611-
if (parent->common.fn_flags & ZEND_ACC_CTOR) {
612-
parent = child->common.prototype;
613-
}
614610
}
615611

612+
if (child->common.prototype && (
613+
child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT
614+
)) {
615+
parent = child->common.prototype;
616+
}
616617
if (UNEXPECTED(!zend_do_perform_implementation_check(child, parent))) {
617618
int error_level;
618619
const char *error_verb;

0 commit comments

Comments
 (0)