Permalink
Browse files

- Support statuc methods/functions

  • Loading branch information...
1 parent 71b9b51 commit 0b3ed59fb6f231d4d6f4ea947450659c93350afe Marcus Boerger committed Mar 1, 2005
Showing with 11 additions and 5 deletions.
  1. +11 −5 Zend/zend_interfaces.c
View
@@ -36,6 +36,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
zend_fcall_info fci;
zval z_fname;
zval *retval;
+ HashTable *function_table;
zval **params[2];
@@ -62,12 +63,17 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
fcic.initialized = 1;
if (!obj_ce) {
- obj_ce = Z_OBJCE_PP(object_pp);
+ obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
+ }
+ if (obj_ce) {
+ function_table = &obj_ce->function_table;
+ } else {
+ function_table = EG(function_table);
}
if (!fn_proxy || !*fn_proxy) {
- if (zend_hash_find(&obj_ce->function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
+ if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
/* error at c-level */
- zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", obj_ce->name, function_name);
+ zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
}
if (fn_proxy) {
*fn_proxy = fcic.function_handler;
@@ -82,9 +88,9 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
if (result == FAILURE) {
/* error at c-level */
if (!obj_ce) {
- obj_ce = Z_OBJCE_PP(object_pp);
+ obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
}
- zend_error(E_CORE_ERROR, "Couldn't execute method %s::%s", obj_ce->name, function_name);
+ zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
}
if (!retval_ptr_ptr) {
if (retval) {

0 comments on commit 0b3ed59

Please sign in to comment.