diff options
author | Andrei Zmievski <andrei@php.net> | 2001-02-04 00:06:08 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2001-02-04 00:06:08 +0000 |
commit | 98d8ba8cc427d4e955951b2165a55995c68ab109 (patch) | |
tree | 45b1b1d68335bbef721ec3f104fac665cb8e0a80 /Zend/zend_execute_API.c | |
parent | 088a4b7151928d49430544279dff76c5a6a59244 (diff) | |
download | php-git-98d8ba8cc427d4e955951b2165a55995c68ab109.tar.gz |
Allow passing class name as well as an object instance to call methods.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 14 |
1 files changed, 11 insertions, 3 deletions
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) { |