Re: Segfault while looping through hash table

From: Date: Fri, 15 May 2009 11:48:31 +0000
Subject: Re: Segfault while looping through hash table
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-43983@lists.php.net to get a copy of this message
On Fri, May 15, 2009 at 4:03 AM, Antony Dovgal <tony@daylessday.org> wrote: > On 15.05.2009 07:31, Farley Knight wrote: >>   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"); >>   } > > What's the point of this if() ? > You continue reading the values even if move_forward() fails (i.e. the end is reached). I threw that in for debugging purposes.. So it's completely useless otherwise :) > > -- > Wbr, > Antony Dovgal > - Farley

« previous php.internals (#43983) next »