From: Andi Gutmans Date: Tue, 26 Oct 2004 23:25:34 +0000 (+0000) Subject: - MFH X-Git-Tag: php-5.0.3RC1~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5f62e61e679243aa5b654cc91955f6fe00c7519;p=php - MFH --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a4947d20a0..db7921b452 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -603,12 +603,21 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) ZEND_WRONG_PARAM_COUNT(); } - if (Z_TYPE_PP(obj) != IS_OBJECT) { + if (only_subclass && Z_TYPE_PP(obj) == IS_STRING) { + zend_class_entry **the_ce; + if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &the_ce TSRMLS_CC) == FAILURE) { + zend_error(E_WARNING, "Unknown class passed as parameter"); + RETURN_FALSE; + } + instance_ce = *the_ce; + } else if (Z_TYPE_PP(obj) != IS_OBJECT) { RETURN_FALSE; + } else { + instance_ce = NULL; } /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(**obj)) { + if (Z_TYPE_PP(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(**obj)) { RETURN_FALSE; } @@ -618,7 +627,11 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) retval = 0; } else { if (only_subclass) { - instance_ce = Z_OBJCE_PP(obj)->parent; + if (!instance_ce) { + instance_ce = Z_OBJCE_PP(obj)->parent; + } else { + instance_ce = instance_ce->parent; + } } else { instance_ce = Z_OBJCE_PP(obj); }