Re: Help, please! The Zend API is driving me mad!!!

From: Date: Tue, 17 Jun 2003 18:09:28 +0000
Subject: Re: Help, please! The Zend API is driving me mad!!!
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-2354@lists.php.net to get a copy of this message
I see two notable problems, though there may be more: 1) TSRMLS_DC should be TSRMLS_CC _DC is only used for function declarations, _CC is used for passing the tsrm parameter to it. (Did you configure with --enable-maintainer-zts [ or --enable-experimental-zts if this is PHP4 ]? ) 2) You need to either allocate the zval* for retval or (better) define retval as a zval* (not zval**) and pass it as &retval. The way you have it now will have call_user_func attempt to overwrite the data at the address pointed to by retval (which at the moment is undefined). This is probably what is specifically causing your segfault here. -Sara "Oriol" <omagrane@anthill.es> wrote in message news:000701c334ed$9850c6f0$0601a8c0@pii... > > Aaaaaaaaaaargh! > When I run the following code... > > ---------------------------------------------- > char fname[256]; > zval **retval; > zval *zfname; > > strcpy(fname, "rand"); > zend_printf("Step 1...\n"); > MAKE_STD_ZVAL(zfname); > zend_printf("Step 2...\n"); > ZVAL_STRING(zfname, fname, 1); > zend_printf("Step 3...\n"); > TSRMLS_FETCH(); > zend_printf("Step 4...\n"); > if (call_user_function_ex(CG(function_table), NULL, > zfname, retval, 0, NULL, 0, > NULL TSRMLS_DC) == SUCCESS) > { > zend_printf("The function has ben called.\n"); > } > ----------------------------------------------- > > ... i get: > > Step 1... > Step 2... > Step 3... > Step 4... > Segmentation fault > > Could someone tell me what I'm doing wrong? > Thank you very much, > > Oriol > > >

« previous php.internals (#2354) next »