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
interface A {}
class B implements A {}
class C extends B {}
var_dump(is_subclass_of('B', 'A')); // true
Typo there; that should be 'C', not 'B'.
David
Hi Ralph,
I agree with expected behavior, but didn't understand the patch and
which side effects it may have as well as the original implementation of
is_a_impl(). It looks for me like one huge bug :)
Please reassign the bug to me, if you like me to take a deeper look.
I can do it only on next week.
Thanks. Dmitry.
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 withis_subclass_of()
returning false in
this situation:interface A {}
class B implements A {}
var_dump(is_subclass_of('B', 'A')); // false, should be trueIt 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')); // trueAttached 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
Hey Dmitry,
is_a_impl() is an implementation that is shared by is_a()
and
is_subclass_of()
calls. There is a flag called only_subclass that
allows there to be switching behavior in is_a_impl().
The issue has been updated with a new patch that now takes objects into
account. It also has a comment in there that better explains what the
patch is doing.
I cannot assign it to you as I am not the original reporter, nor have
access, can you assign it to yourself?
Thanks,
Ralph
Hi Ralph,
I agree with expected behavior, but didn't understand the patch and
which side effects it may have as well as the original implementation of
is_a_impl(). It looks for me like one huge bug :)Please reassign the bug to me, if you like me to take a deeper look.
I can do it only on next week.Thanks. Dmitry.
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 withis_subclass_of()
returning false in
this situation:interface A {}
class B implements A {}
var_dump(is_subclass_of('B', 'A')); // false, should be trueIt 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')); // trueAttached 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
Hi Ralph,
I reassigned it myself, and will take a look on Monday or Tuesday.
Thanks. Dmitry.
Hey Dmitry,
is_a_impl() is an implementation that is shared by
is_a()
and
is_subclass_of()
calls. There is a flag called only_subclass that allows
there to be switching behavior in is_a_impl().The issue has been updated with a new patch that now takes objects into
account. It also has a comment in there that better explains what the
patch is doing.I cannot assign it to you as I am not the original reporter, nor have
access, can you assign it to yourself?Thanks,
RalphHi Ralph,
I agree with expected behavior, but didn't understand the patch and
which side effects it may have as well as the original implementation of
is_a_impl(). It looks for me like one huge bug :)Please reassign the bug to me, if you like me to take a deeper look.
I can do it only on next week.Thanks. Dmitry.
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 withis_subclass_of()
returning false in
this situation:interface A {}
class B implements A {}
var_dump(is_subclass_of('B', 'A')); // false, should be trueIt 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')); // trueAttached 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
Hi Ralph,
Your patch was absolutely correct.
I've committed it with small improvements.
Thanks. Dmitry.
Hey Dmitry,
is_a_impl() is an implementation that is shared by
is_a()
and
is_subclass_of()
calls. There is a flag called only_subclass that allows
there to be switching behavior in is_a_impl().The issue has been updated with a new patch that now takes objects into
account. It also has a comment in there that better explains what the
patch is doing.I cannot assign it to you as I am not the original reporter, nor have
access, can you assign it to yourself?Thanks,
RalphHi Ralph,
I agree with expected behavior, but didn't understand the patch and
which side effects it may have as well as the original implementation of
is_a_impl(). It looks for me like one huge bug :)Please reassign the bug to me, if you like me to take a deeper look.
I can do it only on next week.Thanks. Dmitry.
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 withis_subclass_of()
returning false in
this situation:interface A {}
class B implements A {}
var_dump(is_subclass_of('B', 'A')); // false, should be trueIt 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')); // trueAttached 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