diff --git a/Zend/tests/is_subclass_of.phpt b/Zend/tests/is_subclass_of.phpt new file mode 100755 index 0000000..325e5e0 --- /dev/null +++ b/Zend/tests/is_subclass_of.phpt @@ -0,0 +1,20 @@ +--TEST-- +is_subclass_of() with class names for target and test should work with interfaces +--INI-- +error_reporting=14335 +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +bool(true) +bool(true) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 6888b7f..c4031f2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -844,10 +844,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) retval = 0; } else { if (only_subclass) { + if (instance_ce && instance_ce->name == (*ce)->name) { + // return here if the class entry names are the same + RETURN_FALSE; + } + if (!instance_ce) { instance_ce = Z_OBJCE_P(obj)->parent; - } else { - instance_ce = instance_ce->parent; } } else { instance_ce = Z_OBJCE_P(obj);