diff options
| author | Dmitry Stogov <dmitry@php.net> | 2011-07-04 14:55:39 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2011-07-04 14:55:39 +0000 |
| commit | 293f7108271425b236344cb2ee06d2a5640cbee2 (patch) | |
| tree | d8a0d90fc659c2e1b1e369c3683d10996b10ca35 /Zend/zend_builtin_functions.c | |
| parent | 7fb6b5ca9893639e553f64eb52f350a39fc26ddd (diff) | |
| download | php-git-293f7108271425b236344cb2ee06d2a5640cbee2.tar.gz | |
Fixed bug #53727 (Inconsistent behavior of is_subclass_of with interfaces)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
| -rw-r--r-- | Zend/zend_builtin_functions.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 6888b7f662..d0276091b6 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -822,45 +822,26 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) return; } - if (only_subclass && Z_TYPE_P(obj) == IS_STRING) { + if (Z_TYPE_P(obj) == IS_STRING) { zend_class_entry **the_ce; if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(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_P(obj) != IS_OBJECT) { - RETURN_FALSE; + } else if (Z_TYPE_P(obj) == IS_OBJECT && HAS_CLASS_ENTRY(*obj)) { + instance_ce = Z_OBJCE_P(obj); } else { - instance_ce = NULL; - } - - /* TBI!! new object handlers */ - if (Z_TYPE_P(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(*obj)) { RETURN_FALSE; } if (zend_lookup_class_ex(class_name, class_name_len, 0, &ce TSRMLS_CC) == FAILURE) { retval = 0; } else { - if (only_subclass) { - if (!instance_ce) { - instance_ce = Z_OBJCE_P(obj)->parent; - } else { - instance_ce = instance_ce->parent; - } - } else { - instance_ce = Z_OBJCE_P(obj); - } - - if (!instance_ce) { - RETURN_FALSE; - } - - if (instanceof_function(instance_ce, *ce TSRMLS_CC)) { - retval = 1; - } else { + if (only_subclass && instance_ce == *ce) { retval = 0; + } else { + retval = instanceof_function(instance_ce, *ce TSRMLS_CC); } } |
