iliaa Tue Mar 30 14:09:11 2004 EDT Added files: (Branch: PHP_4_3) /php-src/ext/standard/tests/array bug27782.phpt
Modified files: /php-src NEWS /Zend zend_builtin_functions.c /php-src/ext/standard array.c Log: MFH: Fixed bug #27782 (Wrong behaviour of next(), prev() and each()). http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.617&r2=1.1247.2.618&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.617 php-src/NEWS:1.1247.2.618 --- php-src/NEWS:1.1247.2.617 Tue Mar 30 08:43:53 2004 +++ php-src/NEWS Tue Mar 30 14:09:09 2004 @@ -2,6 +2,9 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2004, Version 4.3.6 - Synchronized bundled GD library with GD 2.0.22. (Ilia) +- Fixed bug #27782 (Wrong behaviour of next(), prev() and each()). (Ilia) +- Fixed bug #27764 (Get return value from a stored procedure not returning any + result sets). (Frank) - Fixed bug #27762 (SCO Openserver doesn't have S_ISSOCK). (Wez) - Fixed bug #27743 (Make sure Money types are converted and returned correctly). (Frank) http://cvs.php.net/diff.php/Zend/zend_builtin_functions.c?r1=1.124.2.14&r2=1.124.2.15&ty=u Index: Zend/zend_builtin_functions.c diff -u Zend/zend_builtin_functions.c:1.124.2.14 Zend/zend_builtin_functions.c:1.124.2.15 --- Zend/zend_builtin_functions.c:1.124.2.14 Mon Mar 1 03:11:46 2004 +++ Zend/zend_builtin_functions.c Tue Mar 30 14:09:10 2004 @@ -353,6 +353,9 @@ return; } if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) { + if (!target_hash->pInternalPointer) { + zend_hash_internal_pointer_end(target_hash); + } RETURN_FALSE; } array_init(return_value); http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.30&r2=1.199.2.31&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.199.2.30 php-src/ext/standard/array.c:1.199.2.31 --- php-src/ext/standard/array.c:1.199.2.30 Wed Oct 8 07:16:22 2003 +++ php-src/ext/standard/array.c Tue Mar 30 14:09:10 2004 @@ -22,7 +22,7 @@ */ -/* $Id: array.c,v 1.199.2.30 2003/10/08 11:16:22 sniper Exp $ */ +/* $Id: array.c,v 1.199.2.31 2004/03/30 19:09:10 iliaa Exp $ */ #include "php.h" #include "php_ini.h" @@ -718,6 +718,10 @@ RETURN_FALSE; } zend_hash_move_backwards(target_hash); + if (!target_hash->pInternalPointer) { + zend_hash_internal_pointer_reset(target_hash); + RETURN_FALSE; + } if (return_value_used) { if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) { @@ -746,6 +750,10 @@ RETURN_FALSE; } zend_hash_move_forward(target_hash); + if (!target_hash->pInternalPointer) { + zend_hash_internal_pointer_end(target_hash); + RETURN_FALSE; + } if (return_value_used) { if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) { http://cvs.php.net/co.php/php-src/ext/standard/tests/array/bug27782.phpt?r=1.1&p=1 Index: php-src/ext/standard/tests/array/bug27782.phpt +++ php-src/ext/standard/tests/array/bug27782.phpt --TEST-- Bug #27782 (each(), next(), prev() mange array position) --FILE-- <?php $a = array("a", "b", "c"); reset($a); while (next($a) !== false); echo current($a) . "\n"; echo prev($a) . "\n"; reset($a); while (list(,$foo) = each($a)) { echo $foo . "\n"; } echo current($a) . "\n"; while ($foo = prev($a)) { echo $foo . "\n"; } ?> --EXPECT-- c b a b c c b a -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php