Right now is_subclass_of() will return false if the object is exactly of
the class you are trying to test for. I propose the following patch:

--- zend_builtin_functions.c    2002/01/06 15:21:09 1.107
+++ zend_builtin_functions.c    2002/01/29 21:02:05
@@ -553,5 +553,5 @@
    zend_str_tolower(lcname, (*class_name)->value.str.len);
 
-   for (parent_ce = Z_OBJCE_PP(obj)->parent; parent_ce != NULL; parent_ce = 
parent_ce->parent) {
+   for (parent_ce = Z_OBJCE_PP(obj); parent_ce != NULL; parent_ce = 
+parent_ce->parent) {
        if (!strcmp(parent_ce->name, lcname)) {
            efree(lcname);

This should make it easy to use is_subclass_of() as a generic "is-a"
function.

I can go ahead and apply it if there are not objections. Please copy me
on the replies.

-Andrei

"When a man sits with a pretty girl for an hour, it seems like a minute.
But let him sit on a hot stove for a minute, and it's longer than any hour.
That's relativity."
                -- Einstein, on relativity

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to