summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xZend/zend_interfaces.c7
-rw-r--r--Zend/zend_object_handlers.c3
-rw-r--r--Zend/zend_object_handlers.h2
-rw-r--r--Zend/zend_reflection_api.c30
-rw-r--r--Zend/zend_vm_def.h4
-rw-r--r--Zend/zend_vm_execute.h16
-rw-r--r--ext/reflection/php_reflection.c30
-rwxr-xr-xext/reflection/tests/006.phpt2
-rw-r--r--ext/standard/var.c2
9 files changed, 66 insertions, 30 deletions
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index 8a10f18ba9..031b71a62b 100755
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -431,6 +431,11 @@ int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len
*buf_len = Z_STRLEN_P(retval);
result = SUCCESS;
break;
+ case IS_UNICODE:
+ *buffer = eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval));
+ *buf_len = Z_USTRLEN_P(retval);
+ result = SUCCESS;
+ break;
default: /* failure */
result = FAILURE;
break;
@@ -439,7 +444,7 @@ int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len
}
if (result == FAILURE) {
- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "%s::serialize() must return a string or NULL", ce->name);
+ zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "%v::serialize() must return a string or NULL", ce->name);
}
return result;
}
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index c707126ac4..177048e6b4 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -816,13 +816,12 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
}
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC)
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC)
{
zval **retval = NULL;
zend_class_entry *tmp_ce = ce;
zend_property_info *property_info;
zend_property_info std_property_info;
- zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING;
if (zend_u_hash_find(&ce->properties_info, type, property_name, property_name_len+1, (void **) &property_info)==FAILURE) {
std_property_info.flags = ZEND_ACC_PUBLIC;
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 5399e2effc..07b50239dc 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -134,7 +134,7 @@ typedef struct _zend_object_handlers {
extern ZEND_API zend_object_handlers std_object_handlers;
BEGIN_EXTERN_C()
ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC);
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c
index d310f77819..5eae777c02 100644
--- a/Zend/zend_reflection_api.c
+++ b/Zend/zend_reflection_api.c
@@ -577,13 +577,27 @@ 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) {
+ } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_BINARY) {
+ if (Z_TYPE_P(zv) == IS_BINARY) {
+ string_write(str, "b'", sizeof("b")-1);
+ }
string_write(str, "'", sizeof("'")-1);
string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
if (Z_STRLEN_P(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
+ } else if (Z_TYPE_P(zv) == IS_UNICODE) {
+ string_write(str, "'", sizeof("'")-1);
+ zend_make_printable_zval(zv, &zv_copy, &use_copy);
+ string_write(str, Z_STRVAL(zv_copy), MIN(Z_STRLEN(zv_copy), 15));
+ if (Z_STRLEN(zv_copy) > 15) {
+ string_write(str, "...", sizeof("...")-1);
+ }
+ string_write(str, "'", sizeof("'")-1);
+ if (use_copy) {
+ zval_dtor(&zv_copy);
+ }
} else {
zend_make_printable_zval(zv, &zv_copy, &use_copy);
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
@@ -2420,21 +2434,22 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
char *name;
int name_len;
zval **prop, *def_value = NULL;
+ zend_uchar name_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|z", &name, &name_len, &name_type, &def_value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- prop = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
+ prop = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC);
if (!prop) {
if (def_value) {
RETURN_ZVAL(def_value, 1, 0);
} else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %v does not have a property named %R", ce->name, name_type, name);
}
return;
} else {
@@ -2454,18 +2469,19 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zval **variable_ptr, *value;
int refcount;
zend_uchar is_ref;
+ zend_uchar name_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tz", &name, &name_len, &name_type, &value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
+ variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC);
if (!variable_ptr) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %v does not have a property named %R", ce->name, name_type, name);
return;
}
refcount = (*variable_ptr)->refcount;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index d8983cffe7..20097600fa 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -940,7 +940,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
+ retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
@@ -3333,7 +3333,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY)
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
+ value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 1 TSRMLS_CC);
if (!value) {
isset = 0;
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 948fe2bca3..0750bf917d 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1400,7 +1400,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
+ retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
@@ -2187,7 +2187,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
+ value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 1 TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -3908,7 +3908,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
+ retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
@@ -4695,7 +4695,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
+ value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 1 TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -6951,7 +6951,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
+ retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
@@ -7979,7 +7979,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
+ value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 1 TSRMLS_CC);
if (!value) {
isset = 0;
}
@@ -19645,7 +19645,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
+ retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
/*
@@ -20502,7 +20502,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
- value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
+ value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 1 TSRMLS_CC);
if (!value) {
isset = 0;
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index d310f77819..5eae777c02 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -577,13 +577,27 @@ 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) {
+ } else if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_BINARY) {
+ if (Z_TYPE_P(zv) == IS_BINARY) {
+ string_write(str, "b'", sizeof("b")-1);
+ }
string_write(str, "'", sizeof("'")-1);
string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
if (Z_STRLEN_P(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
+ } else if (Z_TYPE_P(zv) == IS_UNICODE) {
+ string_write(str, "'", sizeof("'")-1);
+ zend_make_printable_zval(zv, &zv_copy, &use_copy);
+ string_write(str, Z_STRVAL(zv_copy), MIN(Z_STRLEN(zv_copy), 15));
+ if (Z_STRLEN(zv_copy) > 15) {
+ string_write(str, "...", sizeof("...")-1);
+ }
+ string_write(str, "'", sizeof("'")-1);
+ if (use_copy) {
+ zval_dtor(&zv_copy);
+ }
} else {
zend_make_printable_zval(zv, &zv_copy, &use_copy);
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
@@ -2420,21 +2434,22 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
char *name;
int name_len;
zval **prop, *def_value = NULL;
+ zend_uchar name_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|z", &name, &name_len, &name_type, &def_value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- prop = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
+ prop = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC);
if (!prop) {
if (def_value) {
RETURN_ZVAL(def_value, 1, 0);
} else {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %v does not have a property named %R", ce->name, name_type, name);
}
return;
} else {
@@ -2454,18 +2469,19 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zval **variable_ptr, *value;
int refcount;
zend_uchar is_ref;
+ zend_uchar name_type;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tz", &name, &name_len, &name_type, &value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
+ variable_ptr = zend_std_get_static_property(ce, name_type, name, name_len, 1 TSRMLS_CC);
if (!variable_ptr) {
zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %v does not have a property named %R", ce->name, name_type, name);
return;
}
refcount = (*variable_ptr)->refcount;
diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt
index 72803c7bfe..4e76fa7336 100755
--- a/ext/reflection/tests/006.phpt
+++ b/ext/reflection/tests/006.phpt
@@ -109,7 +109,7 @@ EXCEPTION
EXCEPTION
unicode(7) "updated"
unicode(7) "updated"
-unicede(7) "updated"
+unicode(7) "updated"
EXCEPTION
EXCEPTION
unicode(7) "updated"
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 609a0d8fe4..9636e9411a 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -807,7 +807,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
break;
}
efree(prot_name);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_PP(name));
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%R\" returned as member variable from __sleep() but does not exist", Z_TYPE_PP(name), Z_UNIVAL_PP(name));
if (Z_TYPE_PP(name) == IS_UNICODE) {
php_var_serialize_unicode(buf, Z_USTRVAL_PP(name), Z_USTRLEN_PP(name));
} else {