From e7817ec3b2bba91db52aeb44eb8a5db70ab2a4d2 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Wed, 1 Jun 2022 16:27:47 +0000 Subject: [PATCH] Do manual type checks because the engine doesn't --- ext/zend_test/test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 1d9071f0da0..37bbc4547f8 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -334,13 +334,15 @@ static ZEND_FUNCTION(zend_call_method) if (Z_TYPE_P(class_or_object) == IS_OBJECT) { obj = Z_OBJ_P(class_or_object); ce = obj->ce; - } else { - ZEND_ASSERT(Z_TYPE_P(class_or_object) == IS_STRING); + } else if (Z_TYPE_P(class_or_object) == IS_STRING) { ce = zend_lookup_class(Z_STR_P(class_or_object)); if (!ce) { zend_error(E_ERROR, "Unknown class '%s'", Z_STRVAL_P(class_or_object)); return; } + } else { + zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_type_name(class_or_object)); + return; } ZEND_ASSERT((argc >= 2) && (argc <= 4));