From 770215e0c76d21ef02e822933d11c61912098435 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 28 Jun 2007 16:06:23 +0000 Subject: [PATCH] synchronized range() behaviour in HEAD with 5_2 --- ext/standard/array.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/standard/array.c b/ext/standard/array.c index 8053fa6e8fc..ac4c78a902e 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1719,16 +1719,18 @@ PHP_FUNCTION(range) } } - /* Unify types */ - str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zlow), Z_TYPE_P(zhigh)); - convert_to_explicit_type(zlow, str_type); - convert_to_explicit_type(zhigh, str_type); + if (!is_step_double && ((Z_TYPE_P(zlow) == IS_STRING || Z_TYPE_P(zlow) == IS_UNICODE) && (Z_TYPE_P(zhigh) == IS_STRING || Z_TYPE_P(zhigh) == IS_UNICODE))) { + /* Unify types */ + str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zlow), Z_TYPE_P(zhigh)); + convert_to_explicit_type(zlow, str_type); + convert_to_explicit_type(zhigh, str_type); + } /* Initialize the return_value as an array. */ array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if ((Z_TYPE_P(zlow) == IS_STRING) && + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { zend_uchar type1, type2; unsigned char *low, *high; @@ -1774,7 +1776,7 @@ PHP_FUNCTION(range) } else { add_next_index_stringl(return_value, (char*)low, 1, 1); } - } else if (Z_TYPE_P(zlow) == IS_UNICODE && + } else if (Z_TYPE_P(zlow) == IS_UNICODE && Z_TYPE_P(zhigh) == IS_UNICODE && Z_USTRLEN_P(zlow) >= 1 && Z_USTRLEN_P(zhigh) >= 1) { zend_uchar type1, type2; UChar32 low, high;