Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43985 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49110 invoked from network); 15 May 2009 12:07:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2009 12:07:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=farleyknight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=farleyknight@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.166 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: farleyknight@gmail.com X-Host-Fingerprint: 209.85.219.166 mail-ew0-f166.google.com Received: from [209.85.219.166] ([209.85.219.166:52368] helo=mail-ew0-f166.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/54-27038-AFA5D0A4 for ; Fri, 15 May 2009 08:07:23 -0400 Received: by ewy10 with SMTP id 10so2376360ewy.23 for ; Fri, 15 May 2009 05:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=irVz68j1mLdjnHUM2EGZgRNiW/nvGuR6LDd5xD4igis=; b=ZUfhICiWgaHlWtObHCtvzZYHcG78bCa+qiaUXLGaHM1VJtbVbwvHOfFrB92HmeYufd yUYrf7qym3yvyn9+cPLarrqyTTsZ5hPTo4/mZ+MidENzAdgDHjf6ZZN2ikR+vokTJ9yb gRKY2NNa9xuyGIfQMq4pVnXNuNtUlCyWURMMg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=mWszLTTVou8C38mmTyJeCWjUFAmoRVeO3M1WP76ewWR/UJkF+iCMMDKLMn3eBA/eMs Oe/dMaajfojI0I7GhDJljjZMx+NGJNSHsbo1EcUEaVCSocs9VrlXUqh8hyNY6/trw2N7 61pKyj78n+g/5o/OU/qnXNdfJMyVUk4Q0B4vc= MIME-Version: 1.0 Received: by 10.210.37.16 with SMTP id k16mr4087677ebk.22.1242389240092; Fri, 15 May 2009 05:07:20 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 May 2009 08:07:00 -0400 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Segfault while looping through hash table From: farleyknight@gmail.com (Farley Knight) On Fri, May 15, 2009 at 12:13 AM, Moriyoshi Koizumi wrote: > On Fri, May 15, 2009 at 12:31 PM, Farley Knight = wrote: > >> =A0zend_hash_internal_pointer_reset(Z_ARRVAL(zhash)); >> >> =A0printf("This hash table has %d entries\n", >> zend_hash_num_elements(Z_ARRVAL(zhash))); >> >> =A0int current =3D 0; >> >> =A0while (zend_hash_get_current_data(Z_ARRVAL(zhash), (void**)&value) >> =3D=3D SUCCESS) { >> =A0 =A0current++; >> =A0 =A0printf("Currently on entry %d\n", current); >> =A0 =A0if (zend_hash_move_forward(Z_ARRVAL(zhash)) =3D=3D SUCCESS) >> =A0 =A0 =A0printf("Done moving hash forward. Result was successful\n"); >> =A0 =A0else >> =A0 =A0 =A0printf("Done moving hash forward. Result was a failure\n"); >> =A0} >> > > Does the problem persist if replacing the hashtable functions by the > _ex counterparts: zend_internal_pointer_reset_ex(), > zend_hash_get_current_data_ex() and zend_move_forward_ex()? These are > always recommended (I believe) because the internal HashPosition value > associated to a hashtable is also used in the user script. > > Regards, > Moriyoshi > Actually I believe I did, but if they are recommended, I suppose I will use them instead. Thanks for pointing that out. BTW I did provide a link to the rest of the code, but I realize what I posted above might not be enough to understand where the bug lies. Should I bother posting a larger portion? Thanks, - Farley