is_subclass_of() patch

From: Date: Tue, 29 Jan 2002 21:04:04 +0000
Subject: is_subclass_of() patch
Groups: php.dev 
Request: Send a blank email to php-dev+get-78469@lists.php.net to get a copy of this message
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

« previous php.dev (#78469) next »