summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xZend/tests/bug26166.phpt7
-rwxr-xr-xZend/tests/bug28444.phpt2
-rw-r--r--Zend/zend.c29
-rw-r--r--Zend/zend.h1
-rw-r--r--Zend/zend_API.c226
-rw-r--r--Zend/zend_API.h39
-rw-r--r--Zend/zend_builtin_functions.c10
-rw-r--r--Zend/zend_compile.c1
-rw-r--r--Zend/zend_exceptions.c37
-rw-r--r--Zend/zend_execute.c15
-rw-r--r--Zend/zend_execute.h1
-rw-r--r--Zend/zend_execute_API.c9
-rw-r--r--Zend/zend_hash.c20
-rw-r--r--Zend/zend_hash.h9
-rw-r--r--Zend/zend_highlight.c2
-rwxr-xr-xZend/zend_interfaces.c9
-rw-r--r--Zend/zend_language_parser.y9
-rw-r--r--Zend/zend_language_scanner.l20
-rw-r--r--Zend/zend_operators.c86
-rw-r--r--Zend/zend_operators.h12
-rw-r--r--Zend/zend_unicode.c13
-rw-r--r--Zend/zend_unicode.h1
-rw-r--r--Zend/zend_variables.c3
-rw-r--r--Zend/zend_vm_def.h15
-rw-r--r--Zend/zend_vm_execute.h98
-rw-r--r--ext/ctype/ctype.c1
-rw-r--r--ext/date/php_date.c19
-rw-r--r--ext/date/tests/bug35143.phpt12
-rw-r--r--ext/dom/document.c2
-rw-r--r--ext/dom/node.c6
-rw-r--r--ext/dom/tests/dom002.phpt25
-rw-r--r--ext/dom/tests/dom_set_attr_node.phpt6
-rw-r--r--ext/reflection/php_reflection.c6
-rw-r--r--ext/simplexml/simplexml.c13
-rwxr-xr-xext/simplexml/tests/013.phpt3
-rw-r--r--ext/simplexml/tests/profile11.phpt4
-rwxr-xr-xext/spl/php_spl.c3
-rwxr-xr-xext/spl/spl_array.c7
-rwxr-xr-xext/spl/spl_iterators.c20
-rw-r--r--ext/sqlite/sqlite.c6
-rw-r--r--ext/standard/array.c65
-rw-r--r--ext/standard/basic_functions.c5
-rw-r--r--ext/standard/file.c5
-rw-r--r--ext/standard/math.c25
-rw-r--r--ext/standard/md5.c4
-rw-r--r--ext/standard/sha1.c4
-rw-r--r--ext/standard/string.c256
-rw-r--r--ext/standard/tests/general_functions/008.phpt33
-rw-r--r--ext/standard/tests/math/bug21523.phpt3
-rw-r--r--ext/standard/tests/strings/bug22187.phpt3
-rw-r--r--ext/standard/tests/strings/strval.phpt9
-rw-r--r--ext/standard/type.c21
-rw-r--r--ext/standard/user_filters.c17
-rw-r--r--ext/standard/var.c40
-rw-r--r--ext/standard/var_unserializer.re3
-rw-r--r--ext/tokenizer/tests/002.phpt186
-rw-r--r--ext/tokenizer/tests/003.phpt4
-rw-r--r--ext/tokenizer/tests/bug26463.phpt30
-rw-r--r--ext/xml/xml.c4
-rw-r--r--main/main.c6
-rw-r--r--main/output.c4
-rw-r--r--main/php_variables.c4
-rw-r--r--main/streams/plain_wrapper.c3
-rwxr-xr-xrun-tests.php4
-rwxr-xr-xtests/basic/bug29971.phpt6
-rw-r--r--tests/func/006.phpt3
-rw-r--r--tests/lang/catchable_error_002.phpt15
-rw-r--r--tests/run-test/test004.phpt4
-rw-r--r--tests/run-test/test005.phpt8
-rw-r--r--tests/run-test/test008.phpt9
-rw-r--r--tests/run-test/test008a.phpt8
71 files changed, 596 insertions, 1002 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, &copy, &use_copy); \
+ TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \
+ zval_dtor(&copy); \
+ }
+
#define TRACE_APPEND_ZVAL(zv) \
if (Z_TYPE_P((zv)) == IS_UNICODE) { \
zval copy; \
int use_copy; \
zend_make_printable_zval((zv), &copy, &use_copy); \
- TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \
- zval_dtor(&copy); \
+ TRACE_APPEND_STRL(Z_STRVAL(copy), Z_STRLEN(copy)); \
+ zval_dtor(&copy); \
} 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;
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index 95b2fae33e..b0ec45c4e3 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -107,7 +107,6 @@ PHP_MINFO_FUNCTION(ctype)
convert_to_string(&tmp); \
c = &tmp; \
case IS_STRING: \
- case IS_BINARY: \
string:\
{ \
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 4a05042bbf..ceb501c9bf 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -563,7 +563,11 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_
php_locale_data *loc_dat;
if (!format_len) {
- return estrdup("");
+ if (UG(unicode)) {
+ return eustrdup(EMPTY_STR);
+ } else {
+ return estrdup("");
+ }
}
loc_dat = date_get_locale_data(UG(default_locale));
@@ -1187,7 +1191,14 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (real_len && real_len != buf_len) {
buf = (char *) erealloc(buf, real_len + 1);
- RETURN_STRINGL(buf, real_len, 0);
+ if (UG(unicode)) {
+ RETVAL_RT_STRINGL(buf, real_len, 1);
+ efree(buf);
+ return;
+ } else {
+ RETURN_STRINGL(buf, real_len, 0);
+ }
+
}
efree(buf);
RETURN_FALSE;
@@ -1820,7 +1831,7 @@ PHP_FUNCTION(date_default_timezone_get)
timelib_tzinfo *default_tz;
default_tz = get_timezone_info(TSRMLS_C);
- RETVAL_STRING(default_tz->name, 1);
+ RETVAL_ASCII_STRING(default_tz->name, 1);
}
/* }}} */
@@ -1902,7 +1913,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
switch (retformat) {
case SUNFUNCS_RET_STRING:
sprintf(retstr, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
- RETURN_STRINGL(retstr, 5, 1);
+ RETURN_RT_STRINGL(retstr, 5, 1);
break;
case SUNFUNCS_RET_DOUBLE:
RETURN_DOUBLE(N);
diff --git a/ext/date/tests/bug35143.phpt b/ext/date/tests/bug35143.phpt
index 02b0072713..8aac915fb1 100644
--- a/ext/date/tests/bug35143.phpt
+++ b/ext/date/tests/bug35143.phpt
@@ -19,3 +19,15 @@ array(4) {
["dsttime"]=>
int(0)
}
+--UEXPECTF--
+unicode(3) "UTC"
+array(4) {
+ [u"sec"]=>
+ int(%d)
+ [u"usec"]=>
+ int(%d)
+ [u"minuteswest"]=>
+ int(0)
+ [u"dsttime"]=>
+ int(0)
+}
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 314fd10b93..0191220404 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1708,7 +1708,7 @@ PHP_FUNCTION(dom_document_savexml)
if (!size) {
RETURN_FALSE;
}
- RETVAL_STRINGL(mem, size, 1);
+ RETVAL_RT_STRINGL(mem, size, 1);
xmlFree(mem);
}
}
diff --git a/ext/dom/node.c b/ext/dom/node.c
index af3e72e6bb..ebe88e2d0a 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -147,9 +147,9 @@ int dom_node_node_name_read(dom_object *obj, zval **retval TSRMLS_DC)
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_STRING(*retval, str, 1);
+ ZVAL_RT_STRING(*retval, str, 1);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
if (qname != NULL) {
@@ -202,7 +202,7 @@ int dom_node_node_value_read(dom_object *obj, zval **retval TSRMLS_DC)
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_STRING(*retval, str, 1);
+ ZVAL_RT_STRING(*retval, str, 1);
xmlFree(str);
} else {
ZVAL_NULL(*retval);
diff --git a/ext/dom/tests/dom002.phpt b/ext/dom/tests/dom002.phpt
index 2bc0717d64..bdec0e229e 100644
--- a/ext/dom/tests/dom002.phpt
+++ b/ext/dom/tests/dom002.phpt
@@ -55,3 +55,28 @@ string(9) "fubar:bar"
string(5) "test3"
string(9) "fubar:bar"
string(5) "test4"
+--UEXPECT--
+unicode(3) "bar"
+unicode(5) "test1"
+unicode(3) "bar"
+unicode(5) "test2"
+unicode(9) "fubar:bar"
+unicode(5) "test3"
+unicode(9) "fubar:bar"
+unicode(5) "test4"
+unicode(3) "bar"
+unicode(5) "test1"
+unicode(3) "bar"
+unicode(5) "test2"
+unicode(9) "fubar:bar"
+unicode(5) "test3"
+unicode(9) "fubar:bar"
+unicode(5) "test4"
+unicode(9) "fubar:bar"
+unicode(5) "test3"
+unicode(9) "fubar:bar"
+unicode(5) "test4"
+unicode(9) "fubar:bar"
+unicode(5) "test3"
+unicode(9) "fubar:bar"
+unicode(5) "test4"
diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt
index 5eac9e2012..888ad0ea77 100644
--- a/ext/dom/tests/dom_set_attr_node.phpt
+++ b/ext/dom/tests/dom_set_attr_node.phpt
@@ -74,7 +74,7 @@ object(DOMException)#%d (6) {
[u"file":protected]=>
unicode(%d) "%sdom_set_attr_node.php"
[u"line":protected]=>
- int(22)
+ int(%d)
[u"trace":u"Exception":private]=>
array(1) {
[0]=>
@@ -82,7 +82,7 @@ object(DOMException)#%d (6) {
[u"file"]=>
unicode(%d) "%sdom_set_attr_node.php"
[u"line"]=>
- int(22)
+ int(%d)
[u"function"]=>
unicode(16) "setAttributeNode"
[u"class"]=>
@@ -97,6 +97,6 @@ object(DOMException)#%d (6) {
}
}
}
- ["code"]=>
+ [u"code"]=>
int(4)
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 26c21fd0e7..1e81bdf45d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -604,8 +604,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
}
} else if (Z_TYPE_P(zv) == IS_NULL) {
string_write(str, "NULL", sizeof("NULL")-1);
- } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_BINARY) {
- if (Z_TYPE_P(zv) == IS_BINARY) {
+ } else if (Z_TYPE_P(zv) == IS_STRING) {
+ if (UG(unicode)) {
string_write(str, "b'", sizeof("b")-1);
}
string_write(str, "'", sizeof("'")-1);
@@ -1227,7 +1227,7 @@ ZEND_METHOD(reflection, export)
}
/* Invoke the __toString() method */
- ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1, 1);
+ ZVAL_ASCII_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1, 1);
result= call_user_function_ex(NULL, &object, &fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
zval_dtor(&fname);
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 332db45c7e..b5552108a1 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -370,7 +370,6 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
convert_to_string(value);
/* break missing intentionally */
case IS_STRING:
- case IS_BINARY:
xmlNodeSetContentLen(node, Z_STRVAL_P(value), Z_STRLEN_P(value));
if (value == &value_copy) {
zval_dtor(value);
@@ -521,7 +520,6 @@ next_iter:
case IS_UNICODE:
convert_to_string(value);
case IS_STRING:
- case IS_BINARY:
newnode = (xmlNodePtr)xmlNewProp(node, name, Z_STRVAL_P(value));
break;
default:
@@ -1276,7 +1274,11 @@ SXE_METHOD(attributes)
static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
{
if (contents) {
- ZVAL_STRINGL(object, contents, strlen(contents), 1);
+ if (UG(unicode)) {
+ ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), object, contents, 1);
+ } else {
+ ZVAL_STRINGL(object, contents, strlen(contents), 1);
+ }
} else {
ZVAL_NULL(object);
}
@@ -1287,9 +1289,6 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
case IS_STRING:
convert_to_string(object);
break;
- case IS_BINARY:
- convert_to_binary(object);
- break;
case IS_UNICODE:
convert_to_unicode(object);
break;
@@ -1381,7 +1380,7 @@ static zval *sxe_get_value(zval *z TSRMLS_DC)
MAKE_STD_ZVAL(retval);
- if (sxe_object_cast(z, retval, IS_STRING TSRMLS_CC)==FAILURE) {
+ if (sxe_object_cast(z, retval, UG(unicode)?IS_UNICODE:IS_STRING TSRMLS_CC)==FAILURE) {
zend_error(E_ERROR, "Unable to cast node to string");
/* FIXME: Should not be fatal */
}
diff --git a/ext/simplexml/tests/013.phpt b/ext/simplexml/tests/013.phpt
index 56c57dfbc2..bfb91dbcf9 100755
--- a/ext/simplexml/tests/013.phpt
+++ b/ext/simplexml/tests/013.phpt
@@ -21,3 +21,6 @@ var_dump((string)$sxe);
--EXPECT--
string(6) "barbar"
===DONE===
+--UEXPECT--
+unicode(6) "barbar"
+===DONE===
diff --git a/ext/simplexml/tests/profile11.phpt b/ext/simplexml/tests/profile11.phpt
index 1520738b76..c2001e9510 100644
--- a/ext/simplexml/tests/profile11.phpt
+++ b/ext/simplexml/tests/profile11.phpt
@@ -42,8 +42,8 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
unicode(5) "World"
}
-string(5) "Hello"
-string(5) "World"
+unicode(5) "Hello"
+unicode(5) "World"
object(SimpleXMLElement)#%d (0) {
}
===DONE===
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 82ffad0a2c..e60dcb5676 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -403,8 +403,7 @@ PHP_FUNCTION(spl_autoload_register)
}
}
} else if (Z_TYPE_P(zcallable) == IS_UNICODE) {
- ZVAL_STRINGL(&ztmp, "spl_autoload_call", sizeof("spl_autoload_call"), 1);
- convert_to_unicode(&ztmp);
+ ZVAL_ASCII_STRINGL(&ztmp, "spl_autoload_call", sizeof("spl_autoload_call")-1, 1);
if (zend_u_binary_zval_strcmp(&ztmp, zcallable)) {
if (!zend_binary_strcasecmp(Z_STRVAL_P(zcallable), sizeof("spl_autoload_call"), "spl_autoload_call", sizeof("spl_autoload_call"))) {
if (do_throw) {
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 54a577dd4c..284c995274 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -225,7 +225,6 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
switch(Z_TYPE_P(offset)) {
case IS_STRING:
- case IS_BINARY:
case IS_UNICODE:
if (zend_u_symtable_find(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, (void **) &retval) == FAILURE) {
zend_error(E_NOTICE, "Undefined index: %R", Z_TYPE_P(offset), Z_STRVAL_P(offset));
@@ -303,7 +302,6 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
}
switch(Z_TYPE_P(offset)) {
case IS_STRING:
- case IS_BINARY:
case IS_UNICODE:
if (*(char*)Z_UNIVAL_P(offset) == '\0') {
zend_throw_exception(U_CLASS_ENTRY(spl_ce_InvalidArgumentException), "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC);
@@ -351,7 +349,6 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
switch(Z_TYPE_P(offset)) {
case IS_STRING:
- case IS_BINARY:
case IS_UNICODE:
if (spl_array_get_hash_table(intern, 0 TSRMLS_CC) == &EG(symbol_table)) {
if (zend_u_delete_global_variable(Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset) TSRMLS_CC)) {
@@ -406,7 +403,6 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
switch(Z_TYPE_P(offset)) {
case IS_STRING:
- case IS_BINARY:
case IS_UNICODE:
return zend_u_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1);
case IS_DOUBLE:
@@ -1176,9 +1172,6 @@ void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ *
case HASH_KEY_IS_STRING:
RETVAL_STRINGL(string_key, string_length - 1, 0);
break;
- case HASH_KEY_IS_BINARY:
- RETVAL_BINARYL(string_key, string_length - 1, 0);
- break;
case HASH_KEY_IS_UNICODE:
RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 0);
break;
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index b0d4f37a1f..c0591133c5 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -481,9 +481,6 @@ SPL_METHOD(RecursiveIteratorIterator, key)
case HASH_KEY_IS_UNICODE:
RETURN_UNICODEL((void*)str_key, str_key_len-1, 0);
break;
- case HASH_KEY_IS_BINARY:
- RETURN_BINARYL(str_key, str_key_len-1, 0);
- break;
default:
RETURN_NULL();
}
@@ -1110,8 +1107,6 @@ SPL_METHOD(dual_it, key)
if (intern->current.data) {
if (intern->current.key_type == HASH_KEY_IS_STRING) {
RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1);
- } else if (intern->current.key_type == HASH_KEY_IS_BINARY) {
- RETURN_BINARYL(intern->current.str_key, intern->current.str_key_len-1, 1);
} else if (intern->current.key_type == HASH_KEY_IS_UNICODE) {
RETURN_UNICODEL((UChar *)intern->current.str_key, intern->current.str_key_len-1, 1);
} else {
@@ -1659,7 +1654,11 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC)
zval expr_copy;
ALLOC_ZVAL(intern->u.caching.zstr);
*intern->u.caching.zstr = *intern->current.data;
- zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
+ if (UG(unicode)) {
+ zend_make_unicode_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
+ } else {
+ zend_make_printable_zval(intern->u.caching.zstr, &expr_copy, &use_copy);
+ }
if (use_copy) {
*intern->u.caching.zstr = expr_copy;
INIT_PZVAL(intern->u.caching.zstr);
@@ -1750,8 +1749,6 @@ SPL_METHOD(CachingIterator, __toString)
RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len, 1);
} else if (intern->current.key_type == HASH_KEY_IS_UNICODE) {
RETURN_UNICODEL((void*)intern->current.str_key, intern->current.str_key_len, 1);
- } else if (intern->current.key_type == HASH_KEY_IS_BINARY) {
- RETURN_BINARYL(intern->current.str_key, intern->current.str_key_len, 1);
} else {
RETVAL_LONG(intern->current.int_key);
convert_to_string(return_value);
@@ -2070,9 +2067,6 @@ SPL_METHOD(NoRewindIterator, key)
case HASH_KEY_IS_UNICODE:
RETURN_UNICODEL((void*)str_key, str_key_len-1, 0);
break;
- case HASH_KEY_IS_BINARY:
- RETURN_BINARYL(str_key, str_key_len-1, 0);
- break;
default:
RETURN_NULL();
}
@@ -2383,10 +2377,6 @@ PHP_FUNCTION(iterator_to_array)
add_assoc_zval_ex(return_value, str_key, str_key_len, *data);
efree(str_key);
break;
- case HASH_KEY_IS_BINARY:
- add_u_assoc_zval_ex(return_value, IS_BINARY, str_key, str_key_len, *data);
- efree(str_key);
- break;
case HASH_KEY_IS_UNICODE:
add_u_assoc_zval_ex(return_value, IS_UNICODE, str_key, str_key_len, *data);
efree(str_key);
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index c9c125b04e..96e87a1535 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -442,7 +442,7 @@ static void php_sqlite_generic_function_callback(sqlite_func *func, int argc, co
return;
}
- ZVAL_STRING(&funcname, (char*)argv[0], 1);
+ ZVAL_ASCII_STRING(&funcname, (char*)argv[0], 1);
if (!zend_make_callable(&funcname, &callable TSRMLS_CC)) {
spprintf(&errbuf, 0, "function `%R' is not a function name", Z_TYPE(callable), Z_UNIVAL(callable));
@@ -1862,7 +1862,7 @@ static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend
Z_STRVAL_P(decoded) = emalloc(strlen(rowdata[j]));
Z_STRLEN_P(decoded) = php_sqlite_decode_binary(rowdata[j]+1, Z_STRVAL_P(decoded));
Z_STRVAL_P(decoded)[Z_STRLEN_P(decoded)] = '\0';
- Z_TYPE_P(decoded) = UG(unicode)?IS_BINARY:IS_STRING;
+ Z_TYPE_P(decoded) = IS_STRING;
if (!buffered) {
efree((char*)rowdata[j]);
rowdata[j] = NULL;
@@ -1951,7 +1951,7 @@ static void php_sqlite_fetch_column(struct php_sqlite_result *res, zval *which,
char *decoded = emalloc(l);
l = php_sqlite_decode_binary(rowdata[j]+1, decoded);
decoded[l] = '\0';
- RETVAL_BINARYL(decoded, l, 0);
+ RETVAL_STRINGL(decoded, l, 0);
if (!res->buffered) {
efree((char*)rowdata[j]);
rowdata[j] = NULL;
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b3d89008e5..1f34df81db 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -956,9 +956,6 @@ PHP_FUNCTION(key)
case HASH_KEY_IS_STRING:
RETVAL_STRINGL(string_key, string_length - 1, 1);
break;
- case HASH_KEY_IS_BINARY:
- RETVAL_BINARYL(string_key, string_length - 1, 1);
- break;
case HASH_KEY_IS_UNICODE:
RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 1);
break;
@@ -1114,9 +1111,6 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
case HASH_KEY_IS_STRING:
ZVAL_STRINGL(key, string_key, string_key_len-1, 1);
break;
- case HASH_KEY_IS_BINARY:
- ZVAL_BINARYL(key, string_key, string_key_len-1, 1);
- break;
case HASH_KEY_IS_UNICODE:
ZVAL_UNICODEL(key, (UChar*)string_key, string_key_len-1, 1);
break;
@@ -1287,9 +1281,6 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
case HASH_KEY_IS_STRING:
RETURN_STRINGL(string_key, str_key_len-1, 1);
break;
- case HASH_KEY_IS_BINARY:
- RETURN_BINARYL(string_key, str_key_len-1, 1);
- break;
case HASH_KEY_IS_UNICODE:
RETURN_UNICODEL((UChar*)string_key, str_key_len-1, 1);
break;
@@ -1588,7 +1579,6 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
zval **value_ptr, *value, *data;
if (Z_TYPE_P(entry) == IS_STRING ||
- Z_TYPE_P(entry) == IS_BINARY ||
Z_TYPE_P(entry) == IS_UNICODE) {
if (zend_u_hash_find(eg_active_symbol_table, Z_TYPE_P(entry), Z_UNIVAL_P(entry),
Z_UNILEN_P(entry)+1, (void **)&value_ptr) != FAILURE) {
@@ -1721,7 +1711,6 @@ PHP_FUNCTION(range)
/* Unify types */
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zlow), Z_TYPE_P(zhigh));
if (str_type == (zend_uchar)-1) {
- zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
return;
}
convert_to_explicit_type(zlow, str_type);
@@ -1731,7 +1720,7 @@ PHP_FUNCTION(range)
array_init(return_value);
/* If the range is given as strings, generate an array of characters. */
- if ((Z_TYPE_P(zlow) == IS_STRING || Z_TYPE_P(zlow) == IS_BINARY) &&
+ if ((Z_TYPE_P(zlow) == IS_STRING) &&
Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) {
zend_uchar type1, type2;
unsigned char *low, *high;
@@ -1758,11 +1747,7 @@ PHP_FUNCTION(range)
goto err;
}
for (; *low >= *high; (*low) -= (unsigned int)lstep) {
- if (Z_TYPE_P(zlow) == IS_STRING) {
- add_next_index_stringl(return_value, low, 1, 1);
- } else {
- add_next_index_binaryl(return_value, low, 1, 1);
- }
+ add_next_index_stringl(return_value, low, 1, 1);
if (((signed int)*low - lstep) < 0) {
break;
}
@@ -1773,21 +1758,13 @@ PHP_FUNCTION(range)
goto err;
}
for (; *low <= *high; (*low) += (unsigned int)lstep) {
- if (Z_TYPE_P(zlow) == IS_STRING) {
- add_next_index_stringl(return_value, low, 1, 1);
- } else {
- add_next_index_binaryl(return_value, low, 1, 1);
- }
+ add_next_index_stringl(return_value, low, 1, 1);
if (((signed int)*low + lstep) > 255) {
break;
}
}
} else {
- if (Z_TYPE_P(zlow) == IS_STRING) {
- add_next_index_stringl(return_value, low, 1, 1);
- } else {
- add_next_index_binaryl(return_value, low, 1, 1);
- }
+ add_next_index_stringl(return_value, low, 1, 1);
}
} else if (Z_TYPE_P(zlow) == IS_UNICODE &&
Z_USTRLEN_P(zlow) >= 1 && Z_USTRLEN_P(zhigh) >= 1) {
@@ -2157,8 +2134,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL);
if (key && Z_ARRVAL_PP(stack) == &EG(symbol_table)) {
if (key_type == HASH_KEY_IS_UNICODE) key_type = IS_UNICODE;
- else if (key_type == HASH_KEY_IS_STRING) key_type = IS_STRING;
- else key_type = IS_BINARY;
+ else key_type = IS_STRING;
zend_u_delete_global_variable(key_type, key, key_len-1 TSRMLS_CC);
} else {
zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX);
@@ -2428,9 +2404,6 @@ PHP_FUNCTION(array_slice)
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
@@ -2470,9 +2443,6 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
@@ -2625,9 +2595,6 @@ PHP_FUNCTION(array_keys)
case HASH_KEY_IS_STRING:
ZVAL_STRINGL(new_val, string_key, string_key_len-1, 0);
goto ukey;
- case HASH_KEY_IS_BINARY:
- ZVAL_BINARYL(new_val, string_key, string_key_len-1, 0);
- goto ukey;
case HASH_KEY_IS_UNICODE:
ZVAL_UNICODEL(new_val, (UChar*)string_key, string_key_len-1, 0);
ukey:
@@ -2725,7 +2692,6 @@ PHP_FUNCTION(array_count_values)
Z_LVAL_PP(tmp)++;
}
} else if (Z_TYPE_PP(entry) == IS_STRING ||
- Z_TYPE_PP(entry) == IS_BINARY ||
Z_TYPE_PP(entry) == IS_UNICODE) {
/* make sure our array does not end up with numeric string keys
* but don't touch those strings that start with 0 */
@@ -2815,9 +2781,6 @@ PHP_FUNCTION(array_reverse)
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
@@ -2940,9 +2903,6 @@ PHP_FUNCTION(array_flip)
case HASH_KEY_IS_STRING:
ZVAL_STRINGL(data, string_key, str_key_len-1, 0);
break;
- case HASH_KEY_IS_BINARY:
- ZVAL_BINARYL(data, string_key, str_key_len-1, 0);
- break;
case HASH_KEY_IS_UNICODE:
ZVAL_UNICODEL(data, (UChar *)string_key, str_key_len-1, 0);
break;
@@ -2955,7 +2915,6 @@ PHP_FUNCTION(array_flip)
if (Z_TYPE_PP(entry) == IS_LONG) {
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL);
} else if (Z_TYPE_PP(entry) == IS_STRING ||
- Z_TYPE_PP(entry) == IS_BINARY ||
Z_TYPE_PP(entry) == IS_UNICODE) {
zend_u_symtable_update(Z_ARRVAL_P(return_value), Z_TYPE_PP(entry), Z_UNIVAL_PP(entry), Z_UNILEN_PP(entry) + 1, &data, sizeof(data), NULL);
} else {
@@ -4147,8 +4106,6 @@ PHP_FUNCTION(array_rand)
if (Z_TYPE_P(return_value) != IS_ARRAY) {
if (key_type == HASH_KEY_IS_STRING) {
RETURN_STRINGL(string_key, string_key_len-1, 1);
- } else if (key_type == HASH_KEY_IS_BINARY) {
- RETURN_BINARYL(string_key, string_key_len-1, 1);
} else if (key_type == HASH_KEY_IS_UNICODE) {
RETURN_UNICODEL((UChar *)string_key, string_key_len-1, 1);
} else {
@@ -4158,8 +4115,6 @@ PHP_FUNCTION(array_rand)
/* Append the result to the return value. */
if (key_type == HASH_KEY_IS_STRING)
add_next_index_stringl(return_value, string_key, string_key_len-1, 1);
- else if (key_type == HASH_KEY_IS_BINARY)
- add_next_index_binaryl(return_value, string_key, string_key_len-1, 1);
else if (key_type == HASH_KEY_IS_UNICODE)
add_next_index_unicodel(return_value, (UChar *)string_key, string_key_len-1, 1);
else
@@ -4452,9 +4407,6 @@ PHP_FUNCTION(array_filter)
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
@@ -4622,9 +4574,6 @@ PHP_FUNCTION(array_map)
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
@@ -4665,7 +4614,6 @@ PHP_FUNCTION(array_key_exists)
switch (Z_TYPE_PP(key)) {
case IS_STRING:
case IS_UNICODE:
- case IS_BINARY:
if (zend_u_symtable_exists(HASH_OF(*array), Z_TYPE_PP(key), Z_UNIVAL_PP(key), Z_UNILEN_PP(key)+1)) {
RETURN_TRUE;
}
@@ -4736,9 +4684,6 @@ PHP_FUNCTION(array_chunk)
case HASH_KEY_IS_STRING:
utype = IS_STRING;
goto ukey;
- case HASH_KEY_IS_BINARY:
- utype = IS_BINARY;
- goto ukey;
case HASH_KEY_IS_UNICODE:
utype = IS_UNICODE;
ukey:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index ba4569212f..35f5159edd 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -534,7 +534,6 @@ zend_function_entry basic_functions[] = {
PHP_FE(is_numeric, NULL)
PHP_FE(is_string, NULL)
PHP_FE(is_unicode, NULL)
- PHP_FE(is_binary, NULL)
PHP_FE(is_buffer, NULL)
PHP_FE(is_array, NULL)
PHP_FE(is_object, NULL)
@@ -1425,7 +1424,7 @@ PHP_FUNCTION(getenv)
ptr = getenv(str);
}
if (ptr) {
- RETURN_STRING(ptr, 1);
+ RETURN_RT_STRING(ptr, 1);
}
RETURN_FALSE;
}
@@ -2572,7 +2571,7 @@ PHP_FUNCTION(ini_get)
RETURN_FALSE;
}
- RETURN_STRING(str, 1);
+ RETURN_RT_STRING(str, 1);
}
/* }}} */
diff --git a/ext/standard/file.c b/ext/standard/file.c
index bf8ef1aad2..6f01bfc8e4 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -844,7 +844,10 @@ PHP_FUNCTION(tempnam)
if ((fd = php_open_temporary_fd(d, p, &opened_path TSRMLS_CC)) >= 0) {
close(fd);
- RETVAL_STRING(opened_path, 0);
+ RETVAL_RT_STRING(opened_path, 0);
+ if (UG(unicode)) {
+ efree(opened_path);
+ }
} else {
RETVAL_FALSE;
}
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 98f661c0e3..061759dff8 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1073,6 +1073,7 @@ PHP_FUNCTION(number_format)
{
zval **num, **dec, **t_s, **d_p;
char thousand_sep=',', dec_point='.';
+ char *tmp;
switch(ZEND_NUM_ARGS()) {
case 1:
@@ -1080,16 +1081,24 @@ PHP_FUNCTION(number_format)
RETURN_FALSE;
}
convert_to_double_ex(num);
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), 0, dec_point, thousand_sep), 0);
- break;
+ tmp = _php_math_number_format(Z_DVAL_PP(num), 0, dec_point, thousand_sep);
+ RETVAL_RT_STRING(tmp, 0);
+ if (UG(unicode)) {
+ efree(tmp);
+ }
+ return;
case 2:
if (zend_get_parameters_ex(2, &num, &dec)==FAILURE) {
RETURN_FALSE;
}
convert_to_double_ex(num);
convert_to_long_ex(dec);
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep), 0);
- break;
+ tmp = _php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep);
+ RETVAL_RT_STRING(tmp, 0);
+ if (UG(unicode)) {
+ efree(tmp);
+ }
+ return;
case 4:
if (zend_get_parameters_ex(4, &num, &dec, &d_p, &t_s)==FAILURE) {
RETURN_FALSE;
@@ -1113,8 +1122,12 @@ PHP_FUNCTION(number_format)
thousand_sep=0;
}
}
- RETURN_STRING(_php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep), 0);
- break;
+ tmp = _php_math_number_format(Z_DVAL_PP(num), Z_LVAL_PP(dec), dec_point, thousand_sep);
+ RETVAL_RT_STRING(tmp, 0);
+ if (UG(unicode)) {
+ efree(tmp);
+ }
+ return;
default:
WRONG_PARAM_COUNT;
break;
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 06c5a0b699..bf3902484b 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -58,7 +58,7 @@ PHP_NAMED_FUNCTION(php_if_md5)
PHP_MD5Update(&context, arg, arg_len);
PHP_MD5Final(digest, &context);
if (raw_output) {
- RETURN_BINARYL(digest, 16, 1);
+ RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
RETVAL_ASCII_STRING(md5str, 1);
@@ -105,7 +105,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
}
if (raw_output) {
- RETURN_BINARYL(digest, 16, 1);
+ RETURN_STRINGL(digest, 16, 1);
} else {
make_digest(md5str, digest);
RETVAL_ASCII_STRING(md5str, 1);
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index 035c33ffdc..85c85284a2 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -59,7 +59,7 @@ PHP_FUNCTION(sha1)
RETURN_STRINGL(digest, 20, 1);
} else {
make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str, 1);
+ RETVAL_ASCII_STRING(sha1str, 1);
}
}
@@ -108,7 +108,7 @@ PHP_FUNCTION(sha1_file)
RETURN_STRINGL(digest, 20, 1);
} else {
make_sha1_digest(sha1str, digest);
- RETVAL_STRING(sha1str, 1);
+ RETVAL_ASCII_STRING(sha1str, 1);
}
}
/* }}} */
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 7ad47c4980..09953fcd4b 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -190,7 +190,7 @@ PHP_FUNCTION(bin2hex)
char *result;
size_t newlen;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "y", &data, &data_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
return;
}
@@ -599,11 +599,7 @@ PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zend_uchar str
}
if (return_value) {
- if ( str_type == IS_BINARY ) {
- RETVAL_BINARYL(c, len, 1);
- } else {
- RETVAL_STRINGL(c, len, 1);
- }
+ RETVAL_STRINGL(c, len, 1);
} else {
return estrndup(c, len);
}
@@ -963,28 +959,16 @@ PHPAPI void php_explode(char *delim, uint delim_len, char *str, uint str_len, ze
p2 = php_memnstr(str, delim, delim_len, endp);
if ( p2 == NULL ) {
- if ( str_type == IS_BINARY ) {
- add_next_index_binaryl(return_value, p1, str_len, 1);
- } else {
- add_next_index_stringl(return_value, p1, str_len, 1);
- }
+ add_next_index_stringl(return_value, p1, str_len, 1);
} else {
do {
- if ( str_type == IS_BINARY ) {
- add_next_index_binaryl(return_value, p1, p2-p1, 1);
- } else {
- add_next_index_stringl(return_value, p1, p2-p1, 1);
- }
+ add_next_index_stringl(return_value, p1, p2-p1, 1);
p1 = p2 + delim_len;
} while ( (p2 = php_memnstr(p1, delim, delim_len, endp)) != NULL &&
(limit == -1 || --limit > 1) );
if ( p1 <= endp ) {
- if ( str_type == IS_BINARY ) {
- add_next_index_binaryl(return_value, p1, endp-p1, 1);
- } else {
- add_next_index_stringl(return_value, p1, endp-p1, 1);
- }
+ add_next_index_stringl(return_value, p1, endp-p1, 1);
}
}
}
@@ -1021,13 +1005,8 @@ PHPAPI void php_explode_negative_limit(char *delim, uint delim_len, char *str, u
to_return = limit + found;
/* limit is at least -1 therefore no need of bounds checking : i will be always less than found */
for ( i = 0 ; i < to_return ; i++ ) { /* this checks also for to_return > 0 */
- if ( str_type == IS_BINARY ) {
- add_next_index_binaryl(return_value, positions[i],
- (positions[i+1]-delim_len) - positions[i], 1);
- } else {
- add_next_index_stringl(return_value, positions[i],
+ add_next_index_stringl(return_value, positions[i],
(positions[i+1]-delim_len) - positions[i], 1);
- }
}
}
efree(positions);
@@ -1132,8 +1111,6 @@ PHP_FUNCTION(explode)
if ( str_len == 0 ) {
if ( str_type == IS_UNICODE ) {
add_next_index_unicodel(return_value, USTR_MAKE(""), sizeof("")-1, 0);
- } else if ( str_type == IS_BINARY ) {
- add_next_index_binaryl(return_value, "", sizeof("")-1, 1);
} else {
add_next_index_stringl(return_value, "", sizeof("")-1, 1);
}
@@ -1144,8 +1121,6 @@ PHP_FUNCTION(explode)
if (limit == 0 || limit == 1) {
if ( str_type == IS_UNICODE ) {
add_index_unicodel(return_value, 0, (UChar *)str, str_len, 1);
- } else if ( str_type == IS_BINARY ) {
- add_index_binaryl(return_value, 0, (char *)str, str_len, 1 TSRMLS_CC);
} else {
add_index_stringl(return_value, 0, (char *)str, str_len, 1);
}
@@ -1184,8 +1159,6 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *retval)
/* Setup return value */
if (return_type == IS_UNICODE) {
ZVAL_EMPTY_UNICODE(retval);
- } else if (return_type == IS_BINARY) {
- ZVAL_EMPTY_BINARY(retval);
} else {
ZVAL_EMPTY_STRING(retval);
}
@@ -1198,9 +1171,8 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *retval)
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&tmp, &pos) == SUCCESS) {
if (Z_TYPE_PP(tmp) != return_type) {
- /* Convert to common type, if possible */
if (return_type == IS_UNICODE) {
- if (Z_TYPE_PP(tmp) == IS_BINARY) {
+ if (Z_TYPE_PP(tmp) == IS_STRING) {
/* ERROR */
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Cannot mix binary strings with other string types");
@@ -1211,17 +1183,17 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *retval)
SEPARATE_ZVAL(tmp);
convert_to_unicode_ex(tmp);
}
- } else if (return_type == IS_BINARY) {
- if (Z_TYPE_PP(tmp) == IS_UNICODE || Z_TYPE_PP(tmp) == IS_STRING) {
+ } else if (return_type == IS_STRING) {
+ if (Z_TYPE_PP(tmp) == IS_UNICODE) {
/* ERROR */
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Cannot mix binary strings with other string types");
- efree(Z_BINVAL_P(retval));
+ efree(Z_STRVAL_P(retval));
ZVAL_FALSE(retval);
return;
} else {
SEPARATE_ZVAL(tmp);
- convert_to_binary_ex(tmp);
+ convert_to_string_ex(tmp);
}
} else {
if (Z_TYPE_PP(tmp) == IS_UNICODE) {
@@ -1229,13 +1201,6 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *retval)
convert_to_unicode_ex(&retval);
convert_to_unicode_ex(&delim);
Z_TYPE_P(retval) = return_type = IS_UNICODE;
- } else if (Z_TYPE_PP(tmp) == IS_BINARY) {
- /* ERROR */
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Cannot mix binary strings with other string types");
- efree(Z_STRVAL_P(retval));
- ZVAL_FALSE(retval);
- return;
} else {
SEPARATE_ZVAL(tmp);
convert_to_string_ex(tmp);
@@ -1308,14 +1273,14 @@ PHP_FUNCTION(implode)
if (Z_TYPE_PP(arg1) == IS_ARRAY) {
SEPARATE_ZVAL(arg1);
arr = *arg1;
- if (Z_TYPE_PP(arg2) != IS_UNICODE && Z_TYPE_PP(arg2) != IS_BINARY && Z_TYPE_PP(arg2) != IS_STRING) {
+ if (Z_TYPE_PP(arg2) != IS_UNICODE && Z_TYPE_PP(arg2) != IS_STRING) {
convert_to_text_ex(arg2);
}
delim = *arg2;
} else if (Z_TYPE_PP(arg2) == IS_ARRAY) {
SEPARATE_ZVAL(arg2);
arr = *arg2;
- if (Z_TYPE_PP(arg1) != IS_UNICODE && Z_TYPE_PP(arg1) != IS_BINARY && Z_TYPE_PP(arg1) != IS_STRING) {
+ if (Z_TYPE_PP(arg1) != IS_UNICODE && Z_TYPE_PP(arg1) != IS_STRING) {
convert_to_text_ex(arg1);
}
delim = *arg1;
@@ -1375,8 +1340,6 @@ PHP_FUNCTION(strtok)
MAKE_STD_ZVAL(zv);
if (str_type == IS_UNICODE) {
ZVAL_UNICODEL(zv, (UChar *)str, str_len, 1);
- } else if (str_type == IS_BINARY) {
- ZVAL_BINARYL(zv, (char *)str, str_len, 1);
} else {
ZVAL_STRINGL(zv, (char *)str, str_len, 1);
}
@@ -1484,11 +1447,7 @@ PHP_FUNCTION(strtok)
if (p - (char *)BG(strtok_last)) {
return_token:
- if (tok_type == IS_BINARY) {
- RETVAL_BINARYL((char *)BG(strtok_last) + skipped, (p - (char *)BG(strtok_last)) - skipped, 1);
- } else {
- RETVAL_STRINGL((char *)BG(strtok_last) + skipped, (p - (char *)BG(strtok_last)) - skipped, 1);
- }
+ RETVAL_STRINGL((char *)BG(strtok_last) + skipped, (p - (char *)BG(strtok_last)) - skipped, 1);
BG(strtok_last) = p + 1;
} else {
RETVAL_FALSE;
@@ -1839,8 +1798,11 @@ PHP_FUNCTION(dirname)
ret = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
ret_len = php_dirname(ret, Z_STRLEN_PP(str));
-
- RETURN_STRINGL(ret, ret_len, 0);
+
+ RETVAL_RT_STRINGL(ret, ret_len, 0);
+ if (UG(unicode)) {
+ efree(ret);
+ }
}
/* }}} */
@@ -2070,11 +2032,11 @@ PHP_FUNCTION(stristr)
return;
}
- if (Z_TYPE_P(haystack) != IS_UNICODE && Z_TYPE_P(haystack) != IS_BINARY && Z_TYPE_P(haystack) != IS_STRING) {
+ if (Z_TYPE_P(haystack) != IS_UNICODE && Z_TYPE_P(haystack) != IS_STRING) {
convert_to_text(haystack);
}
- if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_BINARY || Z_TYPE_P(needle) == IS_STRING) {
+ if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
if (!Z_UNILEN_P(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
RETURN_FALSE;
@@ -2082,12 +2044,10 @@ PHP_FUNCTION(stristr)
if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type(haystack, IS_BINARY);
- convert_to_explicit_type(needle, IS_BINARY);
- } else {
- convert_to_explicit_type(haystack, str_type);
- convert_to_explicit_type(needle, str_type);
+ return;
}
+ convert_to_explicit_type(haystack, str_type);
+ convert_to_explicit_type(needle, str_type);
}
target = Z_UNIVAL_P(needle);
needle_len = Z_UNILEN_P(needle);
@@ -2137,11 +2097,7 @@ PHP_FUNCTION(stristr)
found_offset = (char *)found - Z_STRVAL_P(haystack);
start = part ? haystack_copy : haystack_copy + found_offset;
end = part ? haystack_copy + found_offset : (haystack_copy + Z_STRLEN_P(haystack));
- if (Z_TYPE_P(haystack) == IS_BINARY) {
- RETVAL_BINARYL((char *)start, (char *)end-(char *)start, 1);
- } else {
- RETVAL_STRINGL((char *)start, (char *)end-(char *)start, 1);
- }
+ RETVAL_STRINGL((char *)start, (char *)end-(char *)start, 1);
}
} else {
RETVAL_FALSE;
@@ -2172,7 +2128,7 @@ PHP_FUNCTION(strstr)
return;
}
- if (Z_TYPE_PP(needle) == IS_STRING || Z_TYPE_PP(needle) == IS_UNICODE || Z_TYPE_PP(needle) == IS_BINARY) {
+ if (Z_TYPE_PP(needle) == IS_STRING || Z_TYPE_PP(needle) == IS_UNICODE) {
if (!Z_STRLEN_PP(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
RETURN_FALSE;
@@ -2251,19 +2207,6 @@ PHP_FUNCTION(strstr)
RETURN_STRINGL(found, haystack_len - found_offset, 1);
}
break;
-
- case IS_BINARY:
- found_offset = (char *)found - (char *)haystack;
- if (part) {
- char *ret;
- ret = emalloc(found_offset + 1);
- strncpy(ret, haystack, found_offset);
- ret[found_offset] = '\0';
- RETURN_BINARYL(ret , found_offset, 0);
- } else {
- RETURN_BINARYL(found, haystack_len - found_offset, 1);
- }
- break;
}
} else {
RETURN_FALSE;
@@ -2304,7 +2247,7 @@ PHP_FUNCTION(strpos)
RETURN_FALSE;
}
- if (Z_TYPE_PP(needle) == IS_STRING || Z_TYPE_PP(needle) == IS_UNICODE || Z_TYPE_PP(needle) == IS_BINARY) {
+ if (Z_TYPE_PP(needle) == IS_STRING || Z_TYPE_PP(needle) == IS_UNICODE) {
if (!Z_STRLEN_PP(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
RETURN_FALSE;
@@ -2395,7 +2338,7 @@ PHP_FUNCTION(stripos)
return;
}
- if (Z_TYPE_P(haystack) != IS_UNICODE && Z_TYPE_P(haystack) != IS_BINARY && Z_TYPE_P(haystack) != IS_STRING) {
+ if (Z_TYPE_P(haystack) != IS_UNICODE && Z_TYPE_P(haystack) != IS_STRING) {
convert_to_text(haystack);
}
if (offset < 0 || offset > Z_UNILEN_P(haystack)) {
@@ -2404,19 +2347,17 @@ PHP_FUNCTION(stripos)
}
haystack_len = Z_UNILEN_P(haystack);
- if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_BINARY || Z_TYPE_P(needle) == IS_STRING) {
+ if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
if (!Z_UNILEN_P(needle)) {
RETURN_FALSE;
}
if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type(haystack, IS_BINARY);
- convert_to_explicit_type(needle, IS_BINARY);
- } else {
- convert_to_explicit_type(haystack, str_type);
- convert_to_explicit_type(needle, str_type);
+ return;
}
+ convert_to_explicit_type(haystack, str_type);
+ convert_to_explicit_type(needle, str_type);
}
needle_len = Z_UNILEN_P(needle);
if (Z_TYPE_P(haystack) == IS_UNICODE) {
@@ -2519,19 +2460,17 @@ PHP_FUNCTION(strrpos)
RETURN_FALSE;
}
- if (Z_TYPE_P(zhaystack) != IS_UNICODE && Z_TYPE_P(zhaystack) != IS_BINARY && Z_TYPE_P(zhaystack) != IS_STRING) {
+ if (Z_TYPE_P(zhaystack) != IS_UNICODE && Z_TYPE_P(zhaystack) != IS_STRING) {
convert_to_text(zhaystack);
}
- if (Z_TYPE_P(zneedle) == IS_UNICODE || Z_TYPE_P(zneedle) == IS_BINARY || Z_TYPE_P(zneedle) == IS_STRING) {
+ if (Z_TYPE_P(zneedle) == IS_UNICODE || Z_TYPE_P(zneedle) == IS_STRING) {
if (Z_TYPE_P(zneedle) != Z_TYPE_P(zhaystack)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zhaystack), Z_TYPE_P(zneedle));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type(zhaystack, IS_BINARY);
- convert_to_explicit_type(zneedle, IS_BINARY);
- } else {
- convert_to_explicit_type(zhaystack, str_type);
- convert_to_explicit_type(zneedle, str_type);
+ return;
}
+ convert_to_explicit_type(zhaystack, str_type);
+ convert_to_explicit_type(zneedle, str_type);
}
needle = Z_UNIVAL_P(zneedle);
needle_len = Z_UNILEN_P(zneedle);
@@ -2743,20 +2682,18 @@ PHP_FUNCTION(strrchr)
if (ZEND_NUM_ARGS() != 2 || zend_parse_parameters(2 TSRMLS_CC, "zz", &haystack, &needle) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_P(haystack) != IS_UNICODE || Z_TYPE_P(haystack) != IS_BINARY || Z_TYPE_P(haystack) != IS_STRING) {
+ if (Z_TYPE_P(haystack) != IS_UNICODE || Z_TYPE_P(haystack) != IS_STRING) {
convert_to_string(haystack);
}
- if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_BINARY || Z_TYPE_P(needle) == IS_STRING) {
+ if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
if (Z_TYPE_P(needle) != Z_TYPE_P(haystack)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type(haystack, IS_BINARY);
- convert_to_explicit_type(needle, IS_BINARY);
- } else {
- convert_to_explicit_type(haystack, str_type);
- convert_to_explicit_type(needle, str_type);
+ return;
}
+ convert_to_explicit_type(haystack, str_type);
+ convert_to_explicit_type(needle, str_type);
}
if (Z_TYPE_P(haystack) == IS_UNICODE) {
U16_GET(Z_USTRVAL_P(needle), 0, 0, Z_USTRLEN_P(needle), ch);
@@ -2783,11 +2720,7 @@ PHP_FUNCTION(strrchr)
RETURN_UNICODEL((UChar *)found, Z_USTRLEN_P(haystack) - found_offset, 1);
} else {
found_offset = (char *)found - Z_STRVAL_P(haystack);
- if (Z_TYPE_P(haystack) == IS_BINARY) {
- RETURN_BINARYL((char *)found, Z_BINLEN_P(haystack) - found_offset, 1);
- } else {
- RETURN_STRINGL((char *)found, Z_STRLEN_P(haystack) - found_offset, 1);
- }
+ RETURN_STRINGL((char *)found, Z_STRLEN_P(haystack) - found_offset, 1);
}
} else {
RETURN_FALSE;
@@ -3069,11 +3002,11 @@ PHP_FUNCTION(substr_replace)
}
if (Z_TYPE_PP(str) != IS_ARRAY && Z_TYPE_PP(str) != IS_UNICODE &&
- Z_TYPE_PP(str) != IS_BINARY && Z_TYPE_PP(str) != IS_STRING) {
+ Z_TYPE_PP(str) != IS_STRING) {
convert_to_text_ex(str);
}
if (Z_TYPE_PP(repl) != IS_ARRAY && Z_TYPE_PP(repl) != IS_UNICODE &&
- Z_TYPE_PP(repl) != IS_BINARY && Z_TYPE_PP(repl) != IS_STRING) {
+ Z_TYPE_PP(repl) != IS_STRING) {
convert_to_text_ex(repl);
}
if (Z_TYPE_PP(from) != IS_ARRAY) {
@@ -3111,7 +3044,7 @@ PHP_FUNCTION(substr_replace)
if (Z_TYPE_PP(repl) == IS_ARRAY) {
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl);
if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) {
- if (Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_BINARY && Z_TYPE_PP(repl) != IS_STRING) {
+ if (Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_STRING) {
convert_to_text_ex(tmp_repl);
}
} else {
@@ -3124,20 +3057,16 @@ PHP_FUNCTION(substr_replace)
if (tmp_repl && Z_TYPE_PP(str) != Z_TYPE_PP(tmp_repl)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(str), Z_TYPE_PP(tmp_repl));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type_ex(str, IS_BINARY);
- convert_to_explicit_type_ex(tmp_repl, IS_BINARY);
- } else {
- convert_to_explicit_type_ex(str, str_type);
- convert_to_explicit_type_ex(tmp_repl, str_type);
+ return;
}
+ convert_to_explicit_type_ex(str, str_type);
+ convert_to_explicit_type_ex(tmp_repl, str_type);
}
php_adjust_limits(str, &f, &l);
result_len = php_do_substr_replace(&result, str, tmp_repl, f, l TSRMLS_CC);
if (Z_TYPE_PP(str) == IS_UNICODE) {
RETURN_UNICODEL((UChar *)result, result_len, 0);
- } else if (Z_TYPE_PP(str) == IS_BINARY) {
- RETURN_BINARYL((char *)result, result_len, 0);
} else {
RETURN_STRINGL((char *)result, result_len, 0);
}
@@ -3160,7 +3089,7 @@ PHP_FUNCTION(substr_replace)
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(str), &pos_str);
while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(str), (void **) &tmp_str, &pos_str) == SUCCESS) {
- if (Z_TYPE_PP(tmp_str) != IS_UNICODE && Z_TYPE_PP(tmp_str) != IS_BINARY && Z_TYPE_PP(tmp_str) != IS_STRING) {
+ if (Z_TYPE_PP(tmp_str) != IS_UNICODE && Z_TYPE_PP(tmp_str) != IS_STRING && Z_TYPE_PP(tmp_str) != IS_STRING) {
convert_to_text_ex(tmp_str);
}
@@ -3191,7 +3120,7 @@ PHP_FUNCTION(substr_replace)
if (Z_TYPE_PP(repl) == IS_ARRAY) {
if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) {
- if (Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_BINARY && Z_TYPE_PP(repl) != IS_STRING) {
+ if (Z_TYPE_PP(repl) != IS_UNICODE && Z_TYPE_PP(repl) != IS_STRING && Z_TYPE_PP(repl) != IS_STRING) {
convert_to_text_ex(tmp_repl);
}
zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl);
@@ -3205,20 +3134,16 @@ PHP_FUNCTION(substr_replace)
if (tmp_repl && Z_TYPE_PP(tmp_str) != Z_TYPE_PP(tmp_repl)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(tmp_str), Z_TYPE_PP(tmp_repl));
if (str_type == (zend_uchar)-1) {
- convert_to_explicit_type_ex(tmp_str, IS_BINARY);
- convert_to_explicit_type_ex(tmp_repl, IS_BINARY);
- } else {
- convert_to_explicit_type_ex(tmp_str, str_type);
- convert_to_explicit_type_ex(tmp_repl, str_type);
+ return;
}
+ convert_to_explicit_type_ex(tmp_str, str_type);
+ convert_to_explicit_type_ex(tmp_repl, str_type);
}
php_adjust_limits(tmp_str, &f, &l);
result_len = php_do_substr_replace(&result, tmp_str, tmp_repl, f, l TSRMLS_CC);
if (Z_TYPE_PP(tmp_str) == IS_UNICODE) {
add_next_index_unicodel(return_value, (UChar *)result, result_len, 0);
- } else if (Z_TYPE_PP(tmp_str) == IS_BINARY) {
- add_next_index_binaryl(return_value, (char *)result, result_len, 0);
} else {
add_next_index_stringl(return_value, (char *)result, result_len, 0);
}
@@ -3293,10 +3218,6 @@ PHP_FUNCTION(ord)
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(str) == IS_BINARY) {
- RETURN_LONG((unsigned char) Z_STRVAL_PP(str)[0]);
- }
-
convert_to_text_ex(str);
if (Z_TYPE_PP(str) == IS_UNICODE) {
RETURN_LONG(zend_get_codepoint_at(Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 0));
@@ -3380,14 +3301,12 @@ PHP_FUNCTION(ucfirst)
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_BINARY && Z_TYPE_PP(str) != IS_STRING) {
+ if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) {
convert_to_text_ex(str);
}
if (Z_TYPE_PP(str) == IS_UNICODE && !Z_USTRLEN_PP(str)) {
RETURN_EMPTY_UNICODE();
- } else if (Z_TYPE_PP(str) == IS_BINARY && !Z_BINLEN_PP(str)) {
- RETURN_EMPTY_BINARY();
} else if (!Z_STRLEN_PP(str)) {
RETURN_EMPTY_STRING();
}
@@ -3395,9 +3314,6 @@ PHP_FUNCTION(ucfirst)
if (Z_TYPE_PP(str) == IS_UNICODE) {
Z_TYPE_P(return_value) = IS_UNICODE;
php_u_ucfirst(*str, return_value);
- } else if (Z_TYPE_PP(str) == IS_BINARY) {
- ZVAL_BINARYL(return_value, Z_BINVAL_PP(str), Z_BINLEN_PP(str), 1);
- *Z_BINVAL_P(return_value) = toupper((unsigned char) *Z_BINVAL_P(return_value));
} else {
ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
*Z_STRVAL_P(return_value) = toupper((unsigned char) *Z_STRVAL_P(return_value));
@@ -3463,14 +3379,12 @@ PHP_FUNCTION(ucwords)
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_BINARY && Z_TYPE_PP(str) != IS_STRING) {
+ if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) {
convert_to_text_ex(str);
}
if (Z_TYPE_PP(str) == IS_UNICODE && !Z_USTRLEN_PP(str)) {
RETURN_EMPTY_UNICODE();
- } else if (Z_TYPE_PP(str) == IS_BINARY && !Z_BINLEN_PP(str)) {
- RETURN_EMPTY_BINARY();
} else if (!Z_STRLEN_PP(str)) {
RETURN_EMPTY_STRING();
}
@@ -3479,11 +3393,7 @@ PHP_FUNCTION(ucwords)
Z_TYPE_P(return_value) = IS_UNICODE;
php_u_ucwords(*str, return_value);
} else {
- if (Z_TYPE_PP(str) == IS_BINARY) {
- ZVAL_BINARYL(return_value, Z_BINVAL_PP(str), Z_BINLEN_PP(str), 1);
- } else {
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
+ ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
r = Z_STRVAL_P(return_value);
*r = toupper((unsigned char) *r);
@@ -3685,7 +3595,7 @@ PHP_FUNCTION(strrev)
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_BINARY && Z_TYPE_PP(str) != IS_STRING) {
+ if (Z_TYPE_PP(str) != IS_UNICODE && Z_TYPE_PP(str) != IS_STRING) {
convert_to_text_ex(str);
}
@@ -3726,8 +3636,6 @@ PHP_FUNCTION(strrev)
if (Z_TYPE_PP(str) == IS_UNICODE) {
RETVAL_UNICODEL(u_n, Z_USTRLEN_PP(str), 0);
- } else if (Z_TYPE_PP(str) == IS_BINARY) {
- RETVAL_BINARYL(n, Z_BINLEN_PP(str), 0);
} else {
RETVAL_STRINGL(n, Z_STRLEN_PP(str), 0);
}
@@ -3849,20 +3757,18 @@ PHP_FUNCTION(similar_text)
if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &t1, &t2, &percent) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(t1) != IS_UNICODE && Z_TYPE_PP(t1) != IS_BINARY && Z_TYPE_PP(t1) != IS_STRING) {
+ if (Z_TYPE_PP(t1) != IS_UNICODE && Z_TYPE_PP(t1) != IS_STRING) {
convert_to_text_ex(t1);
}
- if (Z_TYPE_PP(t2) != IS_UNICODE && Z_TYPE_PP(t2) != IS_BINARY && Z_TYPE_PP(t2) != IS_STRING) {
+ if (Z_TYPE_PP(t2) != IS_UNICODE && Z_TYPE_PP(t2) != IS_STRING) {
convert_to_text_ex(t2);
}
str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(t1), Z_TYPE_PP(t2));
if (str_type == (zend_uchar)-1) {
- convert_to_binary_ex(t1);
- convert_to_binary_ex(t2);
- } else {
- convert_to_explicit_type_ex(t1, str_type);
- convert_to_explicit_type_ex(t2, str_type);
+ return;
}
+ convert_to_explicit_type_ex(t1, str_type);
+ convert_to_explicit_type_ex(t2, str_type);
if (ac > 2) {
convert_to_double_ex(percent);
}
@@ -4067,8 +3973,6 @@ PHP_FUNCTION(addslashes)
if (Z_TYPE_PP(str) == IS_UNICODE && Z_USTRLEN_PP(str) == 0) {
RETURN_EMPTY_UNICODE();
- } else if (Z_TYPE_PP(str) == IS_BINARY && Z_BINLEN_PP(str) == 0) {
- RETURN_EMPTY_BINARY();
} else if (Z_TYPE_PP(str) == IS_STRING && Z_STRLEN_PP(str) == 0) {
RETURN_EMPTY_STRING();
}
@@ -4080,11 +3984,7 @@ PHP_FUNCTION(addslashes)
} else {
tmp = (char *)php_addslashes(Z_STRVAL_PP(str), Z_STRLEN_PP(str),
&tmp_len, 0 TSRMLS_CC);
- if (Z_TYPE_PP(str) == IS_BINARY) {
- RETURN_BINARYL((char *)tmp, tmp_len, 0);
- } else {
- RETURN_STRINGL((char *)tmp, tmp_len, 0);
- }
+ RETURN_STRINGL((char *)tmp, tmp_len, 0);
}
}
/* }}} */
@@ -4120,11 +4020,7 @@ PHP_FUNCTION(stripslashes)
ZVAL_UNICODEL(return_value, Z_USTRVAL_PP(str), Z_USTRLEN_PP(str), 1);
php_u_stripslashes(Z_USTRVAL_P(return_value), &Z_USTRLEN_P(return_value) TSRMLS_CC);
} else {
- if (Z_TYPE_PP(str) == IS_BINARY) {
- ZVAL_BINARYL(return_value, Z_BINVAL_PP(str), Z_BINLEN_PP(str), 1);
- } else {
- ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
- }
+ ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC);
}
}
@@ -5146,11 +5042,7 @@ PHP_FUNCTION(strip_tags)
} else {
buf = estrndup(str, str_len);
retval_len = php_strip_tags((char *)buf, str_len, NULL, (char *)allow, allow_len);
- if (str_type == IS_BINARY) {
- RETURN_BINARYL((char *)buf, retval_len, 0);
- } else {
- RETURN_STRINGL((char *)buf, retval_len, 0);
- }
+ RETURN_STRINGL((char *)buf, retval_len, 0);
}
}
/* }}} */
@@ -5905,10 +5797,8 @@ PHP_FUNCTION(str_repeat)
if ( input_str_chars == 0 || mult == 0 ) {
if ( input_str_type == IS_UNICODE ) {
RETURN_UNICODEL(USTR_MAKE(""), 0, 0);
- } else if ( input_str_type == IS_STRING ) {
- RETURN_STRINGL("", 0, 1);
} else {
- RETURN_BINARYL("", 0, 1);
+ RETURN_STRINGL("", 0, 1);
}
}
@@ -5958,11 +5848,7 @@ PHP_FUNCTION(str_repeat)
RETURN_UNICODEL((UChar *)result, result_chars-1, 0);
} else {
*(((char *)result)+result_chars-1) = '\0';
- if ( input_str_type == IS_BINARY ) {
- RETURN_BINARYL((char *)result, result_chars-1, 0);
- } else {
- RETURN_STRINGL((char *)result, result_chars-1, 0);
- }
+ RETURN_STRINGL((char *)result, result_chars-1, 0);
}
}
/* }}} */
@@ -6306,8 +6192,6 @@ PHP_FUNCTION(str_pad)
if (num_pad_chars < 0) {
if (input_type == IS_UNICODE) {
RETURN_UNICODEL((UChar *)input, input_len, 1);
- } else if (input_type == IS_BINARY) {
- RETURN_BINARYL((char *)input, input_len, 1);
} else {
RETURN_STRINGL((char *)input, input_len, 1);
}
@@ -6396,8 +6280,6 @@ PHP_FUNCTION(str_pad)
efree(padstr);
}
RETURN_UNICODEL((UChar *)result, result_len, 0);
- } else if (input_type == IS_BINARY) {
- RETURN_BINARYL((char *)result, result_len, 0);
} else {
RETURN_STRINGL((char *)result, result_len, 0);
}
@@ -6683,8 +6565,6 @@ PHP_FUNCTION(strpbrk)
if (p) {
if (haystack_type == IS_UNICODE) {
RETURN_UNICODEL((UChar *)p, ((UChar *)haystack + haystack_len - (UChar *)p), 1);
- } else if (haystack_type == IS_BINARY) {
- RETURN_BINARYL((char *)p, ((char *)haystack + haystack_len - (char *)p), 1);
} else {
RETURN_STRINGL((char *)p, ((char *)haystack + haystack_len - (char *)p), 1);
}
diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt
index bb633c334d..5b76e15f42 100644
--- a/ext/standard/tests/general_functions/008.phpt
+++ b/ext/standard/tests/general_functions/008.phpt
@@ -37,4 +37,35 @@ array(14) {
float(1234567890120)
[13]=>
float(1.23456789012E+19)
-} \ No newline at end of file
+}
+--UEXPECT--
+array(14) {
+ [0]=>
+ unicode(2) "12"
+ [1]=>
+ float(0.012)
+ [2]=>
+ float(-0.012)
+ [3]=>
+ float(0.12)
+ [4]=>
+ float(-0.12)
+ [5]=>
+ float(1.2)
+ [6]=>
+ float(-1.2)
+ [7]=>
+ float(12)
+ [8]=>
+ float(-12)
+ [9]=>
+ float(0.000123)
+ [10]=>
+ float(1.23E-5)
+ [11]=>
+ float(123456789012)
+ [12]=>
+ float(1234567890120)
+ [13]=>
+ float(1.23456789012E+19)
+}
diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt
index aaeb8e865c..acf0321f17 100644
--- a/ext/standard/tests/math/bug21523.phpt
+++ b/ext/standard/tests/math/bug21523.phpt
@@ -9,3 +9,6 @@ echo "OK";
--EXPECT--
string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
OK
+--UEXPECT--
+unicode(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+OK
diff --git a/ext/standard/tests/strings/bug22187.phpt b/ext/standard/tests/strings/bug22187.phpt
index dccaccc04d..2e00043eeb 100644
--- a/ext/standard/tests/strings/bug22187.phpt
+++ b/ext/standard/tests/strings/bug22187.phpt
@@ -8,3 +8,6 @@ Bug #22187 (possible crash in number_format() function)
--EXPECT--
string(3) "0.0"
string(1) "0"
+--UEXPECT--
+unicode(3) "0.0"
+unicode(1) "0"
diff --git a/ext/standard/tests/strings/strval.phpt b/ext/standard/tests/strings/strval.phpt
index 3f8b5cc985..339057b986 100644
--- a/ext/standard/tests/strings/strval.phpt
+++ b/ext/standard/tests/strings/strval.phpt
@@ -22,3 +22,12 @@ string(3) "1.1"
string(1) "1"
string(0) ""
string(5) "Array"
+--UEXPECT--
+unicode(3) "bar"
+unicode(3) "BAR"
+unicode(6) "foobar"
+unicode(1) "1"
+unicode(3) "1.1"
+unicode(1) "1"
+unicode(0) ""
+unicode(5) "Array"
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 6cb7843c44..a50b3cb45d 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -52,10 +52,6 @@ PHP_FUNCTION(gettype)
RETVAL_ASCII_STRING("string", 1);
break;
- case IS_BINARY:
- RETVAL_ASCII_STRING("binary", 1);
- break;
-
case IS_UNICODE:
RETVAL_ASCII_STRING("unicode", 1);
break;
@@ -199,7 +195,11 @@ PHP_FUNCTION(strval)
WRONG_PARAM_COUNT;
}
- zend_make_printable_zval(*num, &expr_copy, &use_copy);
+ if (UG(unicode)) {
+ zend_make_unicode_zval(*num, &expr_copy, &use_copy);
+ } else {
+ zend_make_printable_zval(*num, &expr_copy, &use_copy);
+ }
if (use_copy) {
tmp = &expr_copy;
RETVAL_ZVAL(tmp, 0, 0);
@@ -300,14 +300,6 @@ PHP_FUNCTION(is_unicode)
}
/* }}} */
-/* {{{ proto bool is_binary(mixed var)
- Returns true if variable is a binary string */
-PHP_FUNCTION(is_binary)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BINARY);
-}
-/* }}} */
-
/* {{{ proto bool is_buffer(mixed var)
Returns true if variable is a native, unicode or binary string */
PHP_FUNCTION(is_buffer)
@@ -319,7 +311,7 @@ PHP_FUNCTION(is_buffer)
RETURN_FALSE;
}
- if (Z_TYPE_PP(arg) == IS_STRING || Z_TYPE_PP(arg) == IS_UNICODE || Z_TYPE_PP(arg) == IS_BINARY) {
+ if (Z_TYPE_PP(arg) == IS_STRING || Z_TYPE_PP(arg) == IS_UNICODE) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -399,7 +391,6 @@ PHP_FUNCTION(is_scalar)
case IS_DOUBLE:
case IS_LONG:
case IS_STRING:
- case IS_BINARY:
case IS_UNICODE:
RETURN_TRUE;
break;
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 31cbfaeb9a..990ab60423 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -122,7 +122,7 @@ static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
return;
}
- ZVAL_STRINGL(&func_name, "onclose", sizeof("onclose")-1, 0);
+ ZVAL_ASCII_STRINGL(&func_name, "onclose", sizeof("onclose")-1, 1);
call_user_function_ex(NULL,
&obj,
@@ -130,6 +130,7 @@ static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
&retval,
0, NULL,
0, NULL TSRMLS_CC);
+ zval_dtor(&func_name);
if (retval)
zval_ptr_dtor(&retval);
@@ -164,7 +165,7 @@ php_stream_filter_status_t userfilter_filter(
zval_ptr_dtor(&zstream);
}
- ZVAL_STRINGL(&func_name, "filter", sizeof("filter")-1, 0);
+ ZVAL_ASCII_STRINGL(&func_name, "filter", sizeof("filter")-1, 1);
/* Setup calling arguments */
ALLOC_INIT_ZVAL(zin);
@@ -189,6 +190,7 @@ php_stream_filter_status_t userfilter_filter(
&retval,
4, args,
0, NULL TSRMLS_CC);
+ zval_dtor(&func_name);
if (call_result == SUCCESS && retval != NULL) {
convert_to_long(retval);
@@ -304,7 +306,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
}
/* invoke the constructor */
- ZVAL_STRINGL(&func_name, "oncreate", sizeof("oncreate")-1, 0);
+ ZVAL_ASCII_STRINGL(&func_name, "oncreate", sizeof("oncreate")-1, 1);
call_user_function_ex(NULL,
&obj,
@@ -312,6 +314,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
&retval,
0, NULL,
0, NULL TSRMLS_CC);
+ zval_dtor(&func_name);
if (retval) {
if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
@@ -374,12 +377,8 @@ PHP_FUNCTION(stream_bucket_make_writeable)
/* add_property_zval increments the refcount which is unwanted here */
zval_ptr_dtor(&zbucket);
if (bucket->is_unicode) {
- zval *unicode_data;
-
- ALLOC_INIT_ZVAL(unicode_data);
- ZVAL_UNICODEL(unicode_data, bucket->buf.ustr.val, bucket->buf.ustr.len, 1);
- add_property_zval(return_value, "data", unicode_data);
- add_property_long(return_value, "datalen", bucket->buf.str.len);
+ add_property_unicodel(return_value, "data", bucket->buf.ustr.val, bucket->buf.ustr.len, 1);
+ add_property_long(return_value, "datalen", bucket->buf.ustr.len);
} else {
add_property_stringl(return_value, "data", bucket->buf.str.val, bucket->buf.str.len, 1);
add_property_long(return_value, "datalen", bucket->buf.str.len);
diff --git a/ext/standard/var.c b/ext/standard/var.c
index e132c1d511..62556d8ad4 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -132,10 +132,6 @@ static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_ha
php_printf("\"");
PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
php_printf("\"");
- } else if (hash_key->type == IS_BINARY) {
- php_printf("b\"");
- PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
- php_printf("\"");
} else if (hash_key->type == IS_UNICODE) {
php_printf("u");
php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, verbose, "\"", 0 TSRMLS_CC);
@@ -209,11 +205,6 @@ PHPAPI void php_var_dump(zval **struc, int level, int verbose TSRMLS_DC)
PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
PUTS("\"\n");
break;
- case IS_BINARY:
- php_printf("%sbinary(%d) \"", COMMON, Z_STRLEN_PP(struc));
- PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- PUTS("\"\n");
- break;
case IS_UNICODE:
php_printf("%sunicode(%d) ", COMMON, u_countChar32((*struc)->value.ustr.val, (*struc)->value.ustr.len));
php_var_dump_unicode((*struc)->value.ustr.val, (*struc)->value.ustr.len, verbose, "\"", 0 TSRMLS_CC);
@@ -337,10 +328,6 @@ static int zval_array_element_dump(zval **zv, int num_args, va_list args, zend_h
php_printf("\"");
PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
php_printf("\"");
- } else if (hash_key->type == IS_BINARY) {
- php_printf("b\"");
- PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1);
- php_printf("\"");
} else if (hash_key->type == IS_UNICODE) {
php_printf("u");
php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, 1, "\"", 0 TSRMLS_CC);
@@ -380,11 +367,6 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level, int verbose TSRMLS_DC)
PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc));
break;
- case IS_BINARY:
- php_printf("%sbinary(%d) \"", COMMON, Z_STRLEN_PP(struc));
- PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc));
- break;
case IS_UNICODE:
php_printf("%sunicode(%d) ", COMMON, u_countChar32((*struc)->value.ustr.val, (*struc)->value.ustr.len));
php_var_dump_unicode((*struc)->value.ustr.val, (*struc)->value.ustr.len, verbose, "\"", 0 TSRMLS_CC);
@@ -525,8 +507,6 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
case IS_DOUBLE:
php_printf("%.*G", (int) EG(precision), Z_DVAL_PP(struc));
break;
- case IS_BINARY:
- PUTS ("b");
case IS_STRING:
tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC);
PUTS ("'");
@@ -657,15 +637,6 @@ static inline void php_var_serialize_string(smart_str *buf, char *str, int len)
smart_str_appendl(buf, "\";", 2);
}
-static inline void php_var_serialize_binary(smart_str *buf, char *str, int len)
-{
- smart_str_appendl(buf, "B:", 2);
- smart_str_append_long(buf, len);
- smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, str, len);
- smart_str_appendl(buf, "\";", 2);
-}
-
static inline void php_var_serialize_ustr(smart_str *buf, UChar *ustr, int len)
{
static const char hex[] = "0123456789abcdef";
@@ -874,10 +845,6 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
php_var_serialize_string(buf, Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
return;
- case IS_BINARY:
- php_var_serialize_binary(buf, Z_STRVAL_PP(struc), Z_STRLEN_PP(struc));
- return;
-
case IS_UNICODE:
php_var_serialize_unicode(buf, Z_USTRVAL_PP(struc), Z_USTRLEN_PP(struc));
return;
@@ -920,10 +887,10 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
if (ce && ce != PHP_IC_ENTRY &&
zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep"))) {
INIT_PZVAL(&fname);
- ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
+ ZVAL_ASCII_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 1);
res = call_user_function_ex(CG(function_table), struc, &fname,
&retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
-
+ zval_dtor(&fname);
if (res == SUCCESS && !EG(exception)) {
if (retval_ptr) {
if (HASH_OF(retval_ptr)) {
@@ -990,9 +957,6 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
case HASH_KEY_IS_STRING:
php_var_serialize_string(buf, key, key_len - 1);
break;
- case HASH_KEY_IS_BINARY:
- php_var_serialize_binary(buf, key, key_len - 1);
- break;
case HASH_KEY_IS_UNICODE:
php_var_serialize_unicode(buf, (UChar*)key, key_len - 1);
break;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index cc48551406..9aa716bbbf 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -332,8 +332,9 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
if (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&
zend_hash_exists(&Z_OBJCE_PP(rval)->function_table, "__wakeup", sizeof("__wakeup"))) {
INIT_PZVAL(&fname);
- ZVAL_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 0);
+ ZVAL_ASCII_STRINGL(&fname, "__wakeup", sizeof("__wakeup") - 1, 1);
call_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
+ zval_dtor(&fname);
}
if (retval_ptr)
diff --git a/ext/tokenizer/tests/002.phpt b/ext/tokenizer/tests/002.phpt
index 921d633e08..a5db16254d 100644
--- a/ext/tokenizer/tests/002.phpt
+++ b/ext/tokenizer/tests/002.phpt
@@ -24,35 +24,35 @@ array(49) {
[0]=>
array(2) {
[0]=>
- int(369)
+ int(368)
[1]=>
string(2) "<?"
}
[1]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[2]=>
array(2) {
[0]=>
- int(318)
+ int(317)
[1]=>
string(4) "echo"
}
[3]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[4]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "1"
}
@@ -61,21 +61,21 @@ array(49) {
[6]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[7]=>
array(2) {
[0]=>
- int(303)
+ int(302)
[1]=>
string(2) "if"
}
[8]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -84,7 +84,7 @@ array(49) {
[10]=>
array(2) {
[0]=>
- int(351)
+ int(350)
[1]=>
string(5) "isset"
}
@@ -93,7 +93,7 @@ array(49) {
[12]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
@@ -104,7 +104,7 @@ array(49) {
[15]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -118,14 +118,14 @@ array(49) {
[17]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[18]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
@@ -134,7 +134,7 @@ array(49) {
[20]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "1"
}
@@ -143,21 +143,21 @@ array(49) {
[22]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[23]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
[24]=>
array(2) {
[0]=>
- int(299)
+ int(298)
[1]=>
string(2) "++"
}
@@ -166,21 +166,21 @@ array(49) {
[26]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[27]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
[28]=>
array(2) {
[0]=>
- int(298)
+ int(297)
[1]=>
string(2) "--"
}
@@ -189,21 +189,21 @@ array(49) {
[30]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[31]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
[32]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -217,14 +217,14 @@ array(49) {
[34]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[35]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
@@ -233,21 +233,21 @@ array(49) {
[37]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[38]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
[39]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -261,14 +261,14 @@ array(49) {
[41]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[42]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
@@ -277,14 +277,14 @@ array(49) {
[44]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[45]=>
array(2) {
[0]=>
- int(306)
+ int(305)
[1]=>
string(5) "endif"
}
@@ -293,14 +293,14 @@ array(49) {
[47]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[48]=>
array(2) {
[0]=>
- int(371)
+ int(370)
[1]=>
string(2) "?>"
}
@@ -309,14 +309,14 @@ array(37) {
[0]=>
array(2) {
[0]=>
- int(369)
+ int(368)
[1]=>
string(6) "<?php "
}
[1]=>
array(2) {
[0]=>
- int(329)
+ int(328)
[1]=>
string(6) "switch"
}
@@ -325,7 +325,7 @@ array(37) {
[3]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
@@ -334,7 +334,7 @@ array(37) {
[5]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -343,28 +343,28 @@ array(37) {
[7]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[8]=>
array(2) {
[0]=>
- int(331)
+ int(330)
[1]=>
string(4) "case"
}
[9]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[10]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "1"
}
@@ -373,14 +373,14 @@ array(37) {
[12]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[13]=>
array(2) {
[0]=>
- int(333)
+ int(332)
[1]=>
string(5) "break"
}
@@ -389,14 +389,14 @@ array(37) {
[15]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[16]=>
array(2) {
[0]=>
- int(332)
+ int(331)
[1]=>
string(7) "default"
}
@@ -405,14 +405,14 @@ array(37) {
[18]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[19]=>
array(2) {
[0]=>
- int(333)
+ int(332)
[1]=>
string(5) "break"
}
@@ -421,7 +421,7 @@ array(37) {
[21]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -430,14 +430,14 @@ array(37) {
[23]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[24]=>
array(2) {
[0]=>
- int(320)
+ int(319)
[1]=>
string(5) "while"
}
@@ -446,7 +446,7 @@ array(37) {
[26]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
@@ -455,7 +455,7 @@ array(37) {
[28]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -464,14 +464,14 @@ array(37) {
[30]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[31]=>
array(2) {
[0]=>
- int(302)
+ int(301)
[1]=>
string(4) "exit"
}
@@ -480,7 +480,7 @@ array(37) {
[33]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -489,14 +489,14 @@ array(37) {
[35]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[36]=>
array(2) {
[0]=>
- int(371)
+ int(370)
[1]=>
string(2) "?>"
}
@@ -505,42 +505,42 @@ array(48) {
[0]=>
array(2) {
[0]=>
- int(369)
+ int(368)
[1]=>
string(2) "<?"
}
[1]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[2]=>
array(2) {
[0]=>
- int(367)
+ int(366)
[1]=>
string(13) "/* comment */"
}
[3]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[4]=>
array(2) {
[0]=>
- int(303)
+ int(302)
[1]=>
string(2) "if"
}
[5]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -549,14 +549,14 @@ array(48) {
[7]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "1"
}
[8]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -570,14 +570,14 @@ array(48) {
[10]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[11]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
@@ -586,7 +586,7 @@ array(48) {
[13]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -595,7 +595,7 @@ array(48) {
[15]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -604,21 +604,21 @@ array(48) {
[17]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[18]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
[19]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -627,21 +627,21 @@ array(48) {
[21]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[22]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
[23]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -650,14 +650,14 @@ array(48) {
[25]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[26]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "1"
}
@@ -666,21 +666,21 @@ array(48) {
[28]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[29]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$b"
}
[30]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -689,14 +689,14 @@ array(48) {
[32]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[33]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "3"
}
@@ -705,7 +705,7 @@ array(48) {
[35]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
@@ -714,21 +714,21 @@ array(48) {
[37]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[38]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$c"
}
[39]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
@@ -737,14 +737,14 @@ array(48) {
[41]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[42]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "4"
}
@@ -753,7 +753,7 @@ array(48) {
[44]=>
array(2) {
[0]=>
- int(307)
+ int(306)
[1]=>
string(1) "2"
}
@@ -762,14 +762,14 @@ array(48) {
[46]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) " "
}
[47]=>
array(2) {
[0]=>
- int(371)
+ int(370)
[1]=>
string(2) "?>"
}
@@ -778,7 +778,7 @@ array(1) {
[0]=>
array(2) {
[0]=>
- int(313)
+ int(312)
[1]=>
string(17) "wrong syntax here"
}
diff --git a/ext/tokenizer/tests/003.phpt b/ext/tokenizer/tests/003.phpt
index 1ff8371f1b..88b458a720 100644
--- a/ext/tokenizer/tests/003.phpt
+++ b/ext/tokenizer/tests/003.phpt
@@ -25,7 +25,7 @@ array(1) {
[0]=>
array(2) {
[0]=>
- int(313)
+ int(312)
[1]=>
string(1) "0"
}
@@ -34,7 +34,7 @@ array(1) {
[0]=>
array(2) {
[0]=>
- int(313)
+ int(312)
[1]=>
string(2) "-1"
}
diff --git a/ext/tokenizer/tests/bug26463.phpt b/ext/tokenizer/tests/bug26463.phpt
index 195aeceffe..a290a6e418 100644
--- a/ext/tokenizer/tests/bug26463.phpt
+++ b/ext/tokenizer/tests/bug26463.phpt
@@ -15,12 +15,12 @@ DDDD;
?>';
var_dump(token_get_all($str));
?>
---EXPECTF--
+--EXPECT--
array(19) {
[0]=>
array(2) {
[0]=>
- int(369)
+ int(368)
[1]=>
string(6) "<?php
"
@@ -28,7 +28,7 @@ array(19) {
[1]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$x"
}
@@ -37,7 +37,7 @@ array(19) {
[3]=>
array(2) {
[0]=>
- int(373)
+ int(372)
[1]=>
string(6) "<<<DD
"
@@ -45,7 +45,7 @@ array(19) {
[4]=>
array(2) {
[0]=>
- int(309)
+ int(308)
[1]=>
string(13) "jhdsjkfhjdsh
"
@@ -53,14 +53,14 @@ array(19) {
[5]=>
array(2) {
[0]=>
- int(374)
+ int(373)
[1]=>
string(2) "DD"
}
[6]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) "
"
@@ -70,7 +70,7 @@ array(19) {
[8]=>
array(2) {
[0]=>
- int(317)
+ int(316)
[1]=>
string(2) """"
}
@@ -79,7 +79,7 @@ array(19) {
[10]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) "
"
@@ -87,7 +87,7 @@ array(19) {
[11]=>
array(2) {
[0]=>
- int(311)
+ int(310)
[1]=>
string(2) "$a"
}
@@ -96,7 +96,7 @@ array(19) {
[13]=>
array(2) {
[0]=>
- int(373)
+ int(372)
[1]=>
string(8) "<<<DDDD
"
@@ -104,7 +104,7 @@ array(19) {
[14]=>
array(2) {
[0]=>
- int(309)
+ int(308)
[1]=>
string(13) "jhdsjkfhjdsh
"
@@ -112,7 +112,7 @@ array(19) {
[15]=>
array(2) {
[0]=>
- int(374)
+ int(373)
[1]=>
string(4) "DDDD"
}
@@ -121,7 +121,7 @@ array(19) {
[17]=>
array(2) {
[0]=>
- int(372)
+ int(371)
[1]=>
string(1) "
"
@@ -129,7 +129,7 @@ array(19) {
[18]=>
array(2) {
[0]=>
- int(371)
+ int(370)
[1]=>
string(2) "?>"
}
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index e266bbcdbb..8a8704e170 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -388,7 +388,9 @@ static void xml_set_handler(zval **handler, zval **data)
/* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */
if (Z_TYPE_PP(data) != IS_ARRAY) {
- convert_to_string_ex(data);
+ TSRMLS_FETCH();
+
+ convert_to_text_ex(data);
}
zval_add_ref(data);
diff --git a/main/main.c b/main/main.c
index 829772d416..c1d5dbb632 100644
--- a/main/main.c
+++ b/main/main.c
@@ -694,7 +694,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
if (PG(track_errors) && module_initialized && EG(active_symbol_table)) {
zval *tmp;
ALLOC_INIT_ZVAL(tmp);
- ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
+ ZVAL_RT_STRINGL(tmp, buffer, buffer_len, 1);
zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *), NULL);
}
efree(buffer);
@@ -963,9 +963,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
ALLOC_ZVAL(tmp);
INIT_PZVAL(tmp);
- Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
- Z_STRLEN_P(tmp) = buffer_len;
- Z_TYPE_P(tmp) = IS_STRING;
+ ZVAL_RT_STRINGL(tmp, buffer, buffer_len, 1);
zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL);
}
efree(buffer);
diff --git a/main/output.c b/main/output.c
index 979f483adb..ccd5fa1e0c 100644
--- a/main/output.c
+++ b/main/output.c
@@ -226,7 +226,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
zval *z_status;
ALLOC_INIT_ZVAL(orig_buffer);
- ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
+ ZVAL_U_STRINGL(ZEND_U_CONVERTER(UG(output_encoding_conv)), orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
orig_buffer->is_ref=1;
@@ -704,7 +704,7 @@ PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC)
if (OG(ob_nesting_level)==0) {
return FAILURE;
}
- ZVAL_STRINGL(p, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
+ ZVAL_U_STRINGL(ZEND_U_CONVERTER(UG(output_encoding_conv)), p, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
return SUCCESS;
}
/* }}} */
diff --git a/main/php_variables.c b/main/php_variables.c
index fa25332b51..f59be9d86b 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -679,9 +679,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
int i;
for (i = 0; i < SG(request_info).argc; i++) {
ALLOC_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]);
- Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
+ ZVAL_RT_STRING(tmp, SG(request_info).argv[i], 1);
INIT_PZVAL(tmp);
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
if (Z_TYPE_P(tmp) == IS_STRING) {
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index ac5ad825db..35145ce88a 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -993,8 +993,9 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int op
return 0;
}
/* Clear stat cache */
- ZVAL_STRINGL(&funcname, "clearstatcache", sizeof("clearstatcache")-1, 0);
+ ZVAL_ASCII_STRINGL(&funcname, "clearstatcache", sizeof("clearstatcache")-1, 1);
call_user_function_ex(CG(function_table), NULL, &funcname, &retval, 0, NULL, 0, NULL TSRMLS_CC);
+ zval_dtor(&funcname);
if (retval) {
zval_ptr_dtor(&retval);
}
diff --git a/run-tests.php b/run-tests.php
index 065c12410e..c2052341b4 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1077,8 +1077,8 @@ TEST $file
$exp_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'exp';
$output_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'out';
$memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'mem';
- $temp_file = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'php';
- $test_file = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'php';
+ $temp_file = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt')/*.$pu*/.'php';
+ $test_file = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt')/*.$pu*/.'php';
$temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'skip.php';
$test_skipif = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'skip.php';
$temp_clean = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'clean.php';
diff --git a/tests/basic/bug29971.phpt b/tests/basic/bug29971.phpt
index d4b654bdb1..1d2bc0b1c6 100755
--- a/tests/basic/bug29971.phpt
+++ b/tests/basic/bug29971.phpt
@@ -13,3 +13,9 @@ array(0) {
array(0) {
}
string(3) "GPC"
+--UEXPECT--
+array(0) {
+}
+array(0) {
+}
+unicode(3) "GPC"
diff --git a/tests/func/006.phpt b/tests/func/006.phpt
index 077b6f873c..653ed53593 100644
--- a/tests/func/006.phpt
+++ b/tests/func/006.phpt
@@ -24,3 +24,6 @@ var_dump( $a ); // 1A
--EXPECT--
string(2) "2B"
string(2) "1A"
+--UEXPECT--
+unicode(2) "2B"
+unicode(2) "1A"
diff --git a/tests/lang/catchable_error_002.phpt b/tests/lang/catchable_error_002.phpt
index 53f443696f..4ea1d19fe6 100644
--- a/tests/lang/catchable_error_002.phpt
+++ b/tests/lang/catchable_error_002.phpt
@@ -35,3 +35,18 @@ array(5) {
}
}
ALIVE!
+--UEXPECTF--
+array(5) {
+ [0]=>
+ int(4096)
+ [1]=>
+ unicode(%d) "Argument 1 passed to blah() must be an instance of Foo, called in %scatchable_error_002.php on line 17 and defined"
+ [2]=>
+ unicode(%d) "%scatchable_error_002.php"
+ [3]=>
+ int(5)
+ [4]=>
+ array(0) {
+ }
+}
+ALIVE!
diff --git a/tests/run-test/test004.phpt b/tests/run-test/test004.phpt
index 19dbdede8c..8bf1f7b252 100644
--- a/tests/run-test/test004.phpt
+++ b/tests/run-test/test004.phpt
@@ -7,4 +7,6 @@ arg_separator.input==
var_dump(ini_get('arg_separator.input'));
?>
--EXPECT--
-string(1) "=" \ No newline at end of file
+string(1) "="
+--UEXPECT--
+unicode(1) "=" \ No newline at end of file
diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt
index d16a66ef7a..c502dd60a2 100644
--- a/tests/run-test/test005.phpt
+++ b/tests/run-test/test005.phpt
@@ -30,3 +30,11 @@ string(1) "1"
string(1) "0"
NULL
string(%d) "%sivision by zer%s"
+--UEXPECTF--
+unicode(1) "1"
+unicode(4) "8191"
+unicode(1) "0"
+unicode(1) "1"
+unicode(1) "0"
+NULL
+unicode(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt
index 14fff59bd8..3954eb5d89 100644
--- a/tests/run-test/test008.phpt
+++ b/tests/run-test/test008.phpt
@@ -31,3 +31,12 @@ string(1) "1"
string(1) "0"
string(%d) "%sivision by zer%s"
string(%d) "%sivision by zer%s"
+--UEXPECTF--
+%s: %sivision by zero in %s on line %d
+unicode(1) "1"
+unicode(4) "4095"
+unicode(1) "0"
+unicode(1) "1"
+unicode(1) "0"
+unicode(%d) "%sivision by zer%s"
+unicode(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt
index a7d360dc64..861247cd03 100644
--- a/tests/run-test/test008a.phpt
+++ b/tests/run-test/test008a.phpt
@@ -30,3 +30,11 @@ string(1) "1"
string(1) "0"
NULL
string(%d) "%sivision by zer%s"
+--UEXPECTF--
+unicode(1) "1"
+unicode(4) "8191"
+unicode(1) "0"
+unicode(1) "1"
+unicode(1) "0"
+NULL
+unicode(%d) "%sivision by zer%s"