]> granicus.if.org Git - php/commitdiff
Adjust zend_get_unified_string_type() to give correct types.
authorAndrei Zmievski <andrei@php.net>
Tue, 8 Aug 2006 17:36:55 +0000 (17:36 +0000)
committerAndrei Zmievski <andrei@php.net>
Tue, 8 Aug 2006 17:36:55 +0000 (17:36 +0000)
Zend/zend_API.c

index 31ea41ae9ef955c24b5847d05bbc3b0823798c6e..e25ace652afd29d62a36befeee895eb693bba4fc 100644 (file)
@@ -3816,15 +3816,11 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in
  * Return the string type that all the passed in types should be converted to.
  * If none of the types are string types, IS_UNICODE or IS_STRING is returned,
  * depending on the Unicode semantics switch.
- * Binary and Unicode types cannot be mixed, so we return -1 (or 255 since it's
- * uchar)
  */
 ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...)
 {
        va_list ap;
        int best_type = UG(unicode) ? IS_UNICODE : IS_STRING;
-       zend_bool seen_unicode = 0;
-       zend_bool seen_string = 0;
        int type;
 
        if (num_args <= 0) return (zend_uchar)-1;
@@ -3835,22 +3831,16 @@ ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...)
        va_start(ap, num_args);
 #endif
        while (num_args--) {
-       type = va_arg(ap, int);
+               type = va_arg(ap, int);
                if (type == IS_UNICODE) {
-                       seen_unicode = 1;
                        best_type = IS_UNICODE;
+                       break;
                } else if (type == IS_STRING) {
-                       seen_string = 1;
                        best_type = IS_STRING;
                }
        }
        va_end(ap);
 
-       /* We do not allow mixing binary and Unicode types */
-       if (seen_string && seen_unicode) {
-               return (zend_uchar)-1;
-       }
-
        return best_type;
 }