Re: Re: calling protected PHP_METHOD via call_user_function; missing context ??
| From: | Nathan Nobbe | Date: | Mon, 05 Jan 2009 17:26:07 +0000 |
| Subject: | Re: Re: calling protected PHP_METHOD via call_user_function; missing context ?? | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6037@lists.php.net to get a copy of this message | ||
On Mon, Jan 5, 2009 at 4:42 AM, Henrique M. Decaria <typoon@gmail.com>wrote:
> Also, why are you casting all those NULLs ?
>
let me just post the signature in the mail for reference,
zval* *zend_call_method* ( zval** object_pp, zend_class_entry* obj_ce,
zend_function** fn_proxy, char* function_name, int function_name_len, zval**
retval_ptr_ptr, int param_count, zval* arg1, zval* arg2, magic TSRMLS_DC )
& my call to it
zend_call_method(&this, this_ce, (zend_function**)NULL,
"initializeMacroCommand",
strlen("initializeMacroCommand"), &retval,
0, (zval*)NULL, (zval*)NULL TSRMLS_CC);
so for the third argument, zend_function** fn_proxy, when looking at the
zend_interfaces.c, the method appears to try and find the method given then
first two arguments when the third param is NULL;
if (!fn_proxy && !obj_ce) {
/* no interest in caching and no information already present that is
* needed later inside zend_call_function. */
but if you do supply the third arg then it looks like zend_call_method, will
leverage some caching mechanism, is that correct?
regarding the NULL's in params 8 & 9; i have no parameters to pass to this
MacroCommand::initializeMacroCommand, which is why i set param_count to 0,
and params 8 & 9 to NULL.
as for the call to zend_hash_exists, i regret to say after posting last, i
was actually encountering this error,
Fatal error: Couldn't find implementation for method
MacroCommand::initializeMacroCommand in Unknown on line 0
which is not what i put in my last post, which therefore made it misleading,
and i appologize for that. anyway, i wanted to see if ive made a bad call
to zend_call_method, so i thought; well, lets just see if
initializeMacroCommand is actually in that hash in the first place (the one
that comes from the getThis() macro). well turns out, its not, and now im
left wondering why..
this is sort of what i was alluding to in my last post. if i do php --rc
MacroCommand on the cli, for example, initializeMacroCommand is there in the
output. so, im thinking it must be in the HashTable ?? apparently im doing
something wrong here, but still sort of stabbing at the air.
ive got tons of more code to write on this so, i may just move on to other
areas and revisit this issue later.
at any rate, ive posted what i have so far for the extension.
http://pastebin.com/m5b723e3
im not a complete newb w/ C, but im not proficient either. im trying to
develop my C skills here, and i really appreciate the help from you folks on
the list :D
-nathan