mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix callable variance check (GH-17613)
Caused by GH-15492. While the parent might contain callable, it may also contain other types. zend_is_class_subtype_of_type() may be checking a member that is not callable itself. Fall back to the normal class subtype check. Discovered by a failing Laravel test in nightly.
This commit is contained in:
parent
98da67aa9a
commit
ed1e47e325
2 changed files with 19 additions and 2 deletions
19
Zend/tests/type_declarations/callable/callable_004.phpt
Normal file
19
Zend/tests/type_declarations/callable/callable_004.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
callable type#004
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface Foo {}
|
||||
|
||||
class P {
|
||||
public function test(Foo|callable $foo) {}
|
||||
}
|
||||
|
||||
class C extends P {
|
||||
public function test(Foo|callable $foo) {}
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
|
@ -499,8 +499,6 @@ static inheritance_status zend_is_class_subtype_of_type(
|
|||
} else if (fe_ce == zend_ce_closure) {
|
||||
track_class_dependency(fe_ce, fe_class_name);
|
||||
return INHERITANCE_SUCCESS;
|
||||
} else {
|
||||
return INHERITANCE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue