From ed1e47e32528f550d01e2f29dba868735f2dd888 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Tue, 28 Jan 2025 16:45:36 +0100 Subject: [PATCH] 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. --- .../callable/callable_004.phpt | 19 +++++++++++++++++++ Zend/zend_inheritance.c | 2 -- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/type_declarations/callable/callable_004.phpt diff --git a/Zend/tests/type_declarations/callable/callable_004.phpt b/Zend/tests/type_declarations/callable/callable_004.phpt new file mode 100644 index 00000000000..5b05fea179a --- /dev/null +++ b/Zend/tests/type_declarations/callable/callable_004.phpt @@ -0,0 +1,19 @@ +--TEST-- +callable type#004 +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index d06d8e96195..7cde9193c7b 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -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; } }