Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81794 invoked from network); 15 May 2009 04:13:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2009 04:13:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=mozo@mozo.jp; spf=permerror; sender-id=permerror Authentication-Results: pb1.pair.com header.from=mozo@mozo.jp; sender-id=permerror Received-SPF: error (pb1.pair.com: domain mozo.jp from 74.125.44.28 cause and error) X-PHP-List-Original-Sender: mozo@mozo.jp X-Host-Fingerprint: 74.125.44.28 yx-out-2324.google.com Received: from [74.125.44.28] ([74.125.44.28:5626] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/D7-27038-00CEC0A4 for ; Fri, 15 May 2009 00:13:52 -0400 Received: by yx-out-2324.google.com with SMTP id 8so932584yxg.83 for ; Thu, 14 May 2009 21:13:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.35.66 with SMTP id o2mr1781534ibd.41.1242360829588; Thu, 14 May 2009 21:13:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 May 2009 13:13:49 +0900 Message-ID: To: Farley Knight Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Segfault while looping through hash table From: mozo@mozo.jp (Moriyoshi Koizumi) On Fri, May 15, 2009 at 12:31 PM, Farley Knight wrote: > zend_hash_internal_pointer_reset(Z_ARRVAL(zhash)); > > printf("This hash table has %d entries\n", > zend_hash_num_elements(Z_ARRVAL(zhash))); > > int current = 0; > > while (zend_hash_get_current_data(Z_ARRVAL(zhash), (void**)&value) > == SUCCESS) { > current++; > printf("Currently on entry %d\n", current); > if (zend_hash_move_forward(Z_ARRVAL(zhash)) == SUCCESS) > printf("Done moving hash forward. Result was successful\n"); > else > printf("Done moving hash forward. Result was a failure\n"); > } > 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