Fix for #53727 (is_subclass_of resolution with interfaces)
| From: | Ralph Schindler | Date: | Wed, 29 Jun 2011 19:39:46 +0000 |
| Subject: | Fix for #53727 (is_subclass_of resolution with interfaces) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-53674@lists.php.net to get a copy of this message | ||
Hi all,
Concerning: https://bugs.php.net/bug.php?id=53727
I had put together a quick patch against PHP_5_3 to fix, for what I and others might consider, an issue with is_subclass_of() returning false in this situation:
interface A {}
class B implements A {}
var_dump(is_subclass_of('B', 'A')); // false, should be true
It returns false in situations where a class does not have a parent. If a parent currently exists, the above works fine. For example:
interface A {}
class B implements A {}
class C extends B {}
var_dump(is_subclass_of('B', 'A')); // true
Attached is a patch against PHP_5_3, I can create a patch against PHP_5_4 if need be.
I've added a test file and all the current Zend/tests run as expected.
Thanks,
Ralph
Attachment: [text/x-patch] fix_is_subclass_of.patch
Attachment: [text/x-patch] fix_is_subclass_of.patch