Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8876 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95752 invoked by uid 1010); 1 Apr 2004 19:24:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95035 invoked from network); 1 Apr 2004 19:24:22 -0000 Received: from unknown (HELO asuka.nerv) (24.100.195.79) by pb1.pair.com with SMTP; 1 Apr 2004 19:24:22 -0000 Received: (qmail 8195 invoked from network); 1 Apr 2004 19:24:20 -0000 Received: from rei.nerv (HELO dummy.com) (rei@192.168.1.1) by asuka.nerv with SMTP; 1 Apr 2004 19:24:20 -0000 Reply-To: ilia@prohost.org To: internals@lists.php.net Date: Thu, 1 Apr 2004 14:24:25 -0500 User-Agent: KMail/1.6.1 Organization: Prohost.org MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <200404011424.25416.ilia@prohost.org> Subject: Bug #27782 From: ilia@prohost.org (Ilia Alshanetsky) This bug is the result of the engine moving the current array position to 0x0 if there are no more next elements (next/each) or no more preceding elements (prev). The results is that if you were to run: the out would be NULL rather then 2. The fix that I just reverted from PHP4 addresses this problem for the 3 functions involved, but has a BC issue. Before the patch since the array position was pointing to 0x0 functions like key() that depend on the position would return FALSE/NULL, now they end up returning the first or last element depending on wether next or prev was used to iterate through the array. This is why I decided to revert the patch for 4.3.X. For PHP 5 we need to decide wether we want to keep the patch with the changes it introduces. Revert it and assume the old behavior as correct or to add a flag/option that would detect this condition. Allowing the old functionality to be maintained but also make it possible to allow the example above to work correctly. Ilia