tony2001                Thu Jun 28 16:06:23 2007 UTC

  Modified files:              
    /php-src/ext/standard       array.c 
  Log:
  synchronized range() behaviour in HEAD with 5_2
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.409&r2=1.410&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.409 php-src/ext/standard/array.c:1.410
--- php-src/ext/standard/array.c:1.409  Tue Jun  5 12:17:15 2007
+++ php-src/ext/standard/array.c        Thu Jun 28 16:06:23 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.409 2007/06/05 12:17:15 tony2001 Exp $ */
+/* $Id: array.c,v 1.410 2007/06/28 16:06:23 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1719,16 +1719,18 @@
                }
        }       
 
-       /* 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 @@
                } 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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to