mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Partially address bug #78647
Produce a sensible error message for the case where inheritance should fail. There is still a remaining issue that we sometimes fail inheritance while we should not.
This commit is contained in:
parent
c19c380323
commit
a2fe8d48b1
2 changed files with 26 additions and 1 deletions
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
Bug #78647: Outstanding dependency obligation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function ($class) {
|
||||
if ($class == 'A') {
|
||||
class A {
|
||||
function m(): B {}
|
||||
}
|
||||
} elseif ($class == 'B') {
|
||||
class B extends A {
|
||||
function m(): X {}
|
||||
}
|
||||
} else {
|
||||
class C extends B {}
|
||||
}
|
||||
});
|
||||
|
||||
new B;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
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
|
|
@ -2548,7 +2548,8 @@ static void report_variance_errors(zend_class_entry *ce) {
|
|||
} else if (obligation->type == OBLIGATION_PROPERTY_COMPATIBILITY) {
|
||||
emit_incompatible_property_error(obligation->child_prop, obligation->parent_prop);
|
||||
} else {
|
||||
zend_error_noreturn(E_CORE_ERROR, "Bug #78647");
|
||||
/* Report variance errors of the dependency, which prevent it from being linked. */
|
||||
report_variance_errors(obligation->dependency_ce);
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue