diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-07-25 12:36:29 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-07-25 12:36:29 +0000 |
commit | abd9dc0bf28db4741c160c9df2a1ded34f2cf525 (patch) | |
tree | 55c5e319a8edd06b90ae8a4de8056fcbb6601ac0 | |
parent | 21f635223cf1800655955f4726a45352f49c698c (diff) | |
download | php-git-abd9dc0bf28db4741c160c9df2a1ded34f2cf525.tar.gz |
MFB: Fixed bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the
class itself).
-rw-r--r-- | ext/reflection/php_reflection.c | 3 | ||||
-rwxr-xr-x | ext/reflection/tests/bug38194.phpt | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7118bfbec8..3afd5275e6 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3574,8 +3574,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) return; } - - RETURN_BOOL(instanceof_function(ce, class_ce TSRMLS_CC)); + RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce TSRMLS_CC))); } /* }}} */ diff --git a/ext/reflection/tests/bug38194.phpt b/ext/reflection/tests/bug38194.phpt new file mode 100755 index 0000000000..5c888af59d --- /dev/null +++ b/ext/reflection/tests/bug38194.phpt @@ -0,0 +1,13 @@ +--TEST-- +Reflection Bug #38194 (ReflectionClass::isSubclassOf() returns TRUE for the class itself) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class Object { } + +$objectClass= new ReflectionClass('Object'); +var_dump($objectClass->isSubclassOf($objectClass)); +?> +--EXPECT-- +bool(false) |