Skip to content

Commit d07f529

Browse files
author
Moriyoshi Koizumi
committed
Fixed bug #21182
1 parent cb6d34e commit d07f529

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

ext/standard/array.c

+9-10
Original file line numberDiff line numberDiff line change
@@ -1429,18 +1429,17 @@ PHP_FUNCTION(range)
14291429
array_init(return_value);
14301430

14311431
if (Z_TYPE_PP(zlow)==IS_STRING && Z_TYPE_PP(zhigh)==IS_STRING) {
1432-
char *low, *high;
1433-
convert_to_string_ex(zlow);
1434-
convert_to_string_ex(zhigh);
1435-
low = Z_STRVAL_PP(zlow);
1436-
high = Z_STRVAL_PP(zhigh);
1437-
if (*low>*high) {
1438-
for (; *low >= *high; (*low)--) {
1439-
add_next_index_stringl(return_value, low, 1, 1);
1432+
unsigned char low, high;
1433+
low = *((unsigned char *)Z_STRVAL_PP(zlow));
1434+
high = *((unsigned char *)Z_STRVAL_PP(zhigh));
1435+
1436+
if (low>high) {
1437+
for (; low >= high; (low)--) {
1438+
add_next_index_stringl(return_value, (char *)&low, 1, 1);
14401439
}
14411440
} else {
1442-
for (; *low <= *high; (*low)++) {
1443-
add_next_index_stringl(return_value, low, 1, 1);
1441+
for (; low <= high; (low)++) {
1442+
add_next_index_stringl(return_value, (char *)&low, 1, 1);
14441443
}
14451444
}
14461445
} else {

0 commit comments

Comments
 (0)