Bug #27782

From: Date: Thu, 01 Apr 2004 19:24:25 +0000
Subject: Bug #27782
Groups: php.internals 
Request: Send a blank email to internals+get-8876@lists.php.net to get a copy of this message
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: <?php $a = array(1,2,3); while(next($a)); echo prev($a); ?> 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

« previous php.internals (#8876) next »