Skip to content

Commit ee2cec1

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Partially address bug #78647
2 parents fdf0455 + a2fe8d4 commit ee2cec1

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #78647: Outstanding dependency obligation
3+
--FILE--
4+
<?php
5+
6+
spl_autoload_register(function ($class) {
7+
if ($class == 'A') {
8+
class A {
9+
function m(): B {}
10+
}
11+
} elseif ($class == 'B') {
12+
class B extends A {
13+
function m(): X {}
14+
}
15+
} else {
16+
class C extends B {}
17+
}
18+
});
19+
20+
new B;
21+
22+
?>
23+
--EXPECTF--
24+
Fatal error: Could not check compatibility between B::m(): X and A::m(): B, because class X is not available in %s on line %d

Zend/zend_inheritance.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2544,7 +2544,8 @@ static void report_variance_errors(zend_class_entry *ce) {
25442544
} else if (obligation->type == OBLIGATION_PROPERTY_COMPATIBILITY) {
25452545
emit_incompatible_property_error(obligation->child_prop, obligation->parent_prop);
25462546
} else {
2547-
zend_error_noreturn(E_CORE_ERROR, "Bug #78647");
2547+
/* Report variance errors of the dependency, which prevent it from being linked. */
2548+
report_variance_errors(obligation->dependency_ce);
25482549
}
25492550
} ZEND_HASH_FOREACH_END();
25502551

0 commit comments

Comments
 (0)