From: Dmitry Stogov Date: Fri, 19 Aug 2005 13:20:16 +0000 (+0000) Subject: Unicode support X-Git-Tag: PRE_NEW_OCI8_EXTENSION~145 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90393d675f17f85250125a111964a82421fe811b;p=php Unicode support --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a9a579babd..ec672a59b9 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1179,8 +1179,8 @@ ZEND_FUNCTION(trigger_error) default: ZEND_WRONG_PARAM_COUNT(); } - convert_to_string_ex(z_error_message); - zend_error(error_type, "%s", (*z_error_message)->value.str.val); + convert_to_text_ex(z_error_message); + zend_error(error_type, "%R", Z_TYPE_PP(z_error_message), Z_UNIVAL_PP(z_error_message)); RETURN_TRUE; } /* }}} */ @@ -1200,7 +1200,7 @@ ZEND_FUNCTION(set_error_handler) } if (!zend_is_callable(error_handler, 0, &error_handler_name)) { - zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", + zend_error(E_WARNING, "%v() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name:"unknown"); efree(error_handler_name); return; @@ -1270,7 +1270,7 @@ ZEND_FUNCTION(set_exception_handler) if (Z_TYPE_PP(exception_handler) != IS_NULL) { /* NULL == unset */ if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) { - zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", + zend_error(E_WARNING, "%v() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown"); efree(exception_handler_name); return; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 4b21ab60b4..7e4aed5d75 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1539,10 +1539,11 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) && !CG(allow_call_time_pass_reference)) { zend_error(E_COMPILE_WARNING, "Call-time pass-by-reference has been deprecated - argument passed by value; " - "If you would like to pass it by reference, modify the declaration of %s(). " + "If you would like to pass it by reference, modify the declaration of %R(). " "If you would like to enable call-time pass-by-reference, you can set " "allow_call_time_pass_reference to true in your INI file. " "However, future versions may not support this any longer. ", + (function_ptr && UG(unicode))?IS_UNICODE:IS_STRING, (function_ptr?function_ptr->common.function_name:"[runtime function name]")); } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 992c1adeb4..da2d0d85dd 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -723,7 +723,7 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) file = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "file", sizeof("file")-1, 1 TSRMLS_CC); line = zend_read_property(U_CLASS_ENTRY(default_exception_ce), exception, "line", sizeof("line")-1, 1 TSRMLS_CC); - zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); + zend_error_va(E_ERROR, Z_STRVAL_P(file), Z_LVAL_P(line), "Uncaught %R\n thrown", Z_TYPE_P(str), Z_UNIVAL_P(str)); } else { zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name); } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 795a9d229e..731abce2f6 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -74,7 +74,7 @@ static void zend_handle_sigsegv(int dummy) { TSRMLS_FETCH(); - fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n", + fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %v() at %s:%d\n\n", active_opline->opcode, active_opline-EG(active_op_array)->opcodes, get_active_function_name(TSRMLS_C), @@ -479,7 +479,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) continue; } if (!zend_get_constant(str_index, str_index_len-1, &const_value TSRMLS_CC)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); + zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); zend_hash_move_forward(p->value.ht); continue; } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 67f31803c4..f6bcf1f875 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -827,12 +827,12 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty } #if DEBUG_OBJECT_HANDLERS - zend_printf("Access type for %v::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags)); + zend_printf("Access type for %v::%R is %s\n", ce->name, type, property_name, zend_visibility_string(property_info->flags)); #endif if (!zend_verify_property_access(property_info, ce TSRMLS_CC)) { if (!silent) { - zend_error(E_ERROR, "Cannot access %s property %v::$%s", zend_visibility_string(property_info->flags), ce->name, property_name); + zend_error(E_ERROR, "Cannot access %s property %v::$%R", zend_visibility_string(property_info->flags), ce->name, type, property_name); } return NULL; } @@ -843,7 +843,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty if (silent) { return NULL; } else { - zend_error(E_ERROR, "Access to undeclared static property: %v::$%s", ce->name, property_name); + zend_error(E_ERROR, "Access to undeclared static property: %v::$%R", ce->name, type, property_name); } } @@ -852,9 +852,9 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar ty } -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len TSRMLS_DC) +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len TSRMLS_DC) { - zend_error(E_ERROR, "Attempt to unset static property %v::$%s", ce->name, property_name); + zend_error(E_ERROR, "Attempt to unset static property %v::$%R", ce->name, type, property_name); return 0; } diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 4a358934e7..3ed13cb733 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -135,7 +135,7 @@ 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, 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 zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *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); ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC); diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 64423a07e4..b38c137cf4 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -2339,7 +2339,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob convert_to_string_ex(&argument); if (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument)); } return; } @@ -2775,18 +2775,19 @@ ZEND_METHOD(reflection_class, getProperty) zend_property_info *property_info; char *name; int name_len; + zend_uchar name_type; METHOD_NOTSTATIC; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &name, &name_len, &name_type) == FAILURE) { return; } GET_REFLECTION_OBJECT_PTR(ce); - if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { + if (zend_u_hash_find(&ce->properties_info, name_type, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { reflection_property_factory(ce, property_info, return_value TSRMLS_CC); } else { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Property %s does not exist", name); + "Property %R does not exist", name_type, name); return; } } @@ -3118,7 +3119,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Interface %s does not exist", Z_STRVAL_P(class_name)); + "Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); return; } class_ce = *pce; @@ -3165,7 +3166,7 @@ ZEND_METHOD(reflection_class, implementsInterface) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Interface %s does not exist", Z_STRVAL_P(interface)); + "Interface %R does not exist", Z_TYPE_P(interface), Z_UNIVAL_P(interface)); return; } interface_ce = *pce; @@ -3281,8 +3282,9 @@ ZEND_METHOD(reflection_property, __construct) zend_class_entry *ce; zend_property_info *property_info; property_reference *reference; + zend_uchar name_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zt", &classname, &name_str, &name_len, &name_type) == FAILURE) { return; } @@ -3298,7 +3300,7 @@ ZEND_METHOD(reflection_property, __construct) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Class %s does not exist", Z_STRVAL_P(classname)); + "Class %R does not exist", Z_TYPE_P(classname), Z_UNIVAL_P(classname)); return; } ce = *pce; @@ -3313,9 +3315,9 @@ ZEND_METHOD(reflection_property, __construct) /* returns out of this function */ } - if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { + if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Property %v::$%s does not exist", ce->name, name_str); + "Property %v::$%R does not exist", ce->name, name_type, name_str); return; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b7c9dc8105..51d2a108dc 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2856,7 +2856,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); + zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) == SUCCESS) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index dbd5088323..41bc307c3e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2017,7 +2017,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); + zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) == SUCCESS) { @@ -4525,7 +4525,7 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); + zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) == SUCCESS) { @@ -7651,7 +7651,7 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); + zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) == SUCCESS) { @@ -20332,7 +20332,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { - zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); + zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) == SUCCESS) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 64423a07e4..b38c137cf4 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2339,7 +2339,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob convert_to_string_ex(&argument); if (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { - zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); + zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %R does not exist", Z_TYPE_P(argument), Z_UNIVAL_P(argument)); } return; } @@ -2775,18 +2775,19 @@ ZEND_METHOD(reflection_class, getProperty) zend_property_info *property_info; char *name; int name_len; + zend_uchar name_type; METHOD_NOTSTATIC; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &name, &name_len, &name_type) == FAILURE) { return; } GET_REFLECTION_OBJECT_PTR(ce); - if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { + if (zend_u_hash_find(&ce->properties_info, name_type, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) { reflection_property_factory(ce, property_info, return_value TSRMLS_CC); } else { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Property %s does not exist", name); + "Property %R does not exist", name_type, name); return; } } @@ -3118,7 +3119,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Interface %s does not exist", Z_STRVAL_P(class_name)); + "Interface %R does not exist", Z_TYPE_P(class_name), Z_UNIVAL_P(class_name)); return; } class_ce = *pce; @@ -3165,7 +3166,7 @@ ZEND_METHOD(reflection_class, implementsInterface) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Interface %s does not exist", Z_STRVAL_P(interface)); + "Interface %R does not exist", Z_TYPE_P(interface), Z_UNIVAL_P(interface)); return; } interface_ce = *pce; @@ -3281,8 +3282,9 @@ ZEND_METHOD(reflection_property, __construct) zend_class_entry *ce; zend_property_info *property_info; property_reference *reference; + zend_uchar name_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zt", &classname, &name_str, &name_len, &name_type) == FAILURE) { return; } @@ -3298,7 +3300,7 @@ ZEND_METHOD(reflection_property, __construct) case IS_UNICODE: if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Class %s does not exist", Z_STRVAL_P(classname)); + "Class %R does not exist", Z_TYPE_P(classname), Z_UNIVAL_P(classname)); return; } ce = *pce; @@ -3313,9 +3315,9 @@ ZEND_METHOD(reflection_property, __construct) /* returns out of this function */ } - if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { + if (zend_u_hash_find(&ce->properties_info, name_type, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) { zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, - "Property %v::$%s does not exist", ce->name, name_str); + "Property %v::$%R does not exist", ce->name, name_type, name_str); return; }