php_embed and call_user_function
| From: | Phillip Whelan | Date: | Sat, 12 Mar 2005 00:35:26 +0000 |
| Subject: | php_embed and call_user_function | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-15394@lists.php.net to get a copy of this message | ||
Im trying to call call_user_function() from inside php_embed.
It always returns FAILURE...
Here is the .c file I am trying to use
(minus the header files, for clarity...)
int main(int argc, char **argv)
{
zval *func;
zval *zret;
void ***trsm_ls;
if ( php_embed_init(1, argv PTSRMLS_CC) == FAILURE) {
puts("Failed to load");
return;
}
MAKE_STD_ZVAL(func);
MAKE_STD_ZVAL(zret);
zend_eval_string("include('test.php');", NULL, "TEST");
func->type = IS_STRING;
func->value.str.len = 4;
func->value.str.val = "test";
call_user_function(CG(function_table),NULL,func,zret,0,NULL TSRMLS_CC);
php_embed_shutdown(TSRMLS_C);
}
and here is a test php file:
<?php
function test()
{
print "Hello World\n";
}
?>
I also did a direct zend_hash_find() on CG(function_table) and EG(function_table)
for test, with no result.