Re: Help: call_user_function() core dumps

From: Date: Wed, 30 Apr 2008 18:16:25 +0000
Subject: Re: Help: call_user_function() core dumps
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-37380@lists.php.net to get a copy of this message
Hi, On Wed, 2008-04-30 at 09:52 -0700, Dhiru Pandey wrote: > I am new to PHP extension writing and embedding. Following the book from > Sara Goleman - Extending and Embedding PHP (Developer's Library) > I wrote the following program based on her example in Chap. 20 > > =================================================================== > #include <stdio.h> > #include <stdlib.h> > > #include <sapi/embed/php_embed.h> > > int main(int argc, char** argv) { > PHP_EMBED_START_BLOCK(argc, argv); > > zval* args[2]; > zval funcname; > zval input_str; > zval count; > zval retval; > char* ans; > ZVAL_STRING(&funcname, "str_repeat", 0); > args[0] = &input_str; > args[1] = &count; You have to use emalloc'ed memory for (basically) everything you give to the engine and no pointers to local variables else the engine tries to free these local variables. johannes

« previous php.internals (#37380) next »