summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-04-19 23:21:22 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-04-19 23:21:22 +0000
commitc34806e1455a8b28ff1df0850a05e204acbc2316 (patch)
treeeef52486fbf8c12b71523a2b160584f58c90c796 /ext/standard/array.c
parent73da9ea31dc50b7dd87f42e64a75bafcb8295ef2 (diff)
downloadphp-git-c34806e1455a8b28ff1df0850a05e204acbc2316.tar.gz
Fixed bug #41121 (range() overflow handling for large numbers on 32bit
machines).
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 3ff80a12a3..1e868e0488 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1718,13 +1718,13 @@ double_str:
add_next_index_double(return_value, low);
}
} else {
- int low, high;
+ double low, high;
long lstep;
long_str:
- convert_to_long(zlow);
- convert_to_long(zhigh);
- low = Z_LVAL_P(zlow);
- high = Z_LVAL_P(zhigh);
+ convert_to_double(zlow);
+ convert_to_double(zhigh);
+ low = Z_DVAL_P(zlow);
+ high = Z_DVAL_P(zhigh);
lstep = (long) step;
if (low > high) { /* Negative steps */
@@ -1733,18 +1733,18 @@ long_str:
goto err;
}
for (; low >= high; low -= lstep) {
- add_next_index_long(return_value, low);
+ add_next_index_long(return_value, (long)low);
}
- } else if (high > low) { /* Positive steps */
+ } else if (high > low) { /* Positive steps */
if (high - low < lstep || lstep <= 0) {
err = 1;
goto err;
}
for (; low <= high; low += lstep) {
- add_next_index_long(return_value, low);
+ add_next_index_long(return_value, (long)low);
}
} else {
- add_next_index_long(return_value, low);
+ add_next_index_long(return_value, (long)low);
}
}
err: