Help with calling user functions

From: Date: Tue, 02 Nov 1999 17:51:28 +0000
Subject: Help with calling user functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-12079@lists.php.net to get a copy of this message
This has been bugging me for two days...can someone please help me figure out whats wrong? php3_test_callback is registered as test_callback void php3_test_callback(INTERNAL_FUNCTION_PARAMETERS) { pval *start_path; pval *func_name; pval *retval; pval *curpath; pval *args[1]; HashTable *function_table; retval = emalloc(sizeof(pval)); function_table=php3i_get_function_table(); if ( ARG_COUNT(ht) != 2 || getParameters(ht, 2, &start_path, &func_name) == FAILURE ) { WRONG_PARAM_COUNT; } convert_to_string(start_path); convert_to_string(func_name); curpath->type = IS_STRING; curpath->value.str.val = "/tmp"; curpath->value.str.len = strlen("/tmp"); args[0] = curpath; printf("CUR: %s ARGS: %s\n", curpath->value.str.val, args[0]->value.str.val); if ( call_user_function(function_table, NULL, func_name, retval, 1, args) == FAILURE ) printf("FAILED TO CALL USER FUNCTION!!!!\n\n"); printf("RETURN: %d\n", retval->value.lval); pval_destructor(retval); } test.php: <?php function mycallback ($param) { print "CALLED WITH: $param\n"; } test_callback("", "mycallback"); ?> The output is this: CUR: /tmp ARGS: /tmp Content-type: text/html CALLME: /tmp RETURN: 1 <br> <b>Parse error</b>: parse error in <b>test.php</b> on line <b>5</b><br> The parse error is what concerns me...I wanted to have it look calling the callback multiple times but it segfaults after the first call.. Any help is greatly appreciated, thanks in advance --Paul

« previous php.dev (#12079) next »