rendered paste body### Eclipse Workspace Patch 1.0
#P php52-cvs
Index: ext/standard/array.c
===================================================================
RCS file: /repository/php-src/ext/standard/array.c,v
retrieving revision 1.308.2.21.2.26
diff -u -r1.308.2.21.2.26 array.c
--- ext/standard/array.c 18 Mar 2007 20:20:23 -0000 1.308.2.21.2.26
+++ ext/standard/array.c 19 Apr 2007 11:13:40 -0000
@@ -1731,18 +1731,30 @@
if (low - high < lstep || lstep <= 0) {
err = 1;
goto err;
- }
- for (; low >= high; low -= lstep) {
+ }
+ while (low >= high) {
add_next_index_long(return_value, low);
- }
+
+ if (low - high >= lstep) {
+ low -= lstep;
+ } else {
+ break;
+ }
+ }
} else if (high > low) { /* Positive steps */
if (high - low < lstep || lstep <= 0) {
err = 1;
goto err;
}
- for (; low <= high; low += lstep) {
+ while (low <= high) {
add_next_index_long(return_value, low);
- }
+
+ if (high - low >= lstep) {
+ low += lstep;
+ } else {
+ break;
+ }
+ }
} else {
add_next_index_long(return_value, low);
}