well... i hacked up a function to handle this...
does anyone wanna look at my code and maybe possible include it with
call_user_function

int my_call_user_function(HashTable *function_table, zval **object_pp, zval
*function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
{
        if(call_user_function(function_table, object_pp, function_name, retval_ptr,
param_count, params TSRMLS_CC) == FAILURE)
        {
                if(Z_OBJCE_PP(object_pp)->handle_function_call != NULL)
                {
                        zend_overloaded_element overloaded_element;
                        zend_property_reference property_reference;
                        zend_function_state function_state;
                        zend_function_state *original_function_state_ptr;
                        int i;

                        overloaded_element.element = *function_name;
                        overloaded_element.type = OE_IS_METHOD;

                        property_reference.object = *object_pp;
                        property_reference.type = BP_VAR_NA;
                        property_reference.elements_list = (zend_llist *)
emalloc(sizeof(zend_llist));
                        zend_llist_init(property_reference.elements_list,
sizeof(zend_overloaded_element), NULL, 0);
                        zend_llist_add_element(property_reference.elements_list,
&overloaded_element);
                        
                        //Build argument stack
                        for(i = 0;i < param_count;i++)
                                zend_ptr_stack_push(&EG(argument_stack), params[i]);
                        zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) 
param_count, NULL);

                        EG(function_state_ptr) = &function_state;
                        Z_OBJCE_PP(object_pp)->handle_function_call(param_count, 
retval_ptr,
*object_pp, 1 TSRMLS_CC, &property_reference);
                        EG(function_state_ptr) = original_function_state_ptr;

                        zend_llist_destroy(property_reference.elements_list);
                        efree(property_reference.elements_list);

                        zend_ptr_stack_clear_multiple(TSRMLS_C);
                        return SUCCESS;
                }
        }
}

i know there's some things wrong with it but... it does work...
like function_state will be garbage.. i didn't know what/how to fill that
structure with. 

- Brad
--- brad lafountain <[EMAIL PROTECTED]> wrote:
> I was wondering why call_user_function doens't handle calling methods of
> objects for an incomplete_class_entry.
> 
> call_user_function(NULL, &incomplete_class, function_name, return, 0, NULL);
> 
> i took a look at the code and it assumes that the function that you want to
> call is in the class_entry.function_table... is this by design or did someone
> just not want to implement call_user_function and call the callback handler
> if
> there were no builtin functions...
> 
> - Brad
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to