diff options
| author | Dmitry Stogov <dmitry@php.net> | 2006-01-17 12:18:53 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2006-01-17 12:18:53 +0000 |
| commit | 227295a4f1df63b8740aa2bdd8cdca61be738268 (patch) | |
| tree | efb1f210d045f33372e694d6835ff8c8fa7151ff /Zend | |
| parent | 465b131c2f15f5816f7db02b0dd69907a1d0dd3d (diff) | |
| download | php-git-227295a4f1df63b8740aa2bdd8cdca61be738268.tar.gz | |
Unicode stuff is changed according to decision maden on PDM.
Now IS_BINRAY data type is removed and IS_STRING starts behave as IS_BINARY in unicode mode. IS_STRING is incompatible with IS_UNICODE, so ALL functions should be improved to support unicode mode.
Diffstat (limited to 'Zend')
| -rwxr-xr-x | Zend/tests/bug26166.phpt | 7 | ||||
| -rwxr-xr-x | Zend/tests/bug28444.phpt | 2 | ||||
| -rw-r--r-- | Zend/zend.c | 29 | ||||
| -rw-r--r-- | Zend/zend.h | 1 | ||||
| -rw-r--r-- | Zend/zend_API.c | 226 | ||||
| -rw-r--r-- | Zend/zend_API.h | 39 | ||||
| -rw-r--r-- | Zend/zend_builtin_functions.c | 10 | ||||
| -rw-r--r-- | Zend/zend_compile.c | 1 | ||||
| -rw-r--r-- | Zend/zend_exceptions.c | 37 | ||||
| -rw-r--r-- | Zend/zend_execute.c | 15 | ||||
| -rw-r--r-- | Zend/zend_execute.h | 1 | ||||
| -rw-r--r-- | Zend/zend_execute_API.c | 9 | ||||
| -rw-r--r-- | Zend/zend_hash.c | 20 | ||||
| -rw-r--r-- | Zend/zend_hash.h | 9 | ||||
| -rw-r--r-- | Zend/zend_highlight.c | 2 | ||||
| -rwxr-xr-x | Zend/zend_interfaces.c | 9 | ||||
| -rw-r--r-- | Zend/zend_language_parser.y | 9 | ||||
| -rw-r--r-- | Zend/zend_language_scanner.l | 20 | ||||
| -rw-r--r-- | Zend/zend_operators.c | 86 | ||||
| -rw-r--r-- | Zend/zend_operators.h | 12 | ||||
| -rw-r--r-- | Zend/zend_unicode.c | 13 | ||||
| -rw-r--r-- | Zend/zend_unicode.h | 1 | ||||
| -rw-r--r-- | Zend/zend_variables.c | 3 | ||||
| -rw-r--r-- | Zend/zend_vm_def.h | 15 | ||||
| -rw-r--r-- | Zend/zend_vm_execute.h | 98 |
25 files changed, 173 insertions, 501 deletions
diff --git a/Zend/tests/bug26166.phpt b/Zend/tests/bug26166.phpt index e48a21afbb..130109d03a 100755 --- a/Zend/tests/bug26166.phpt +++ b/Zend/tests/bug26166.phpt @@ -72,3 +72,10 @@ string(52) "Method None::__toString() must return a string value" ===THROW=== Fatal error: Object of class Error could not be converted to string in %sbug26166.php on line %d +--UEXPECTF-- +Hello World! +===NONE=== +unicode(52) "Method None::__toString() must return a string value" +===THROW=== + +Fatal error: Object of class Error could not be converted to string in %sbug26166.php on line %d diff --git a/Zend/tests/bug28444.phpt b/Zend/tests/bug28444.phpt index d126612522..3c8cfa6df7 100755 --- a/Zend/tests/bug28444.phpt +++ b/Zend/tests/bug28444.phpt @@ -90,7 +90,7 @@ Overloaded::__set(y,3) int(3) Overloaded::__get(y) int(3) -string(55) "Object of class Object could not be converted to string" +unicode(55) "Object of class Object could not be converted to string" Overloaded::__set(z,) object(Object)#%d (1) { [u"x"]=> diff --git a/Zend/zend.c b/Zend/zend.c index 5ed5a32185..79d0a4ed05 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -263,9 +263,6 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) goto str_type; case HASH_KEY_IS_UNICODE: ztype = IS_UNICODE; - goto str_type; - case HASH_KEY_IS_BINARY: - ztype = IS_BINARY; str_type: if (is_object) { char *prop_name, *class_name; @@ -320,9 +317,6 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) case HASH_KEY_IS_STRING: ZEND_PUTS(string_key); break; - case HASH_KEY_IS_BINARY: - zend_printf("b\"%s\"", string_key); - break; case HASH_KEY_IS_UNICODE: zend_printf("%r", string_key); break; @@ -377,7 +371,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop UErrorCode temp = U_ZERO_ERROR; TSRMLS_FETCH(); - if (expr->type == IS_BINARY || + if ( /* UTODO: clean this up */ (expr->type == IS_STRING && (!strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), &temp), @@ -466,6 +460,10 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy) zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name); ZVAL_EMPTY_UNICODE(expr_copy); break; + case IS_ARRAY: + expr_copy->value.ustr.len = sizeof("Array")-1; + expr_copy->value.ustr.val = zend_ascii_to_unicode("Array", sizeof("Array") ZEND_FILE_LINE_CC); + break; default: *expr_copy = *expr; zval_copy_ctor(expr_copy); @@ -650,9 +648,7 @@ static void zend_set_default_compile_time_values(TSRMLS_D) static void zval_copy_persistent(zval *zv) { - if (Z_TYPE_P(zv) == IS_BINARY) { - Z_BINVAL_P(zv) = zend_strndup(Z_BINVAL_P(zv), Z_BINLEN_P(zv)); - } else if (Z_TYPE_P(zv) == IS_UNICODE) { + if (Z_TYPE_P(zv) == IS_UNICODE) { Z_USTRVAL_P(zv) = zend_ustrndup(Z_USTRVAL_P(zv), Z_USTRLEN_P(zv)); } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { UChar *ustr; @@ -1684,18 +1680,23 @@ ZEND_API void zend_error(int type, const char *format, ...) #endif va_copy(usr_copy, args); z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, usr_copy); + z_error_message->type = IS_STRING; + if (UG(unicode)) { + char *str = z_error_message->value.str.val; + int len = z_error_message->value.str.len; + + ZVAL_RT_STRINGL(z_error_message, str, len, 1); + efree(str); + } #ifdef va_copy va_end(usr_copy); #endif - z_error_message->type = IS_STRING; z_error_type->value.lval = type; z_error_type->type = IS_LONG; if (error_filename) { - z_error_filename->value.str.len = strlen(error_filename); - z_error_filename->value.str.val = estrndup(error_filename, z_error_filename->value.str.len); - z_error_filename->type = IS_STRING; + ZVAL_RT_STRING(z_error_filename, error_filename, 1); } z_error_lineno->value.lval = error_lineno; diff --git a/Zend/zend.h b/Zend/zend.h index 6ee603f762..b665b80f5b 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -434,7 +434,6 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define IS_CONSTANT 8 #define IS_CONSTANT_ARRAY 9 #define IS_UNICODE 10 -#define IS_BINARY 11 /* Ugly hack to support constants as static array indices */ #define IS_CONSTANT_INDEX 0x80 diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 3d1de56b60..dc8c790808 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -244,9 +244,6 @@ ZEND_API char *zend_zval_type_name(zval *arg) case IS_UNICODE: return "Unicode string"; - case IS_BINARY: - return "binary data"; - default: return "unknown"; } @@ -281,11 +278,6 @@ ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uin *pl = Z_STRLEN_PP(arg); \ *type = IS_STRING; -#define RETURN_AS_BINARY(arg, p, pl, type) \ - *(char**)p = Z_BINVAL_PP(arg); \ - *pl = Z_BINLEN_PP(arg); \ - *type = IS_BINARY; - #define RETURN_AS_UNICODE(arg, p, pl, type) \ *(UChar**)p = Z_USTRVAL_PP(arg); \ *pl = Z_USTRLEN_PP(arg); \ @@ -424,11 +416,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp *pl = Z_STRLEN_PP(arg); break; - case IS_BINARY: - *p = Z_BINVAL_PP(arg); - *pl = Z_BINLEN_PP(arg); - break; - case IS_OBJECT: { if (Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); @@ -450,55 +437,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp } break; - case 'y': - { - char **p = va_arg(*va, char **); - int *pl = va_arg(*va, int *); - switch (Z_TYPE_PP(arg)) { - case IS_NULL: - if (return_null) { - *p = NULL; - *pl = 0; - break; - } - /* break omitted intentionally */ - - case IS_STRING: - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - case IS_UNICODE: - convert_to_binary_ex(arg); - *p = Z_BINVAL_PP(arg); - *pl = Z_BINLEN_PP(arg); - break; - - case IS_BINARY: - *p = Z_BINVAL_PP(arg); - *pl = Z_BINLEN_PP(arg); - break; - - case IS_OBJECT: { - if (Z_OBJ_HANDLER_PP(arg, cast_object)) { - SEPARATE_ZVAL_IF_NOT_REF(arg); - if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_BINARY TSRMLS_CC) == SUCCESS) { - *pl = Z_BINLEN_PP(arg); - *p = Z_BINVAL_PP(arg); - break; - } else { - return "binary data"; - } - } - } - - case IS_ARRAY: - case IS_RESOURCE: - default: - return "binary data"; - } - } - break; - case 'u': { UChar **p = va_arg(*va, UChar **); @@ -564,7 +502,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp case IS_BOOL: case IS_STRING: case IS_UNICODE: - case IS_BINARY: if (T_arg_type == IS_UNICODE) { convert_to_unicode_ex(arg); RETURN_AS_UNICODE(arg, p, pl, type); @@ -578,9 +515,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp zend_error(E_WARNING, "%v%s%v() does not allow mixing binary and Unicode parameters", class_name, space, get_active_function_name(TSRMLS_C)); return ""; - } else { - convert_to_binary_ex(arg); - RETURN_AS_BINARY(arg, p, pl, type); } } break; @@ -639,10 +573,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp RETURN_AS_STRING(arg, p, pl, type); break; - case IS_BINARY: - RETURN_AS_BINARY(arg, p, pl, type); - break; - case IS_UNICODE: RETURN_AS_UNICODE(arg, p, pl, type); break; @@ -926,10 +856,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl switch (*spec_walk) { case 'T': arg = (zval **) p - (arg_count-i); - if (Z_TYPE_PP(arg) == IS_BINARY) { - /* we can always convert to binary */ - T_arg_type = IS_BINARY; - } else if (Z_TYPE_PP(arg) == IS_UNICODE && (T_arg_type == -1 || T_arg_type == IS_STRING)) { + if (Z_TYPE_PP(arg) == IS_UNICODE && (T_arg_type == -1 || T_arg_type == IS_STRING)) { /* we can upgrade from strings to Unicode */ T_arg_type = IS_UNICODE; } else if (Z_TYPE_PP(arg) == IS_STRING && T_arg_type == -1) { @@ -1082,8 +1009,6 @@ static int zend_merge_property(zval **value, int num_args, va_list args, zend_ha MAKE_STD_ZVAL(member); if (hash_key->type == IS_STRING) { ZVAL_STRINGL(member, hash_key->u.string, hash_key->nKeyLength-1, 1); - } else if (hash_key->type == IS_BINARY) { - ZVAL_BINARYL(member, hash_key->u.string, hash_key->nKeyLength-1, 1); } else if (hash_key->type == IS_UNICODE) { ZVAL_UNICODEL(member, hash_key->u.unicode, hash_key->nKeyLength-1, 1); } @@ -1148,9 +1073,6 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC case HASH_KEY_IS_UNICODE: utype = IS_UNICODE; break; - case HASH_KEY_IS_BINARY: - utype = IS_BINARY; - break; case HASH_KEY_IS_STRING: default: utype = IS_STRING; @@ -1414,28 +1336,6 @@ ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, i } -ZEND_API int add_index_binary(zval *arg, ulong index, char *str, int duplicate TSRMLS_DC) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARY(tmp, str, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_index_binaryl(zval *arg, ulong index, char *str, uint length, int duplicate TSRMLS_DC) -{ - zval *tmp; - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARYL(tmp, str, length, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); -} - - ZEND_API int add_index_unicode(zval *arg, ulong index, UChar *str, int duplicate) { zval *tmp; @@ -1541,29 +1441,6 @@ ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int dupli } -ZEND_API int add_next_index_binary(zval *arg, char *str, int duplicate) -{ - zval *tmp; - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARY(tmp, str, duplicate); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - - -ZEND_API int add_next_index_binaryl(zval *arg, char *str, uint length, int duplicate) -{ - zval *tmp; - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARYL(tmp, str, length, duplicate); - - return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); -} - ZEND_API int add_next_index_unicode(zval *arg, UChar *str, int duplicate) { zval *tmp; @@ -1657,30 +1534,6 @@ ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint lengt return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); } -ZEND_API int add_get_index_binary(zval *arg, ulong index, char *str, void **dest, int duplicate) -{ - zval *tmp; - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARY(tmp, str, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API int add_get_index_binaryl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate) -{ - zval *tmp; - TSRMLS_FETCH(); - - MAKE_STD_ZVAL(tmp); - ZVAL_BINARYL(tmp, str, length, duplicate); - - return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest); -} - - ZEND_API int add_get_index_unicode(zval *arg, ulong index, UChar *str, void **dest, int duplicate) { zval *tmp; @@ -1711,7 +1564,7 @@ ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSR ZVAL_LONG(tmp, n); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1728,7 +1581,7 @@ ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRM ZVAL_BOOL(tmp, b); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1745,7 +1598,7 @@ ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC) ZVAL_NULL(tmp); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1762,7 +1615,7 @@ ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n ZVAL_RESOURCE(tmp, n); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1780,7 +1633,7 @@ ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d ZVAL_DOUBLE(tmp, d); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1798,7 +1651,7 @@ ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *st ZVAL_STRING(tmp, str, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1815,7 +1668,7 @@ ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *s ZVAL_STRINGL(tmp, str, length, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1832,7 +1685,7 @@ ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, ch ZVAL_ASCII_STRING(tmp, str, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1849,7 +1702,7 @@ ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, c ZVAL_ASCII_STRINGL(tmp, str, length, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1866,7 +1719,7 @@ ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char ZVAL_RT_STRING(tmp, str, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1883,7 +1736,41 @@ ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char ZVAL_RT_STRINGL(tmp, str, length, duplicate); MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + zval_ptr_dtor(&z_key); + return SUCCESS; +} + +ZEND_API int add_property_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval *z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_UNICODE(tmp, str, duplicate); + + MAKE_STD_ZVAL(z_key); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); + + Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); + zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ + zval_ptr_dtor(&z_key); + return SUCCESS; +} + +ZEND_API int add_property_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate TSRMLS_DC) +{ + zval *tmp; + zval *z_key; + + MAKE_STD_ZVAL(tmp); + ZVAL_UNICODEL(tmp, str, length, duplicate); + + MAKE_STD_ZVAL(z_key); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1896,7 +1783,7 @@ ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *valu zval *z_key; MAKE_STD_ZVAL(z_key); - ZVAL_STRINGL(z_key, key, key_len-1, 1); + ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value TSRMLS_CC); zval_ptr_dtor(&z_key); @@ -3197,7 +3084,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char * zend_error(E_CORE_ERROR, "Property %s of class %v cannot be updated", name, class_name); } MAKE_STD_ZVAL(property); - ZVAL_STRINGL(property, name, name_length, 1); + ZVAL_ASCII_STRINGL(property, name, name_length, 1); Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC); zval_ptr_dtor(&property); @@ -3518,7 +3405,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n } MAKE_STD_ZVAL(property); - ZVAL_STRINGL(property, name, name_length, 1); + ZVAL_ASCII_STRINGL(property, name, name_length, 1); value = Z_OBJ_HT_P(object)->read_property(object, property, silent TSRMLS_CC); zval_ptr_dtor(&property); @@ -3550,6 +3437,7 @@ 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; @@ -3560,22 +3448,20 @@ 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); - if (type == IS_BINARY) { - best_type = IS_BINARY; - } else if (type == IS_UNICODE) { + type = va_arg(ap, int); + if (type == IS_UNICODE) { seen_unicode = 1; - if (best_type == IS_STRING) { - best_type = IS_UNICODE; - } + best_type = IS_UNICODE; } 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 (best_type == IS_BINARY && seen_unicode) { + if (seen_string && seen_unicode) { + zend_error(E_WARNING, "Cannot mix binary and Unicode parameters"); return (zend_uchar)-1; } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 1bf7a28177..8e6572c0fe 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -426,8 +426,6 @@ ZEND_API int add_index_resource(zval *arg, ulong idx, int r); ZEND_API int add_index_double(zval *arg, ulong idx, double d); ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate); ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate); -ZEND_API int add_index_binary(zval *arg, ulong idx, char *str, int duplicate TSRMLS_DC); -ZEND_API int add_index_binaryl(zval *arg, ulong idx, char *str, uint length, int duplicate TSRMLS_DC); ZEND_API int add_index_unicode(zval *arg, ulong idx, UChar *str, int duplicate); ZEND_API int add_index_unicodel(zval *arg, ulong idx, UChar *str, uint length, int duplicate); ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); @@ -470,8 +468,6 @@ ZEND_API int add_next_index_resource(zval *arg, int r); ZEND_API int add_next_index_double(zval *arg, double d); ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate); ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate); -ZEND_API int add_next_index_binary(zval *arg, char *str, int duplicate); -ZEND_API int add_next_index_binaryl(zval *arg, char *str, uint length, int duplicate); ZEND_API int add_next_index_unicode(zval *arg, UChar *str, int duplicate); ZEND_API int add_next_index_unicodel(zval *arg, UChar *str, uint length, int duplicate); ZEND_API int add_next_index_zval(zval *arg, zval *value); @@ -540,8 +536,6 @@ ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest); ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest); ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate); ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate); -ZEND_API int add_get_index_binary(zval *arg, ulong idx, char *str, void **dest, int duplicate); -ZEND_API int add_get_index_binaryl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate); ZEND_API int add_get_index_unicode(zval *arg, ulong idx, UChar *str, void **dest, int duplicate); ZEND_API int add_get_index_unicodel(zval *arg, ulong idx, UChar *str, uint length, void **dest, int duplicate); @@ -557,6 +551,8 @@ ZEND_API int add_property_ascii_string_ex(zval *arg, char *key, uint key_len, ch ZEND_API int add_property_ascii_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); ZEND_API int add_property_rt_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC); ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC); +ZEND_API int add_property_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate TSRMLS_DC); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) @@ -570,6 +566,8 @@ ZEND_API int add_property_rt_stringl_ex(zval *arg, char *key, uint key_len, char #define add_property_rt_string(__arg, __key, __str, __duplicate) add_property_ascii_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) #define add_property_rt_stringl(__arg, __key, __str, __length, __duplicate) add_property_rt_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC) #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC) +#define add_property_unicode(__arg, __key, __str, __duplicate) add_property_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC) +#define add_property_unicodel(__arg, __key, __str, __length, __duplicate) add_property_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC) ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC); @@ -616,9 +614,6 @@ ZEND_API ZEND_FUNCTION(display_disabled_class); END_EXTERN_C() -#define BINARY_TYPE (UG(unicode) ? IS_BINARY : IS_STRING) - - #if ZEND_DEBUG #define CHECK_ZVAL_STRING(z) \ if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); } @@ -745,20 +740,6 @@ END_EXTERN_C() (z)->type = IS_UNICODE; \ } -#define ZVAL_BINARY(z, s, duplicate) { \ - char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = BINARY_TYPE; \ - } - -#define ZVAL_BINARYL(z, s, l, duplicate) { \ - char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = BINARY_TYPE; \ - } - #define ZVAL_EMPTY_STRING(z) { \ (z)->value.str.len = 0; \ (z)->value.str.val = STR_EMPTY_ALLOC(); \ @@ -771,12 +752,6 @@ END_EXTERN_C() (z)->type = IS_UNICODE; \ } -#define ZVAL_EMPTY_BINARY(z) { \ - (z)->value.str.len = 0; \ - (z)->value.str.val = STR_EMPTY_ALLOC(); \ - (z)->type = BINARY_TYPE; \ - } - #define ZVAL_ZVAL(z, zv, copy, dtor) { \ int is_ref, refcount; \ is_ref = (z)->is_ref; \ @@ -840,9 +815,6 @@ END_EXTERN_C() #define RETVAL_UNICODE(u, duplicate) ZVAL_UNICODE(return_value, u, duplicate) #define RETVAL_UNICODEL(u, l, duplicate) ZVAL_UNICODEL(return_value, u, l, duplicate) #define RETVAL_EMPTY_UNICODE() ZVAL_EMPTY_UNICODE(return_value) -#define RETVAL_BINARY(s, duplicate) ZVAL_BINARY(return_value, s, duplicate) -#define RETVAL_BINARYL(s, l, duplicate) ZVAL_BINARYL(return_value, s, l, duplicate) -#define RETVAL_EMPTY_BINARY() ZVAL_EMPTY_BINARY(return_value) #define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor) #define RETVAL_FALSE ZVAL_BOOL(return_value, 0) #define RETVAL_TRUE ZVAL_BOOL(return_value, 1) @@ -860,9 +832,6 @@ END_EXTERN_C() #define RETURN_UNICODE(u, duplicate) { RETVAL_UNICODE(u, duplicate); return; } #define RETURN_UNICODEL(u, l, duplicate) { RETVAL_UNICODEL(u, l, duplicate); return; } #define RETURN_EMPTY_UNICODE() { RETVAL_EMPTY_UNICODE(); return; } -#define RETURN_BINARY(s, duplicate) { RETVAL_BINARY(s, duplicate); return; } -#define RETURN_BINARYL(s, l, duplicate) { RETVAL_BINARYL(s, l, duplicate); return; } -#define RETURN_EMPTY_BINARY() { RETVAL_EMPTY_BINARY(); return; } #define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; } #define RETURN_FALSE { RETVAL_FALSE; return; } #define RETURN_TRUE { RETVAL_TRUE; return; } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 41ee1e25e4..39f6d76b64 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -287,7 +287,6 @@ ZEND_NAMED_FUNCTION(zend_if_strlen) break; case IS_STRING: - case IS_BINARY: RETVAL_LONG(Z_STRLEN_PP(str)); break; @@ -431,9 +430,6 @@ ZEND_FUNCTION(each) case HASH_KEY_IS_STRING: add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0); break; - case HASH_KEY_IS_BINARY: - add_get_index_binaryl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0); - break; case HASH_KEY_IS_UNICODE: add_get_index_unicodel(return_value, 0, (UChar*)string_key, string_key_len-1, (void **) &inserted_pointer, 0); break; @@ -511,7 +507,6 @@ ZEND_FUNCTION(define) case IS_LONG: case IS_DOUBLE: case IS_STRING: - case IS_BINARY: case IS_UNICODE: case IS_BOOL: case IS_RESOURCE: @@ -1398,7 +1393,6 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z *user_ar = va_arg(args, zval *); if (hash_key->nKeyLength == 0 || - hash_key->type == IS_BINARY || (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == 0) || (hash_key->type == IS_STRING && hash_key->u.unicode[0] == 0)) { return 0; @@ -1407,16 +1401,12 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z if (func->type == ZEND_INTERNAL_FUNCTION) { if (hash_key->type == IS_STRING) { add_next_index_stringl(internal_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); - } else if (hash_key->type == IS_BINARY) { - add_next_index_binaryl(internal_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); } else { add_next_index_unicodel(internal_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1); } } else if (func->type == ZEND_USER_FUNCTION) { if (hash_key->type == IS_STRING) { add_next_index_stringl(user_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); - } else if (hash_key->type == IS_BINARY) { - add_next_index_binaryl(user_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); } else { add_next_index_unicodel(user_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c579e6fd26..bb3894ceaa 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3378,7 +3378,6 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr) /* break missing intentionally */ utype = UG(unicode)?IS_UNICODE:IS_STRING; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(result->u.constant.value.ht, utype, Z_UNIVAL(offset->u.constant), Z_UNILEN(offset->u.constant)+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index f16ddbb9de..342988740b 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -307,13 +307,23 @@ ZEND_METHOD(error_exception, getSeverity) *len += l; \ } +#define TRACE_APPEND_USTRL(val, vallen) \ + { \ + zval tmp, copy; \ + int use_copy; \ + ZVAL_UNICODEL(&tmp, val, vallen, 0); \ + zend_make_printable_zval(&tmp, ©, &use_copy); \ + TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \ + zval_dtor(©); \ + } + #define TRACE_APPEND_ZVAL(zv) \ if (Z_TYPE_P((zv)) == IS_UNICODE) { \ zval copy; \ int use_copy; \ zend_make_printable_zval((zv), ©, &use_copy); \ - TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \ - zval_dtor(©); \ + TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \ + zval_dtor(©); \ } else { \ TRACE_APPEND_STRL(Z_STRVAL_P((zv)), Z_STRLEN_P((zv))); \ } @@ -372,6 +382,26 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k } break; } + case IS_UNICODE: { + int l_added; + TRACE_APPEND_CHR('\''); + if (Z_USTRLEN_PP(arg) > 15) { + TRACE_APPEND_USTRL(Z_USTRVAL_PP(arg), 15); + TRACE_APPEND_STR("...', "); + l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ + } else { + l_added = Z_USTRLEN_PP(arg); + TRACE_APPEND_USTRL(Z_USTRVAL_PP(arg), l_added); + TRACE_APPEND_STR("', "); + l_added += 3 + 1; + } + while (--l_added) { + if ((*str)[*len - l_added] < 32) { + (*str)[*len - l_added] = '?'; + } + } + break; + } case IS_BOOL: if (Z_LVAL_PP(arg)) { TRACE_APPEND_STR("true, "); @@ -535,7 +565,7 @@ ZEND_METHOD(exception, __toString) convert_to_long(&line); - ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 0); + ZVAL_ASCII_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1); fci.size = sizeof(fci); fci.function_table = &Z_OBJCE_P(getThis())->function_table; @@ -548,6 +578,7 @@ ZEND_METHOD(exception, __toString) fci.no_separation = 1; zend_call_function(&fci, NULL TSRMLS_CC); + zval_dtor(&fname); if (Z_TYPE_P(trace) != IS_STRING && Z_TYPE_P(trace) != IS_UNICODE) { trace = NULL; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 861b6fe16e..ed670f1ec7 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -178,7 +178,7 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_ should_free->var = ptr; /* T->str_offset.str here is always IS_STRING or IS_UNICODE */ - if (T->str_offset.str->type == IS_STRING || T->str_offset.str->type == IS_BINARY) { + if (T->str_offset.str->type == IS_STRING) { if (((int)T->str_offset.offset<0) || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); @@ -458,7 +458,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) /* this should modify object only if it's empty */ if ((*object_ptr)->type == IS_NULL || ((*object_ptr)->type == IS_BOOL && (*object_ptr)->value.lval==0) - || (((*object_ptr)->type == IS_STRING || (*object_ptr)->type == IS_BINARY) && (*object_ptr)->value.str.len == 0) + || ((*object_ptr)->type == IS_STRING && (*object_ptr)->value.str.len == 0) || ((*object_ptr)->type == IS_UNICODE && (*object_ptr)->value.ustr.len == 0)) { if (!PZVAL_IS_REF(*object_ptr)) { SEPARATE_ZVAL(object_ptr); @@ -668,8 +668,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 convert_to_unicode(T->str_offset.str); } - if (Z_TYPE_P(T->str_offset.str) == IS_STRING || - Z_TYPE_P(T->str_offset.str) == IS_BINARY) + if (Z_TYPE_P(T->str_offset.str) == IS_STRING) do { zval tmp; zval *final_value = value; @@ -694,7 +693,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 T->str_offset.str->value.str.len = T->str_offset.offset+1; } - if (value->type!=IS_STRING && value->type!=IS_BINARY) { + if (value->type!=IS_STRING) { tmp = *value; if (op2->op_type & (IS_VAR|IS_CV|IS_CONST)) { zval_copy_ctor(&tmp); @@ -1031,7 +1030,6 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim offset_key_length = 1; goto fetch_string_dim; case IS_STRING: - case IS_BINARY: case IS_UNICODE: offset_key = Z_UNIVAL_P(dim); @@ -1152,7 +1150,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container if (container->type==IS_NULL || (container->type==IS_BOOL && container->value.lval==0) - || ((container->type==IS_STRING || container->type==IS_BINARY) && container->value.str.len==0) + || (container->type==IS_STRING && container->value.str.len==0) || (container->type==IS_UNICODE && container->value.ustr.len==0)) { switch (type) { case BP_VAR_RW: @@ -1204,7 +1202,6 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container break; } case IS_UNICODE: - case IS_BINARY: case IS_STRING: { zval tmp; @@ -1327,7 +1324,7 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ /* this should modify object only if it's empty */ if (container->type == IS_NULL || (container->type == IS_BOOL && container->value.lval==0) - || ((container->type==IS_STRING || container->type==IS_BINARY) && container->value.str.len==0) + || (container->type==IS_STRING && container->value.str.len==0) || (container->type==IS_UNICODE && container->value.ustr.len==0)) { switch (type) { case BP_VAR_RW: diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 8cfeecbad9..1ed9c2e570 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -89,7 +89,6 @@ static inline int i_zend_is_true(zval *op) result = (op->value.dval ? 1 : 0); break; case IS_STRING: - case IS_BINARY: if (op->value.str.len == 0 || (op->value.str.len==1 && op->value.str.val[0]=='0')) { result = 0; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index efaff60fe5..4c8e0e3391 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -528,9 +528,6 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) case IS_UNICODE: zend_u_symtable_update_current_key(p->value.ht, Z_TYPE(const_value), Z_UNIVAL(const_value), Z_UNILEN(const_value)+1); break; - case IS_BINARY: - zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_BINARY, Z_STRVAL(const_value), Z_STRLEN(const_value)+1, 0); - break; case IS_BOOL: case IS_LONG: zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_LONG, NULL, 0, const_value.value.lval); @@ -1054,7 +1051,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length return FAILURE; } - ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0); + ZVAL_ASCII_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0); ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); @@ -1086,6 +1083,10 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC); EG(autoload_func) = fcall_cache.function_handler; + if (UG(unicode)) { + zval_dtor(&autoload_function); + } + zval_ptr_dtor(&class_name_ptr); zend_u_hash_del(EG(in_autoload), type, lc_name, lc_name_len+1); diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 1ccd02fdda..e20afd3097 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1216,7 +1216,7 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint if (p) { if (p->nKeyLength) { - if (p->key.type == IS_STRING || p->key.type == IS_BINARY) { + if (p->key.type == IS_STRING) { if (duplicate) { *str_index = estrndup(p->key.u.string, p->nKeyLength-1); } else { @@ -1225,11 +1225,7 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint if (str_length) { *str_length = p->nKeyLength; } - if (p->key.type == IS_BINARY) { - return HASH_KEY_IS_BINARY; - } else { - return HASH_KEY_IS_STRING; - } + return HASH_KEY_IS_STRING; } else if (p->key.type == IS_UNICODE) { if (duplicate) { *str_index = (char*)eustrndup(p->key.u.unicode, p->nKeyLength-1); @@ -1262,8 +1258,6 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) if (p->nKeyLength) { if (p->key.type == IS_UNICODE) { return HASH_KEY_IS_UNICODE; - } else if (p->key.type == IS_BINARY) { - return HASH_KEY_IS_BINARY; } else { return HASH_KEY_IS_STRING; } @@ -1310,14 +1304,14 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char * return SUCCESS; } zend_hash_index_del(ht, num_index); - } else if (key_type == HASH_KEY_IS_STRING || key_type == HASH_KEY_IS_BINARY) { + } else if (key_type == HASH_KEY_IS_STRING) { real_length = str_length; if (p->nKeyLength == str_length && - p->key.type == ((key_type == HASH_KEY_IS_STRING)?IS_STRING:IS_BINARY) && + p->key.type == IS_STRING && memcmp(p->key.u.string, str_index, str_length) == 0) { return SUCCESS; } - zend_u_hash_del(ht, (key_type == HASH_KEY_IS_STRING)?IS_STRING:IS_BINARY, str_index, str_length); + zend_u_hash_del(ht, IS_STRING, str_index, str_length); } else if (key_type == HASH_KEY_IS_UNICODE) { real_length = str_length * sizeof(UChar); if (p->nKeyLength == str_length && @@ -1381,7 +1375,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char * p->h = zend_u_inline_hash_func(IS_UNICODE, str_index, str_length); } else { memcpy(p->key.u.string, str_index, real_length); - p->key.type = (key_type == HASH_KEY_IS_STRING)?IS_STRING:IS_BINARY; + p->key.type = IS_STRING; p->h = zend_u_inline_hash_func(p->key.type, str_index, str_length); } @@ -1705,8 +1699,6 @@ ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, } else if (type == IS_UNICODE) { key_type = HASH_KEY_IS_UNICODE; HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx)); - } else { - key_type = HASH_KEY_IS_BINARY; } return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0); } diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index d3d560a009..532620c1e3 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -25,11 +25,10 @@ #include <sys/types.h> #include "zend.h" -#define HASH_KEY_IS_STRING 1 -#define HASH_KEY_IS_LONG 2 -#define HASH_KEY_NON_EXISTANT 3 -#define HASH_KEY_IS_BINARY 4 -#define HASH_KEY_IS_UNICODE 5 +#define HASH_KEY_NON_EXISTANT IS_NULL +#define HASH_KEY_IS_LONG IS_LONG +#define HASH_KEY_IS_STRING IS_STRING +#define HASH_KEY_IS_UNICODE IS_UNICODE #define HASH_UPDATE (1<<0) #define HASH_ADD (1<<1) diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 5901dee8ff..fd16c5eadd 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -143,7 +143,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini } if (token.type == IS_STRING || - token.type == IS_BINARY || token.type == IS_UNICODE) { switch (token_type) { case T_OPEN_TAG: @@ -213,7 +212,6 @@ ZEND_API void zend_strip(TSRMLS_D) } if (token.type == IS_STRING || - token.type == IS_BINARY || token.type == IS_UNICODE) { switch (token_type) { case T_OPEN_TAG: diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 357ddd9d3c..6f01ffe4a1 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -57,9 +57,10 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend if (!fn_proxy && !obj_ce) { /* no interest in caching and no information already present that is * needed later inside zend_call_function. */ - ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0); + ZVAL_ASCII_STRINGL(&z_fname, function_name, function_name_len, 1); fci.function_table = !object_pp ? EG(function_table) : NULL; result = zend_call_function(&fci, NULL TSRMLS_CC); + zval_dtor(&z_fname); } else { zend_fcall_info_cache fcic; @@ -214,12 +215,6 @@ static int zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_ zval_ptr_dtor(&retval); return HASH_KEY_IS_STRING; - case IS_BINARY: - *str_key = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); - *str_key_len = retval->value.str.len+1; - zval_ptr_dtor(&retval); - return HASH_KEY_IS_BINARY; - case IS_UNICODE: *str_key = (char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); *str_key_len = retval->value.str.len+1; diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 61ae71acd3..624f6649af 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -71,7 +71,7 @@ %left '*' '/' '%' %right '!' %nonassoc T_INSTANCEOF -%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_UNICODE_CAST T_BINARY_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' +%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_UNICODE_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' %right '[' %nonassoc T_NEW T_CLONE %token T_EXIT @@ -611,9 +611,8 @@ expr_without_variable: | internal_functions_in_yacc { $$ = $1; } | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } - | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); } + | T_STRING_CAST expr { zend_do_cast(&$$, &$2, UG(unicode)?IS_UNICODE:IS_STRING TSRMLS_CC); } | T_UNICODE_CAST expr { zend_do_cast(&$$, &$2, IS_UNICODE TSRMLS_CC); } - | T_BINARY_CAST expr { zend_do_cast(&$$, &$2, UG(unicode)?IS_BINARY:IS_STRING TSRMLS_CC); } | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); } | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); } | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); } @@ -714,8 +713,8 @@ scalar: | common_scalar { $$ = $1; } | '"' { CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; } encaps_list '"' { $$ = $3; } | T_START_HEREDOC { CG(literal_type) = UG(unicode)?IS_UNICODE:IS_STRING; } encaps_list T_END_HEREDOC { $$ = $3; zend_do_end_heredoc(TSRMLS_C); } - | T_BINARY_DOUBLE { CG(literal_type) = UG(unicode)?IS_BINARY:IS_STRING; } encaps_list '"' { $$ = $3; } - | T_BINARY_HEREDOC { CG(literal_type) = UG(unicode)?IS_BINARY:IS_STRING; } encaps_list T_END_HEREDOC { $$ = $3; zend_do_end_heredoc(TSRMLS_C); } + | T_BINARY_DOUBLE { CG(literal_type) = IS_STRING; } encaps_list '"' { $$ = $3; } + | T_BINARY_HEREDOC { CG(literal_type) = IS_STRING; } encaps_list T_END_HEREDOC { $$ = $3; zend_do_end_heredoc(TSRMLS_C); } ; diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 5bd389df35..2ae42a360f 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1270,7 +1270,7 @@ int zend_scan_binary_double_string(zval *zendlval TSRMLS_DC) zendlval->value.str.val = estrndup(yytext+1, yyleng-2); zendlval->value.str.len = yyleng-2; - zendlval->type = UG(unicode) ? IS_BINARY : IS_STRING; + zendlval->type = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); /* convert escape sequences */ @@ -1352,7 +1352,7 @@ int zend_scan_binary_single_string(zval *zendlval TSRMLS_DC) zendlval->value.str.val = estrndup(yytext+1, yyleng-2); zendlval->value.str.len = yyleng-2; - zendlval->type = UG(unicode) ? IS_BINARY : IS_STRING; + zendlval->type = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); /* convert escape sequences */ @@ -1597,10 +1597,6 @@ NEWLINE ("\r"|"\n"|"\r\n") return T_UNICODE_CAST; } -<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"binary"{TABS_AND_SPACES}")" { - return T_BINARY_CAST; -} - <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { return T_ARRAY_CAST; } @@ -1988,16 +1984,14 @@ NEWLINE ("\r"|"\n"|"\r\n") if (!filename) { filename = ""; } - zendlval->value.str.len = strlen(filename); - zendlval->value.str.val = estrndup(filename, zendlval->value.str.len); - zendlval->type = IS_STRING; + ZVAL_RT_STRING(zendlval, filename, 1); return T_FILE; } <INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" { zendlval->value.str.val = (char *) estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; - zendlval->type = IS_BINARY; + zendlval->type = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } @@ -2013,7 +2007,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { zendlval->value.str.val = (char *) estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; - zendlval->type = IS_BINARY; + zendlval->type = IS_STRING; return T_INLINE_HTML; } } @@ -2029,7 +2023,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { zendlval->value.str.val = (char *) estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; - zendlval->type = IS_BINARY; + zendlval->type = IS_STRING; return T_INLINE_HTML; } } @@ -2045,7 +2039,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { zendlval->value.str.val = (char *) estrndup(yytext, yyleng); zendlval->value.str.len = yyleng; - zendlval->type = IS_BINARY; + zendlval->type = IS_STRING; return T_INLINE_HTML; } } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 3765cd4369..2479c16d62 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -114,7 +114,6 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) { switch (op->type) { case IS_STRING: - case IS_BINARY: { char *strval; @@ -174,7 +173,6 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) } else { \ switch ((op)->type) { \ case IS_STRING: \ - case IS_BINARY: \ { \ switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1))) { \ case IS_DOUBLE: \ @@ -239,7 +237,6 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \ break; \ case IS_STRING: \ - case IS_BINARY: \ (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ break; \ case IS_UNICODE: \ @@ -283,7 +280,6 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) (holder).value.lval = ((op)->value.dval ? 1 : 0); \ break; \ case IS_STRING: \ - case IS_BINARY: \ if ((op)->value.str.len == 0 \ || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \ (holder).value.lval = 0; \ @@ -369,7 +365,6 @@ ZEND_API void convert_to_long_base(zval *op, int base) DVAL_TO_LVAL(op->value.dval, op->value.lval); break; case IS_STRING: - case IS_BINARY: { char *strval = op->value.str.val; op->value.lval = strtol(strval, NULL, base); @@ -443,7 +438,6 @@ ZEND_API void convert_to_double(zval *op) case IS_DOUBLE: break; case IS_STRING: - case IS_BINARY: { char *strval = op->value.str.val; @@ -543,7 +537,6 @@ ZEND_API void convert_to_boolean(zval *op) op->value.lval = (op->value.dval ? 1 : 0); break; case IS_STRING: - case IS_BINARY: { char *strval = op->value.str.val; @@ -615,9 +608,6 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) case IS_UNICODE: break; case IS_STRING: - zval_string_to_unicode(op TSRMLS_CC); - break; - case IS_BINARY: zend_error(E_ERROR, "Cannot convert binary type to Unicode type"); return; case IS_BOOL: @@ -703,23 +693,6 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML op->value.str.len = 0; break; case IS_STRING: - if (conv == ZEND_U_CONVERTER(UG(runtime_encoding_conv))) { - break; - } else { - char *s; - int32_t s_len; - UErrorCode status = U_ZERO_ERROR; - s = op->value.str.val; - s_len = op->value.str.len; - zend_convert_encodings(conv, ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &op->value.str.val, &op->value.str.len, s, s_len, &status); - efree(s); - if (U_FAILURE(status)) { - zend_error(E_WARNING, "Error converting string for printing"); - } - } - break; - case IS_BINARY: - zend_error(E_ERROR, "Cannot convert binary type to string type"); return; case IS_UNICODE: zval_unicode_to_string(op, conv TSRMLS_CC); @@ -785,38 +758,6 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML op->type = IS_STRING; } -ZEND_API void _convert_to_binary(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) -{ - if (!UG(unicode)) { - convert_to_string(op); - return; - } - - switch (op->type) { - case IS_BINARY: - break; - case IS_OBJECT: { - TSRMLS_FETCH(); - - convert_object_to_type(op, IS_BINARY, convert_to_binary); - - if (op->type == IS_BINARY) { - return; - } - - zend_error(E_NOTICE, "Object of class %v to binary conversion", Z_OBJCE_P(op)->name); - zval_dtor(op); - op->value.str.val = estrndup("Object", sizeof("Object")-1); - op->value.str.len = sizeof("Object")-1; - break; - } - default: - convert_to_string(op); - break; - } - op->type = IS_BINARY; -} - static void convert_scalar_to_array(zval *op, int type TSRMLS_DC) { @@ -1192,7 +1133,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) result->type = IS_LONG; return SUCCESS; } - if (op1->type == IS_STRING || op1->type == IS_BINARY) { + if (op1->type == IS_STRING) { int i; result->type = op1->type; @@ -1212,8 +1153,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if ((op1->type == IS_STRING && op2->type == IS_STRING) || - (op1->type == IS_BINARY && op2->type == IS_BINARY)) { + if (op1->type == IS_STRING && op2->type == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; @@ -1256,8 +1196,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if ((op1->type == IS_STRING && op2->type == IS_STRING) || - (op1->type == IS_BINARY && op2->type == IS_BINARY)) { + if (op1->type == IS_STRING && op2->type == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; @@ -1302,8 +1241,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if ((op1->type == IS_STRING && op2->type == IS_STRING) || - (op1->type == IS_BINARY && op2->type == IS_BINARY)) { + if (op1->type == IS_STRING && op2->type == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; @@ -1443,10 +1381,6 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zend_make_unicode_zval(op1, &op1_copy, &use_copy1); zend_make_unicode_zval(op2, &op2_copy, &use_copy2); result_type = IS_UNICODE; - } else if (op1->type == IS_BINARY && op2->type == IS_BINARY) { - result_type = IS_BINARY; - /* no conversion necessary */ - use_copy1 = use_copy2 = 0; } else { result_type = IS_STRING; zend_make_string_zval(op1, &op1_copy, &use_copy1); @@ -1622,8 +1556,8 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } } - if ((op1->type == IS_UNICODE || op1->type == IS_STRING || op1->type == IS_BINARY) && - (op2->type == IS_UNICODE || op2->type == IS_STRING || op2->type == IS_BINARY)) { + if ((op1->type == IS_UNICODE || op1->type == IS_STRING) && + (op2->type == IS_UNICODE || op2->type == IS_STRING)) { if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { zendi_u_smart_strcmp(result, op1, op2); @@ -1739,7 +1673,6 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) result->value.lval = (op1->value.dval == op2->value.dval); break; case IS_STRING: - case IS_BINARY: if ((op1->value.str.len == op2->value.str.len) && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) { result->value.lval = 1; @@ -2009,7 +1942,6 @@ ZEND_API int increment_function(zval *op1) op1->value.lval = 1; op1->type = IS_LONG; break; - case IS_BINARY: case IS_STRING: { long lval; double dval; @@ -2066,7 +1998,6 @@ ZEND_API int decrement_function(zval *op1) case IS_DOUBLE: op1->value.dval = op1->value.dval - 1; break; - case IS_BINARY: case IS_STRING: /* Like perl we only support string increment */ if (op1->value.str.len == 0) { /* consider as 0 */ STR_FREE(op1->value.str.val); @@ -2358,11 +2289,6 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) long lval1, lval2; double dval1, dval2; - if (s1->type == IS_BINARY || s2->type == IS_BINARY) { - zend_error(E_ERROR, "Cannot convert binary type to string type"); - return; - } - if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) && (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) { if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 90922280a7..903bd9101c 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -243,7 +243,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC); ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC); ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC); ZEND_API void _convert_to_unicode_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC); -ZEND_API void _convert_to_binary(zval *op TSRMLS_DC ZEND_FILE_LINE_DC); ZEND_API void convert_to_long(zval *op); ZEND_API void convert_to_double(zval *op); ZEND_API void convert_to_long_base(zval *op, int base); @@ -260,7 +259,6 @@ ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2); #define convert_to_string_with_converter(op, conv) _convert_to_string_with_converter((op), (conv) TSRMLS_CC ZEND_FILE_LINE_CC) #define convert_to_unicode(op) _convert_to_unicode((op) TSRMLS_CC ZEND_FILE_LINE_CC) #define convert_to_unicode_with_converter(op, conv) _convert_to_unicode_with_converter((op), (conv) TSRMLS_CC ZEND_FILE_LINE_CC) -#define convert_to_binary(op) _convert_to_binary((op) TSRMLS_CC ZEND_FILE_LINE_CC) #define convert_to_text(op) (UG(unicode)?convert_to_unicode(op):convert_to_string(op)) ZEND_API double zend_string_to_double(const char *number, zend_uint length); @@ -343,9 +341,6 @@ END_EXTERN_C() case IS_UNICODE: \ convert_to_unicode(pzv); \ break; \ - case IS_BINARY: \ - convert_to_binary(pzv); \ - break; \ default: \ assert(0); \ break; \ @@ -363,7 +358,6 @@ END_EXTERN_C() #define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE) #define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING) #define convert_to_unicode_ex(ppzv) convert_to_ex_master(ppzv, unicode, UNICODE) -#define convert_to_binary_ex(ppzv) convert_to_ex_master(ppzv, binary, BINARY) #define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY) #define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT) #define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL) @@ -386,8 +380,6 @@ END_EXTERN_C() #define Z_USTRVAL(zval) (zval).value.ustr.val #define Z_USTRLEN(zval) (zval).value.ustr.len #define Z_USTRCPLEN(zval) (u_countChar32((zval).value.ustr.val, (zval).value.ustr.len)) -#define Z_BINVAL(zval) Z_STRVAL(zval) -#define Z_BINLEN(zval) Z_STRLEN(zval) #define Z_ARRVAL(zval) (zval).value.ht #define Z_OBJVAL(zval) (zval).value.obj #define Z_OBJ_HANDLE(zval) (zval).value.obj.handle @@ -407,8 +399,6 @@ END_EXTERN_C() #define Z_USTRVAL_P(zval_p) Z_USTRVAL(*zval_p) #define Z_USTRLEN_P(zval_p) Z_USTRLEN(*zval_p) #define Z_USTRCPLEN_P(zval_p) Z_USTRCPLEN(*zval_p) -#define Z_BINVAL_P(zval) Z_STRVAL_P(zval) -#define Z_BINLEN_P(zval) Z_STRLEN_P(zval) #define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p) #define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p) #define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p) @@ -428,8 +418,6 @@ END_EXTERN_C() #define Z_USTRVAL_PP(zval_pp) Z_USTRVAL(**zval_pp) #define Z_USTRLEN_PP(zval_pp) Z_USTRLEN(**zval_pp) #define Z_USTRCPLEN_PP(zval_pp) Z_USTRCPLEN(**zval_pp) -#define Z_BINVAL_PP(zval) Z_STRVAL_PP(zval) -#define Z_BINLEN_PP(zval) Z_STRLEN_PP(zval) #define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp) #define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp) #define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp) diff --git a/Zend/zend_unicode.c b/Zend/zend_unicode.c index 37f64e6f5b..176dd882c9 100644 --- a/Zend/zend_unicode.c +++ b/Zend/zend_unicode.c @@ -410,8 +410,8 @@ ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC) } /* }}} */ -/* {{{ zval_string_to_unicode */ -ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC) +/* {{{ zval_string_to_unicode_ex */ +ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv) { UErrorCode status = U_ZERO_ERROR; int retval = TRUE; @@ -422,7 +422,7 @@ ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC) int s_len = Z_STRLEN_P(string); Z_TYPE_P(string) = IS_UNICODE; - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, s, s_len, &status); + zend_convert_to_unicode(conv, &u, &u_len, s, s_len, &status); ZVAL_UNICODEL(string, u, u_len, 0); if (U_FAILURE(status)) { @@ -434,6 +434,13 @@ ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC) } /* }}} */ +/* {{{ zval_string_to_unicode */ +ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC) +{ + return zval_string_to_unicode(string, ZEND_U_CONVERTER(UG(runtime_encoding_conv))); +} +/* }}} */ + /* {{{ zend_cmp_unicode_and_string */ ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len) { diff --git a/Zend/zend_unicode.h b/Zend/zend_unicode.h index 627a13c7b1..abd7eaf924 100644 --- a/Zend/zend_unicode.h +++ b/Zend/zend_unicode.h @@ -45,6 +45,7 @@ void zend_set_converter_error_mode(UConverter *conv, uint8_t error_mode); ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status); ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t *target_len, const UChar *source, int32_t source_len, UErrorCode *status); ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, char **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status); +ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv); ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC); ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC); diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index f4ee469143..f98993d493 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -36,7 +36,6 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) if (UG(unicode)) goto dtor_unicode; } case IS_STRING: - case IS_BINARY: CHECK_ZVAL_STRING_REL(zvalue); STR_FREE_REL(zvalue->value.str.val); break; @@ -90,7 +89,6 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) if (UG(unicode)) goto dtor_unicode; } case IS_STRING: - case IS_BINARY: CHECK_ZVAL_STRING_REL(zvalue); free(zvalue->value.str.val); break; @@ -140,7 +138,6 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) if (UG(unicode)) goto copy_unicode; } case IS_STRING: - case IS_BINARY: CHECK_ZVAL_STRING_REL(zvalue); zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len); break; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ae518bfd53..783b150dbe 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -898,7 +898,7 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_BINARY; + z_conv.type = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -2623,7 +2623,6 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|V zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -2699,9 +2698,6 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) } break; } - case IS_BINARY: - convert_to_binary(result); - break; case IS_ARRAY: convert_to_array(result); break; @@ -2918,7 +2914,6 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -2989,7 +2984,6 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -3289,11 +3283,6 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) key->value.str.len = str_key_len-1; key->type = IS_STRING; break; - case HASH_KEY_IS_BINARY: - key->value.str.val = str_key; - key->value.str.len = str_key_len-1; - key->type = IS_BINARY; - break; case HASH_KEY_IS_UNICODE: key->value.ustr.val = (UChar*)str_key; key->value.ustr.len = str_key_len-1; @@ -3400,7 +3389,6 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -3471,7 +3459,6 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| FREE_OP2(); } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 18e966461a..894b62f71e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1284,7 +1284,7 @@ static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_BINARY; + z_conv.type = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -1784,9 +1784,6 @@ static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - case IS_BINARY: - convert_to_binary(result); - break; case IS_ARRAY: convert_to_array(result); break; @@ -2589,7 +2586,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -2938,7 +2934,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -3287,7 +3282,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -3370,7 +3364,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -3718,7 +3711,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -3788,7 +3780,7 @@ static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_BINARY; + z_conv.type = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -4290,9 +4282,6 @@ static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - case IS_BINARY: - convert_to_binary(result); - break; case IS_ARRAY: convert_to_array(result); break; @@ -5177,7 +5166,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -5614,7 +5602,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -6051,7 +6038,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -6134,7 +6120,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -6568,7 +6553,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -6800,7 +6784,7 @@ static int ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_BINARY; + z_conv.type = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -7393,9 +7377,6 @@ static int ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - case IS_BINARY: - convert_to_binary(result); - break; case IS_ARRAY: convert_to_array(result); break; @@ -7834,11 +7815,6 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) key->value.str.len = str_key_len-1; key->type = IS_STRING; break; - case HASH_KEY_IS_BINARY: - key->value.str.val = str_key; - key->value.str.len = str_key_len-1; - key->type = IS_BINARY; - break; case HASH_KEY_IS_UNICODE: key->value.ustr.val = (UChar*)str_key; key->value.ustr.len = str_key_len-1; @@ -9135,7 +9111,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -9195,7 +9170,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -9266,7 +9240,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -9348,7 +9321,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -9419,7 +9391,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -10624,7 +10595,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -10684,7 +10654,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -10755,7 +10724,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -10837,7 +10805,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -10908,7 +10875,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE zval_dtor(free_op2.var); } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -12151,7 +12117,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -12211,7 +12176,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -12282,7 +12246,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -12364,7 +12327,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -12435,7 +12397,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -12876,7 +12837,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -14082,7 +14042,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -14142,7 +14101,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -14213,7 +14171,6 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -14295,7 +14252,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -14366,7 +14322,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -15300,7 +15255,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -15360,7 +15314,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -15431,7 +15384,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -15511,7 +15463,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -15582,7 +15533,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -16400,7 +16350,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -16460,7 +16409,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -16531,7 +16479,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -16611,7 +16558,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -16682,7 +16628,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, zval_dtor(free_op2.var); } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -17500,7 +17445,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -17560,7 +17504,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -17631,7 +17574,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -17711,7 +17653,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -17782,7 +17723,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -18179,7 +18119,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -18965,7 +18904,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -19025,7 +18963,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -19096,7 +19033,6 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -19176,7 +19112,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -19247,7 +19182,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -19504,7 +19438,7 @@ static int ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_BINARY; + z_conv.type = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -20083,9 +20017,6 @@ static int ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; } - case IS_BINARY: - convert_to_binary(result); - break; case IS_ARRAY: convert_to_array(result); break; @@ -21667,7 +21598,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -21727,7 +21657,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -21798,7 +21727,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -21878,7 +21806,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -21949,7 +21876,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -23148,7 +23074,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -23208,7 +23133,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -23279,7 +23203,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -23359,7 +23282,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -23430,7 +23352,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN zval_dtor(free_op2.var); } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -24666,7 +24587,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -24726,7 +24646,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -24797,7 +24716,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -24877,7 +24795,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -24948,7 +24865,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; @@ -25386,7 +25302,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -26587,7 +26502,6 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; @@ -26647,7 +26561,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { void *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -26718,7 +26631,6 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); ZEND_VM_CONTINUE(); /* bailed out before */ @@ -26798,7 +26710,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } break; case IS_STRING: - case IS_BINARY: case IS_UNICODE: { char *offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); @@ -26869,7 +26780,6 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } } else if (((*container)->type == IS_STRING || - (*container)->type == IS_BINARY || (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; |
