Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4723 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40846 invoked by uid 1010); 7 Oct 2003 13:05:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40819 invoked from network); 7 Oct 2003 13:05:43 -0000 Received: from unknown (HELO mail.sites-secure.com) (213.189.34.71) by pb1.pair.com with SMTP; 7 Oct 2003 13:05:43 -0000 Received: by mail.sites-secure.com (CommuniGate Pro PIPE 3.5.9) with PIPE id 31179928; Tue, 07 Oct 2003 14:12:37 +0200 Received: from [192.117.106.24] (account ilya@up.co.il HELO abox.co.il) by mail.sites-secure.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 31179930; Tue, 07 Oct 2003 14:12:32 +0200 Message-ID: <3F82BB04.2070700@abox.co.il> Date: Tue, 07 Oct 2003 15:09:24 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3; MultiZilla v1.3.1 (a)) Gecko/20030917 X-Accept-Language: en-us, en, he, ru MIME-Version: 1.0 To: Wez Furlong CC: PHP Development References: <3F82B401.3070309@abox.co.il> <01ef01c38cd1$04940990$8b018552@titan> In-Reply-To: <01ef01c38cd1$04940990$8b018552@titan> X-Enigmail-Version: 0.76.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DoalSignature: rot-4 (smtp) Subject: Re: [PHP-DEV] help request: php array From: netcat@abox.co.il (netcat) Wez Furlong wrote: >Try something like this: > >if (rep_CONSP(in)) { > array_init(return_value); /* sets it up as an array */ > > for (i = in; i != Qnil; i = rep_CDR(i)) { > zval *tmp; > > MAKE_STD_ZVAL(tmp); > rep_data_converter(rep_CAR(i), tmp); > add_next_index_zval(return_value, tmp); /* equivalent to $ret[] = $tmp >*/ > } >} > > > > >> if(rep_CONSP(in)) { >> zval php_array; >> //zend_hash_init(&php_array,100, >> repv i,t; >> for(i=in;i!=Qnil;i=rep_CDR(i)) { >> printf("REP FWD to next element\n"); >> rep_data_converter(rep_CAR(i),&t); >> /* ??? add t to array php_array */ >> } >> } >> >> > > > > > I guess it almost works : if(rep_CONSP(in)) { repv i; for(i=in;i!=Qnil;i=rep_CDR(i)) { zval *t; MAKE_STD_ZVAL(t); printf("REP FWD to next element PT1\n"); rep_data_converter(rep_CAR(i),t); printf("REP FWD to next element PT2\n"); add_next_index_zval(return_value, t); printf("REP FWD to next element PT3\n"); /* ??? add t to array() */ } } ---8<--- REP FWD to next element PT1 REP FWD to next element PT2 rep: received fatal signal: Segmentation fault struct debug_buf common: Backtrace in `fatal_signal_handler': <(null)+1107463240> Lisp backtrace: Segmentation fault ---8<--- Is that rep's or php's problem? May be t should be duplicated? If yes, how? -- NetCat ------------------------------------------------------ SPAM-Free 10mb Free email + Antivirus + POP3 + more... Get it at http://www.doal.co.il:81/free/?c=all-spam