From: Andrei Zmievski Date: Sun, 4 Feb 2001 00:06:08 +0000 (+0000) Subject: Allow passing class name as well as an object instance to call methods. X-Git-Tag: php-4.0.5RC1~377 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98d8ba8cc427d4e955951b2165a55995c68ab109;p=php Allow passing class name as well as an object instance to call methods. --- diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 0e3b4eb4c0..61087edf63 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -365,10 +365,18 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun object_pp = NULL; } if (object_pp) { - if (Z_TYPE_PP(object_pp) != IS_OBJECT) { + if (Z_TYPE_PP(object_pp) == IS_OBJECT) { + function_table = &(*object_pp)->value.obj.ce->function_table; + } else if (Z_TYPE_PP(object_pp) == IS_STRING) { + zend_class_entry *ce; + + if (zend_hash_find(EG(class_table), Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp) + 1, (void **) &ce)==FAILURE) + return FAILURE; + + function_table = &ce->function_table; + object_pp = NULL; + } else return FAILURE; - } - function_table = &(*object_pp)->value.obj.ce->function_table; } if (function_name->type!=IS_STRING) {