# [PATCH] Bug #53727 Inconsistent behavior of is_subclass_of with interfaces

- Thread: https://externals.io/message/51262
- Original archive: https://news-web.php.net/php.internals/51262
- Started by Marc Easen on 2011-01-13T00:15:59+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #51262 — Marc Easen — 2011-01-13T00:15:59+00:00

URL: https://externals.io/message/51262#51262

Hello,

I have attached a patch to the following bug, but I believe the bug is incorrect...

If `is_subclass_of()` is used in conjunction with a interface it should always return false because it's not a class, it's an interface.

Test:
------
interface MyInterface {
    const TEST_CONSTANT = true;
}

class ParentClass implements MyInterface { }

class ChildClass extends ParentClass { }

echo (is_subclass_of('ChildClass', 'MyInterface') ? 'true' : 'false') . "\n";
echo (defined('ChildClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";

echo (is_subclass_of('ParentClass', 'MyInterface') ? 'true' : 'false') . "\n";
echo (defined('ParentClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";

Expected result:
----------------
false
true
false
true

Actual result:
--------------
true
true
false
true
