Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2354 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21393 invoked by uid 1007); 17 Jun 2003 18:11:08 -0000 Message-ID: <20030617181108.21392.qmail@pb1.pair.com> To: internals@lists.php.net References: <000701c334ed$9850c6f0$0601a8c0@pii> Date: Tue, 17 Jun 2003 11:09:28 -0700 Lines: 60 X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 169.229.135.140 Subject: Re: Help, please! The Zend API is driving me mad!!! From: pollita@php.net ("Sara Golemon") 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" 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 > > >