iliaa Sun Oct 30 13:04:20 2005 EDT
Modified files:
/php-src/ext/standard basic_functions.c
/php-src/ext/standard/tests/array bug35022.phpt
Log:
MFB51: Fixed bug #35022, #35019 (Regression in the behavior of key/current
functions).
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.734&r2=1.735&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.734
php-src/ext/standard/basic_functions.c:1.735
--- php-src/ext/standard/basic_functions.c:1.734 Thu Sep 29 12:30:15 2005
+++ php-src/ext/standard/basic_functions.c Sun Oct 30 13:04:19 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.734 2005/09/29 16:30:15 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.735 2005/10/30 18:04:19 iliaa Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -760,8 +760,8 @@
PHP_FE(prev, first_arg_force_ref)
PHP_FE(next, first_arg_force_ref)
PHP_FE(reset, first_arg_force_ref)
- PHP_FE(current, NULL)
- PHP_FE(key, NULL)
+ PHP_FE(current, all_args_prefer_ref)
+ PHP_FE(key, all_args_prefer_ref)
PHP_FE(min,
NULL)
PHP_FE(max,
NULL)
PHP_FE(in_array,
NULL)
http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug35022.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/array/bug35022.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug35022.phpt:1.2
--- /dev/null Sun Oct 30 13:04:20 2005
+++ php-src/ext/standard/tests/array/bug35022.phpt Sun Oct 30 13:04:20 2005
@@ -0,0 +1,21 @@
+--TEST--
+Bug #35022 (Regression in the behavior of key/current functions)
+--FILE--
+<?php
+$state = array("one" => 1, "two" => 2, "three" => 3);
+function foo( &$state ) {
+ $contentDict = end( $state );
+ for ( $contentDict = end( $state ); $contentDict !== false; $contentDict =
prev( $state ) ) {
+ echo key($state) . " => " . current($state) . "\n";
+ }
+}
+foo($state);
+reset($state);
+var_dump( key($state), current($state) );
+?>
+--EXPECT--
+three => 3
+two => 2
+one => 1
+string(3) "one"
+int(1)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php