Unicode support: MS Visual C compatibility

This commit is contained in:
Dmitry Stogov 2006-02-26 11:57:14 +00:00
parent 25c8f09752
commit e3b7f3fd0d
30 changed files with 215 additions and 176 deletions

View file

@ -42,6 +42,11 @@
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) # define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
#endif #endif
#ifndef __GNUC__
ZEND_API zstr null_zstr;
ZEND_API zstr empty_zstr;
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG #if defined(ZEND_WIN32) && ZEND_DEBUG
BOOL WINAPI IsDebuggerPresent(VOID); BOOL WINAPI IsDebuggerPresent(VOID);
#endif #endif
@ -527,7 +532,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC)
case IS_OBJECT: case IS_OBJECT:
{ {
HashTable *properties = NULL; HashTable *properties = NULL;
zstr class_name = (zstr)NULL; zstr class_name = NULL_ZSTR;
zend_uint clen; zend_uint clen;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) { if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
@ -584,7 +589,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
case IS_OBJECT: case IS_OBJECT:
{ {
HashTable *properties = NULL; HashTable *properties = NULL;
zstr class_name = (zstr)NULL; zstr class_name = NULL_ZSTR;
zend_uint clen; zend_uint clen;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) { if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
@ -970,6 +975,11 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
extern zend_unicode_globals unicode_globals; extern zend_unicode_globals unicode_globals;
#endif #endif
#ifndef __GNUC__
null_zstr.v = NULL;
empty_zstr.u = EMPTY_STR;
#endif
#ifdef ZTS #ifdef ZTS
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor); ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
#else #else

View file

@ -246,6 +246,25 @@ typedef union _zstr {
void *v; void *v;
} zstr; } zstr;
#ifdef __GNUC__
# define ZSTR(x) ((zstr)(x))
# define NULL_ZSTR ZSTR(NULL)
# define EMPTY_ZSTR ZSTR("\0\0")
#else
extern ZEND_API zstr null_zstr;
extern ZEND_API zstr empty_zstr;
static inline zstr _to_zstr(void *v) {
zstr ret;
ret.v = v;
return ret;
}
# define ZSTR(x) _to_zstr(x)
# define NULL_ZSTR null_zstr
# define EMPTY_ZSTR empty_zstr
#endif
#define EMPTY_STR ((UChar*)"\0\0") #define EMPTY_STR ((UChar*)"\0\0")
#undef SUCCESS #undef SUCCESS
@ -302,6 +321,10 @@ typedef union _zvalue_value {
UChar *val; UChar *val;
int len; int len;
} ustr; } ustr;
struct { /* Unicersal string type */
zstr val;
int len;
} uni;
HashTable *ht; /* hash table value */ HashTable *ht; /* hash table value */
zend_object_value obj; zend_object_value obj;
} zvalue_value; } zvalue_value;

View file

@ -2889,7 +2889,7 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, z
zstr prot_name; zstr prot_name;
int prot_name_length; int prot_name_length;
zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_u_mangle_property_name(&prot_name, &prot_name_length, type, ZSTR("*"), 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
zend_u_hash_update(target_symbol_table, type, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL); zend_u_hash_update(target_symbol_table, type, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL);
property_info.name = prot_name; property_info.name = prot_name;
property_info.name_length = prot_name_length; property_info.name_length = prot_name_length;
@ -2900,7 +2900,7 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, z
zstr prot_name; zstr prot_name;
int prot_name_length; int prot_name_length;
zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_u_mangle_property_name(&prot_name, &prot_name_length, type, ZSTR("*"), 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
zend_u_hash_del(target_symbol_table, type, prot_name, prot_name_length+1); zend_u_hash_del(target_symbol_table, type, prot_name, prot_name_length+1);
pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS); pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS);
} }
@ -2924,7 +2924,7 @@ ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, z
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC)
{ {
return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC); return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL, 0 TSRMLS_CC);
} }
ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC) ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC)
@ -2934,7 +2934,7 @@ ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC)
{ {
return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC); return zend_u_declare_property_ex(ce, IS_STRING, ZSTR(name), name_length, property, access_type, NULL, 0 TSRMLS_CC);
} }
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC)
@ -3251,7 +3251,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in
zend_class_entry *old_scope = EG(scope); zend_class_entry *old_scope = EG(scope);
EG(scope) = scope; EG(scope) = scope;
property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, 0 TSRMLS_CC); property = zend_std_get_static_property(scope, IS_STRING, ZSTR(name), name_length, 0 TSRMLS_CC);
EG(scope) = old_scope; EG(scope) = old_scope;
if (!property) { if (!property) {
return FAILURE; return FAILURE;
@ -3441,7 +3441,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in
zend_class_entry *old_scope = EG(scope); zend_class_entry *old_scope = EG(scope);
EG(scope) = scope; EG(scope) = scope;
property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, silent TSRMLS_CC); property = zend_std_get_static_property(scope, IS_STRING, ZSTR(name), name_length, silent TSRMLS_CC);
EG(scope) = old_scope; EG(scope) = old_scope;
return property?*property:NULL; return property?*property:NULL;

View file

@ -927,7 +927,7 @@ END_EXTERN_C()
} }
#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \ #define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \
ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, (zstr)name, name_length, var, _refcount, _is_ref) ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, ZSTR(name), name_length, var, _refcount, _is_ref)
#define ZEND_SET_GLOBAL_VAR(name, var) \ #define ZEND_SET_GLOBAL_VAR(name, var) \
ZEND_SET_SYMBOL(&EG(symbol_table), name, var) ZEND_SET_SYMBOL(&EG(symbol_table), name, var)

View file

@ -568,7 +568,7 @@ ZEND_FUNCTION(defined)
ZEND_FUNCTION(get_class) ZEND_FUNCTION(get_class)
{ {
zval **arg; zval **arg;
zstr name = (zstr)EMPTY_STR; zstr name = EMPTY_ZSTR;
zend_uint name_len = 0; zend_uint name_len = 0;
int dup; int dup;
@ -1776,10 +1776,10 @@ ZEND_FUNCTION(debug_print_backtrace)
array_init(return_value); array_init(return_value);
while (ptr) { while (ptr) {
zstr free_class_name = (zstr)NULL; zstr free_class_name = NULL_ZSTR;
int function_name_string = 1; int function_name_string = 1;
class_name = (zstr)NULL; class_name = NULL_ZSTR;
call_type = NULL; call_type = NULL;
arg_array = NULL; arg_array = NULL;
@ -1824,7 +1824,7 @@ ZEND_FUNCTION(debug_print_backtrace)
class_name = ptr->function_state.function->common.scope->name; class_name = ptr->function_state.function->common.scope->name;
call_type = "::"; call_type = "::";
} else { } else {
class_name = (zstr)NULL; class_name = NULL_ZSTR;
call_type = NULL; call_type = NULL;
} }
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {

View file

@ -1109,7 +1109,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
fn_flags = 0; fn_flags = 0;
} }
if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : (zstr)EMPTY_STR, is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : EMPTY_ZSTR, is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant));
} }
function_token->u.op_array = CG(active_op_array); function_token->u.op_array = CG(active_op_array);
@ -1361,7 +1361,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
} }
} else { } else {
cur_arg_info->array_type_hint = 1; cur_arg_info->array_type_hint = 1;
cur_arg_info->class_name.v = NULL; cur_arg_info->class_name = NULL_ZSTR;
cur_arg_info->class_name_len = 0; cur_arg_info->class_name_len = 0;
if (op == ZEND_RECV_INIT) { if (op == ZEND_RECV_INIT) {
if (Z_TYPE(initialization->u.constant) == IS_NULL || if (Z_TYPE(initialization->u.constant) == IS_NULL ||
@ -1375,7 +1375,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
} }
} }
} else { } else {
cur_arg_info->class_name.v = NULL; cur_arg_info->class_name = NULL_ZSTR;
cur_arg_info->class_name_len = 0; cur_arg_info->class_name_len = 0;
} }
opline->result.u.EA.type |= EXT_TYPE_UNUSED; opline->result.u.EA.type |= EXT_TYPE_UNUSED;
@ -2209,7 +2209,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
zstr prot_name; zstr prot_name;
int prot_name_length; int prot_name_length;
zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, (zstr)"*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS); zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, ZSTR("*"), 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
if (child_info->flags & ZEND_ACC_STATIC) { if (child_info->flags & ZEND_ACC_STATIC) {
zval **prop; zval **prop;
HashTable *ht; HashTable *ht;
@ -4158,7 +4158,7 @@ zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint name_len TSRMLS
zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC) zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC)
{ {
return zend_u_is_auto_global(IS_STRING, (zstr)name, name_len TSRMLS_CC); return zend_u_is_auto_global(IS_STRING, ZSTR(name), name_len TSRMLS_CC);
} }

View file

@ -242,7 +242,7 @@ typedef struct _zend_internal_function {
struct _zend_module_entry *module; struct _zend_module_entry *module;
} zend_internal_function; } zend_internal_function;
#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : (zstr)EMPTY_STR) #define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : EMPTY_ZSTR)
typedef union _zend_function { typedef union _zend_function {
zend_uchar type; /* MUST be the first element of this struct! */ zend_uchar type; /* MUST be the first element of this struct! */

View file

@ -322,7 +322,7 @@ ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC)
{ {
return zend_u_get_constant(IS_STRING, (zstr)name, name_len, result TSRMLS_CC); return zend_u_get_constant(IS_STRING, ZSTR(name), name_len, result TSRMLS_CC);
} }
ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC) ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC)
@ -343,7 +343,7 @@ ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_D
} else { } else {
lookup_name_len = c->name_len; lookup_name_len = c->name_len;
name = c->name; name = c->name;
lookup_name.v = NULL; lookup_name = NULL_ZSTR;
} }
if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {

View file

@ -485,7 +485,7 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
cur_arg_info = &zf->common.arg_info[arg_num-1]; cur_arg_info = &zf->common.arg_info[arg_num-1];
fname = zf->common.function_name; fname = zf->common.function_name;
fsep = zf->common.scope ? "::" : ""; fsep = zf->common.scope ? "::" : "";
fclass = zf->common.scope ? zf->common.scope->name : (zstr)EMPTY_STR; fclass = zf->common.scope ? zf->common.scope->name : EMPTY_ZSTR;
if (cur_arg_info->class_name.v) { if (cur_arg_info->class_name.v) {
if (!arg) { if (!arg) {

View file

@ -203,7 +203,7 @@ void zend_shutdown_timeout_thread();
/* The following tries to resolve the classname of a zval of type object. /* The following tries to resolve the classname of a zval of type object.
* Since it is slow it should be only used in error messages. * Since it is slow it should be only used in error messages.
*/ */
#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : (zstr)EMPTY_STR) #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : EMPTY_ZSTR)
ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var); ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var);

View file

@ -314,7 +314,7 @@ ZEND_API zstr get_active_class_name(char **space TSRMLS_DC)
if (space) { if (space) {
*space = ""; *space = "";
} }
return (zstr)EMPTY_STR; return EMPTY_ZSTR;
} }
switch (EG(function_state_ptr)->function->type) { switch (EG(function_state_ptr)->function->type) {
case ZEND_USER_FUNCTION: case ZEND_USER_FUNCTION:
@ -325,21 +325,23 @@ ZEND_API zstr get_active_class_name(char **space TSRMLS_DC)
if (space) { if (space) {
*space = ce ? "::" : ""; *space = ce ? "::" : "";
} }
return ce ? ce->name : (zstr)EMPTY_STR; return ce ? ce->name : EMPTY_ZSTR;
} }
default: default:
if (space) { if (space) {
*space = ""; *space = "";
} }
return (zstr)EMPTY_STR; return EMPTY_ZSTR;
} }
} }
ZEND_API zstr get_active_function_name(TSRMLS_D) ZEND_API zstr get_active_function_name(TSRMLS_D)
{ {
zstr ret;
if (!zend_is_executing(TSRMLS_C)) { if (!zend_is_executing(TSRMLS_C)) {
return (zstr)NULL; return NULL_ZSTR;
} }
switch (EG(function_state_ptr)->function->type) { switch (EG(function_state_ptr)->function->type) {
case ZEND_USER_FUNCTION: { case ZEND_USER_FUNCTION: {
@ -347,16 +349,19 @@ ZEND_API zstr get_active_function_name(TSRMLS_D)
if (function_name.v) { if (function_name.v) {
return function_name; return function_name;
} else if (UG(unicode)) {
ret.u = u_main;
} else { } else {
return UG(unicode)?(zstr)u_main:(zstr)"main"; ret.s = "main";
} }
return ret;
} }
break; break;
case ZEND_INTERNAL_FUNCTION: case ZEND_INTERNAL_FUNCTION:
return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name; return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
break; break;
default: default:
return (zstr)NULL; return NULL_ZSTR;
} }
} }
@ -530,13 +535,13 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
break; break;
case IS_BOOL: case IS_BOOL:
case IS_LONG: case IS_LONG:
zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, Z_LVAL(const_value)); zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, Z_LVAL(const_value));
break; break;
case IS_DOUBLE: case IS_DOUBLE:
zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, (long)Z_DVAL(const_value)); zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, (long)Z_DVAL(const_value));
break; break;
case IS_NULL: case IS_NULL:
zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, (zstr)EMPTY_STR, 1, 0); zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, EMPTY_ZSTR, 1, 0);
break; break;
} }
zend_hash_move_forward(Z_ARRVAL_P(p)); zend_hash_move_forward(Z_ARRVAL_P(p));
@ -865,7 +870,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
} }
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %v%s%v() is deprecated", zend_error(E_STRICT, "Function %v%s%v() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR, EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : EMPTY_ZSTR,
EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name); EX(function_state).function->common.function_name);
} }
@ -1134,7 +1139,7 @@ ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, ze
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
{ {
return zend_u_lookup_class(IS_STRING, (zstr)name, name_length, ce TSRMLS_CC); return zend_u_lookup_class(IS_STRING, ZSTR(name), name_length, ce TSRMLS_CC);
} }
ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC) ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC)
@ -1222,7 +1227,7 @@ ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr,
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
{ {
return zend_u_eval_string(IS_STRING, (zstr)str, retval_ptr, string_name TSRMLS_CC); return zend_u_eval_string(IS_STRING, ZSTR(str), retval_ptr, string_name TSRMLS_CC);
} }
ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
@ -1239,7 +1244,7 @@ ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr,
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
{ {
return zend_u_eval_string_ex(IS_STRING, (zstr)str, retval_ptr, string_name, handle_exceptions TSRMLS_CC); return zend_u_eval_string_ex(IS_STRING, ZSTR(str), retval_ptr, string_name, handle_exceptions TSRMLS_CC);
} }
@ -1543,16 +1548,16 @@ check_fetch_type:
zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
{ {
return zend_u_fetch_class(IS_STRING, (zstr)class_name, class_name_len, fetch_type TSRMLS_CC); return zend_u_fetch_class(IS_STRING, ZSTR(class_name), class_name_len, fetch_type TSRMLS_CC);
} }
#define MAX_ABSTRACT_INFO_CNT 3 #define MAX_ABSTRACT_INFO_CNT 3
#define MAX_ABSTRACT_INFO_FMT "%v%s%v%s" #define MAX_ABSTRACT_INFO_FMT "%v%s%v%s"
#define DISPLAY_ABSTRACT_FN(idx) \ #define DISPLAY_ABSTRACT_FN(idx) \
ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : (zstr)EMPTY_STR, \ ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : EMPTY_ZSTR, \
ai.afn[idx] ? "::" : "", \ ai.afn[idx] ? "::" : "", \
ai.afn[idx] ? ai.afn[idx]->common.function_name : (zstr)EMPTY_STR, \ ai.afn[idx] ? ai.afn[idx]->common.function_name : EMPTY_ZSTR, \
ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "")
typedef struct _zend_abstract_info { typedef struct _zend_abstract_info {
@ -1634,7 +1639,7 @@ ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_
ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC)
{ {
return zend_u_delete_global_variable(IS_STRING, (zstr)name, name_len TSRMLS_CC); return zend_u_delete_global_variable(IS_STRING, ZSTR(name), name_len TSRMLS_CC);
} }
/* /*

View file

@ -121,7 +121,7 @@ ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength)
ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
{ {
return zend_u_hash_func(IS_STRING, (zstr)arKey, nKeyLength); return zend_u_hash_func(IS_STRING, ZSTR(arKey), nKeyLength);
} }
#define UPDATE_DATA(ht, p, pData, nDataSize) \ #define UPDATE_DATA(ht, p, pData, nDataSize) \
@ -312,7 +312,7 @@ ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arK
ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
{ {
return _zend_u_hash_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); return _zend_u_hash_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
} }
ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
@ -400,7 +400,7 @@ ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zs
ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
{ {
return _zend_u_hash_quick_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); return _zend_u_hash_quick_add_or_update(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC);
} }
ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
@ -414,7 +414,7 @@ ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLe
{ {
void *dummy = (void *) 1; void *dummy = (void *) 1;
return zend_u_hash_add(ht, IS_STRING, (zstr)arKey, nKeyLength, &dummy, sizeof(void *), NULL); return zend_u_hash_add(ht, IS_STRING, ZSTR(arKey), nKeyLength, &dummy, sizeof(void *), NULL);
} }
@ -594,7 +594,7 @@ ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr a
ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
{ {
return zend_u_hash_del_key_or_index(ht, IS_STRING, (zstr)arKey, nKeyLength, h, flag); return zend_u_hash_del_key_or_index(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, flag);
} }
ZEND_API void zend_hash_destroy(HashTable *ht) ZEND_API void zend_hash_destroy(HashTable *ht)
@ -830,7 +830,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
if (q->nKeyLength==0) { if (q->nKeyLength==0) {
zend_hash_index_del(ht, q->h); zend_hash_index_del(ht, q->h);
} else { } else {
zend_u_hash_del(ht, q->key.type, (zstr)q->key.arKey.s, q->nKeyLength); zend_u_hash_del(ht, q->key.type, ZSTR(q->key.arKey.s), q->nKeyLength);
} }
} }
if (result & ZEND_HASH_APPLY_STOP) { if (result & ZEND_HASH_APPLY_STOP) {
@ -854,7 +854,7 @@ ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_fun
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_index_update(target, p->h, p->pData, size, &new_entry); zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
} else { } else {
zend_u_hash_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &new_entry); zend_u_hash_update(target, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, p->pData, size, &new_entry);
} }
if (pCopyConstructor) { if (pCopyConstructor) {
pCopyConstructor(new_entry); pCopyConstructor(new_entry);
@ -881,7 +881,7 @@ ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_f
pCopyConstructor(t); pCopyConstructor(t);
} }
} else { } else {
if (_zend_u_hash_add_or_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) { if (_zend_u_hash_add_or_update(target, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) {
pCopyConstructor(t); pCopyConstructor(t);
} }
} }
@ -914,7 +914,7 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor
p = source->pListHead; p = source->pListHead;
while (p) { while (p) {
if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) { if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) {
if (zend_u_hash_quick_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) { if (zend_u_hash_quick_update(target, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
pCopyConstructor(t); pCopyConstructor(t);
} }
} }
@ -931,7 +931,7 @@ ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLengt
ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength)
{ {
return zend_u_get_hash_value(IS_STRING, (zstr)arKey, nKeyLength); return zend_u_get_hash_value(IS_STRING, ZSTR(arKey), nKeyLength);
} }
@ -973,7 +973,7 @@ ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint n
ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
{ {
return zend_u_hash_find(ht, IS_STRING, (zstr)arKey, nKeyLength, pData); return zend_u_hash_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, pData);
} }
@ -1016,7 +1016,7 @@ ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey,
ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
{ {
return zend_u_hash_quick_find(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData); return zend_u_hash_quick_find(ht, IS_STRING, ZSTR(arKey), nKeyLength, h, pData);
} }
ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength)
@ -1052,7 +1052,7 @@ ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint
ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
{ {
return zend_u_hash_exists(ht, IS_STRING, (zstr)arKey, nKeyLength); return zend_u_hash_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength);
} }
ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h) ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h)
@ -1093,7 +1093,7 @@ ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey
ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h)
{ {
return zend_u_hash_quick_exists(ht, IS_STRING, (zstr)arKey, nKeyLength, h); return zend_u_hash_quick_exists(ht, IS_STRING, ZSTR(arKey), nKeyLength, h);
} }
ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
@ -1505,7 +1505,7 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
return 1; return 1;
} }
} else { /* string, binary or unicode index */ } else { /* string, binary or unicode index */
if (zend_u_hash_find(ht2, p1->key.type, (zstr)p1->key.arKey.s, p1->nKeyLength, &pData2)==FAILURE) { if (zend_u_hash_find(ht2, p1->key.type, ZSTR(p1->key.arKey.s), p1->nKeyLength, &pData2)==FAILURE) {
HASH_UNPROTECT_RECURSION(ht1); HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2); HASH_UNPROTECT_RECURSION(ht2);
return 1; return 1;
@ -1687,10 +1687,10 @@ ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type,
if (type == IS_STRING) { if (type == IS_STRING) {
key_type = HASH_KEY_IS_STRING; key_type = HASH_KEY_IS_STRING;
HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL_ZSTR, 0, idx));
} else { } else {
key_type = HASH_KEY_IS_UNICODE; key_type = HASH_KEY_IS_UNICODE;
HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL_ZSTR, 0, idx));
} }
return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0); return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0);
} }
@ -1726,8 +1726,8 @@ ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength)
ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength) ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength)
{ {
HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL_ZSTR, 0, idx));
return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, (zstr)arKey, nKeyLength, 0); return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, ZSTR(arKey), nKeyLength, 0);
} }
ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC) ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC)

View file

@ -76,7 +76,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
if (!fn_proxy || !*fn_proxy) { if (!fn_proxy || !*fn_proxy) {
if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) { if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
/* error at c-level */ /* error at c-level */
zend_error(E_CORE_ERROR, "Couldn't find implementation for method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name); zend_error(E_CORE_ERROR, "Couldn't find implementation for method %v%s%s", obj_ce ? obj_ce->name : EMPTY_ZSTR, obj_ce ? "::" : "", function_name);
} }
if (fn_proxy) { if (fn_proxy) {
*fn_proxy = fcic.function_handler; *fn_proxy = fcic.function_handler;
@ -93,7 +93,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
if (!obj_ce) { if (!obj_ce) {
obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL; obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
} }
zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name); zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : EMPTY_ZSTR, obj_ce ? "::" : "", function_name);
} }
if (!retval_ptr_ptr) { if (!retval_ptr_ptr) {
if (retval) { if (retval) {

View file

@ -1891,7 +1891,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
} }
<ST_IN_SCRIPTING>"__CLASS__" { <ST_IN_SCRIPTING>"__CLASS__" {
zstr class_name = (zstr)NULL; zstr class_name = NULL_ZSTR;
if (CG(active_class_entry)) { if (CG(active_class_entry)) {
class_name = CG(active_class_entry)->name; class_name = CG(active_class_entry)->name;
@ -1906,7 +1906,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
} }
<ST_IN_SCRIPTING>"__FUNCTION__" { <ST_IN_SCRIPTING>"__FUNCTION__" {
zstr func_name = (zstr)NULL; zstr func_name = NULL_ZSTR;
if (CG(active_op_array)) { if (CG(active_op_array)) {
func_name = CG(active_op_array)->function_name; func_name = CG(active_op_array)->function_name;
@ -1921,8 +1921,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
} }
<ST_IN_SCRIPTING>"__METHOD__" { <ST_IN_SCRIPTING>"__METHOD__" {
zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : (zstr)NULL; zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL_ZSTR;
zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : (zstr)NULL; zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL_ZSTR;
size_t len = 0; size_t len = 0;
if (UG(unicode)) { if (UG(unicode)) {

View file

@ -792,14 +792,14 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_
*/ */
updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC); updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC);
if (!updated_fbc) { if (!updated_fbc) {
zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
fbc = updated_fbc; fbc = updated_fbc;
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(fbc->common.scope, EG(scope))) { if (!zend_check_protected(fbc->common.scope, EG(scope))) {
zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
@ -839,14 +839,14 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr fu
*/ */
updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC); updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC);
if (!updated_fbc) { if (!updated_fbc) {
zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
fbc = updated_fbc; fbc = updated_fbc;
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(EG(scope), fbc->common.scope)) { if (!zend_check_protected(EG(scope), fbc->common.scope)) {
zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
@ -915,13 +915,13 @@ static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC) != EG(scope)) { if (Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC) != EG(scope)) {
zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(constructor->common.scope, EG(scope))) { if (!zend_check_protected(constructor->common.scope, EG(scope))) {
zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }

View file

@ -44,7 +44,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zend_error(EG(in_execution) ? E_ERROR : E_WARNING, zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to private %v::__destruct() from context '%v'%s", "Call to private %v::__destruct() from context '%v'%s",
ce->name, ce->name,
EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR, EG(scope) ? EG(scope)->name : EMPTY_ZSTR,
EG(in_execution) ? "" : " during shutdown ignored"); EG(in_execution) ? "" : " during shutdown ignored");
return; return;
} }
@ -57,7 +57,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zend_error(EG(in_execution) ? E_ERROR : E_WARNING, zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to protected %v::__destruct() from context '%v'%s", "Call to protected %v::__destruct() from context '%v'%s",
ce->name, ce->name,
EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR, EG(scope) ? EG(scope)->name : EMPTY_ZSTR,
EG(in_execution) ? "" : " during shutdown ignored"); EG(in_execution) ? "" : " during shutdown ignored");
return; return;
} }

View file

@ -2084,17 +2084,24 @@ ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, u
return dest; return dest;
} else { } else {
return (zstr)zend_str_tolower_copy(dest.s, source.s, length); zstr ret;
ret.s = zend_str_tolower_copy(dest.s, source.s, length);
return ret;
} }
} }
ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length) ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length)
{ {
zstr ret;
if (type == IS_UNICODE) { if (type == IS_UNICODE) {
return zend_u_str_tolower_copy(IS_UNICODE, (zstr)emalloc(UBYTES(length+1)), source, length); ret.u = eumalloc(length+1);
ret = zend_u_str_tolower_copy(IS_UNICODE, ret, source, length);
} else { } else {
return (zstr)zend_str_tolower_copy((char*)emalloc(length+1), source.s, length); ret.s = zend_str_tolower_copy((char*)emalloc(length+1), source.s, length);
} }
return ret;
} }
ZEND_API void zend_str_tolower(char *str, unsigned int length) ZEND_API void zend_str_tolower(char *str, unsigned int length)
@ -2124,24 +2131,25 @@ ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length)
ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len) ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len)
{ {
zstr ret;
if (type == IS_UNICODE) { if (type == IS_UNICODE) {
UChar *ret;
int ret_len; int ret_len;
if (normalize) { if (normalize) {
zend_normalize_identifier(&ret, &ret_len, source.u, length, 1); zend_normalize_identifier(&ret.u, &ret_len, source.u, length, 1);
} else { } else {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
zend_case_fold_string(&ret, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status); zend_case_fold_string(&ret.u, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status);
} }
*new_len = ret_len; *new_len = ret_len;
return (zstr)ret; } else {
} else {
*new_len = length; *new_len = length;
return (zstr)zend_str_tolower_dup(source.s, length); ret.s = zend_str_tolower_dup(source.s, length);
} }
return ret;
} }
ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2)

View file

@ -388,8 +388,8 @@ END_EXTERN_C()
#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC) #define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf #define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
#define Z_RESVAL(zval) (zval).value.lval #define Z_RESVAL(zval) (zval).value.lval
#define Z_UNIVAL(zval) ((zstr)(Z_STRVAL(zval))) #define Z_UNIVAL(zval) (zval).value.uni.val
#define Z_UNILEN(zval) Z_STRLEN(zval) #define Z_UNILEN(zval) (zval).value.uni.len
#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p) #define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)

View file

@ -1821,7 +1821,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
} }
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %v%s%v() is deprecated", zend_error(E_STRICT, "Function %v%s%v() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR, EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : EMPTY_ZSTR,
EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name); EX(function_state).function->common.function_name);
} }
@ -2509,13 +2509,13 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }

View file

@ -147,7 +147,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
} }
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %v%s%v() is deprecated", zend_error(E_STRICT, "Function %v%s%v() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR, EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : EMPTY_ZSTR,
EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name); EX(function_state).function->common.function_name);
} }
@ -1720,13 +1720,13 @@ static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }
@ -4220,13 +4220,13 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }
@ -7317,13 +7317,13 @@ static int ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }
@ -14423,13 +14423,13 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }
@ -19951,13 +19951,13 @@ static int ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so. /* Ensure that if we're calling a private function, we're allowed to do so.
*/ */
if (ce != EG(scope)) { if (ce != EG(scope)) {
zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so. /* Ensure that if we're calling a protected function, we're allowed to do so.
*/ */
if (!zend_check_protected(clone->common.scope, EG(scope))) { if (!zend_check_protected(clone->common.scope, EG(scope))) {
zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_ZSTR);
} }
} }
} }

View file

@ -843,12 +843,12 @@ int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node expo
if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) { if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) {
int ret; int ret;
UChar *uname; zstr name;
uname = malloc(UBYTES(ce->name_length+1)); name.u = malloc(UBYTES(ce->name_length+1));
u_charsToUChars(ce->name.s, uname, ce->name_length+1); u_charsToUChars(ce->name.s, name.u, ce->name_length+1);
ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, (zstr)uname, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL); ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
free(uname); free(name.u);
return ret; return ret;
} }
return FAILURE; return FAILURE;

View file

@ -1988,7 +1988,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
} else { } else {
zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); zend_u_hash_update(out_hash, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
} }
} }
@ -2000,7 +2000,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL); zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
} else { } else {
zend_u_hash_update(*removed, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); zend_u_hash_update(*removed, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
} }
} }
} else /* otherwise just skip those entries */ } else /* otherwise just skip those entries */
@ -2033,7 +2033,7 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
} else { } else {
zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); zend_u_hash_update(out_hash, p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
} }
} }
@ -2094,7 +2094,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
{ {
zval **stack, /* Input stack */ zval **stack, /* Input stack */
**val; /* Value to be popped */ **val; /* Value to be popped */
zstr key = (zstr)NULL; zstr key = NULL_ZSTR;
int key_len = 0; int key_len = 0;
ulong index; ulong index;
zend_uchar key_type; zend_uchar key_type;
@ -3043,9 +3043,9 @@ PHP_FUNCTION(array_unique)
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else { } else {
if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) {
zend_u_delete_global_variable(p->key.type, (zstr)p->key.arKey.s, p->nKeyLength-1 TSRMLS_CC); zend_u_delete_global_variable(p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength-1 TSRMLS_CC);
} else { } else {
zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
} }
} }
} }
@ -3303,7 +3303,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else { } else {
zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
} }
} }
} }
@ -3319,7 +3319,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else { } else {
zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
} }
if (!*++ptrs[0]) { if (!*++ptrs[0]) {
goto out; goto out;
@ -3702,7 +3702,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
if (p->nKeyLength == 0) { if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else { } else {
zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, ZSTR(p->key.arKey.s), p->nKeyLength);
} }
if (!*++ptrs[0]) { if (!*++ptrs[0]) {
goto out; goto out;

View file

@ -126,7 +126,7 @@ zend_class_entry *php_create_incomplete_class(TSRMLS_D)
PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen) PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen)
{ {
zval **val; zval **val;
zstr retval = (zstr)NULL; zstr retval = NULL_ZSTR;
HashTable *object_properties; HashTable *object_properties;
TSRMLS_FETCH(); TSRMLS_FETCH();

View file

@ -907,20 +907,8 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
{ {
int ret = SUCCESS; int ret = SUCCESS;
zval **tmp; zval **tmp;
U_STRING_DECL(u_notification, "notification", 12);
U_STRING_DECL(u_options, "options", 7);
U_STRING_DECL(u_input_encoding, "input_encoding", 14);
U_STRING_DECL(u_output_encoding, "output_encoding", 15);
U_STRING_DECL(u_default_mode, "default_mode", 12);
U_STRING_INIT(u_notification, "notification", 12); if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) {
U_STRING_INIT(u_options, "options", 7);
U_STRING_INIT(u_input_encoding, "input_encoding", 14);
U_STRING_INIT(u_output_encoding, "output_encoding", 15);
U_STRING_INIT(u_default_mode, "default_mode", 12);
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp) ||
SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_notification, sizeof("notification"), (void**)&tmp)) {
if (context->notifier) { if (context->notifier) {
php_stream_notification_free(context->notifier); php_stream_notification_free(context->notifier);
@ -933,12 +921,10 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
ZVAL_ADDREF(*tmp); ZVAL_ADDREF(*tmp);
context->notifier->dtor = user_space_stream_notifier_dtor; context->notifier->dtor = user_space_stream_notifier_dtor;
} }
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp) || if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_options, sizeof("options"), (void**)&tmp)) {
parse_context_options(context, *tmp TSRMLS_CC); parse_context_options(context, *tmp TSRMLS_CC);
} }
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "input_encoding", sizeof("input_encoding"), (void**)&tmp) || if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "input_encoding", sizeof("input_encoding"), (void**)&tmp)) {
SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_input_encoding, sizeof("input_encoding"), (void**)&tmp)) {
zval strval = **tmp; zval strval = **tmp;
if (context->input_encoding) { if (context->input_encoding) {
@ -949,8 +935,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
convert_to_string(&strval); convert_to_string(&strval);
context->input_encoding = Z_STRVAL(strval); context->input_encoding = Z_STRVAL(strval);
} }
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "output_encoding", sizeof("output_encoding"), (void**)&tmp) || if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "output_encoding", sizeof("output_encoding"), (void**)&tmp)) {
SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_output_encoding, sizeof("output_encoding"), (void**)&tmp)) {
zval strval = **tmp; zval strval = **tmp;
if (context->output_encoding) { if (context->output_encoding) {
@ -961,8 +946,7 @@ static int parse_context_params(php_stream_context *context, zval *params TSRMLS
convert_to_string(&strval); convert_to_string(&strval);
context->output_encoding = Z_STRVAL(strval); context->output_encoding = Z_STRVAL(strval);
} }
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "default_mode", sizeof("default_mode"), (void**)&tmp) || if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "default_mode", sizeof("default_mode"), (void**)&tmp)) {
SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_default_mode, sizeof("default_mode"), (void**)&tmp)) {
zval longval = **tmp; zval longval = **tmp;
zval_copy_ctor(&longval); zval_copy_ctor(&longval);

View file

@ -684,6 +684,9 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
{ {
int count; int count;
zend_bool incomplete_class; zend_bool incomplete_class;
zstr star;
star.s = "*";
incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC); incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC);
/* count after serializing name, since php_var_serialize_class_name /* count after serializing name, since php_var_serialize_class_name
@ -762,7 +765,7 @@ static void php_var_serialize_class(smart_str *buf, zval **struc, zval *retval_p
break; break;
} }
efree(priv_name.v); efree(priv_name.v);
zend_u_mangle_property_name(&prot_name, &prop_name_length, Z_TYPE_PP(name), (zstr)"*", 1, zend_u_mangle_property_name(&prot_name, &prop_name_length, Z_TYPE_PP(name), star, 1,
Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS);
if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), prot_name, prop_name_length+1, (void *) &d) == SUCCESS) { if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), prot_name, prop_name_length+1, (void *) &d) == SUCCESS) {
if (Z_TYPE_PP(name) == IS_UNICODE) { if (Z_TYPE_PP(name) == IS_UNICODE) {

View file

@ -415,7 +415,7 @@ static void text_iter_get_current_data(zend_object_iterator* iter, zval*** data
*data = &obj->current; *data = &obj->current;
} }
static int text_iter_get_current_key(zend_object_iterator* iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) static int text_iter_get_current_key(zend_object_iterator* iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
{ {
text_iter_obj* obj = text_iter_to_obj(iter); text_iter_obj* obj = text_iter_to_obj(iter);

View file

@ -550,7 +550,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
char *space; char *space;
zstr class_name = get_active_class_name(&space TSRMLS_CC); zstr class_name = get_active_class_name(&space TSRMLS_CC);
int origin_len; int origin_len;
zstr function = (zstr)NULL; zstr function = NULL_ZSTR;
char *origin; char *origin;
char *message; char *message;
char *stage; char *stage;

View file

@ -500,58 +500,58 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
zval *handler_zval; zval *handler_zval;
if (output_handler && output_handler->type == IS_STRING) { if (output_handler && output_handler->type == IS_STRING) {
char* next_handler_name; zstr next_handler_name;
char* handler_name = Z_STRVAL_P(output_handler); zstr handler_name = Z_UNIVAL_P(output_handler);
handler_len = Z_STRLEN_P(output_handler); handler_len = Z_UNILEN_P(output_handler);
result = SUCCESS; result = SUCCESS;
if (handler_len && handler_name[0] != '\0') { if (handler_len && handler_name.s[0] != '\0') {
while ((next_handler_name=strchr(handler_name, ',')) != NULL) { while ((next_handler_name.s=strchr(handler_name.s, ',')) != NULL) {
len = next_handler_name-handler_name; len = next_handler_name.s-handler_name.s;
next_handler_name = estrndup(handler_name, len); next_handler_name.s = estrndup(handler_name.s, len);
handler_zval = php_ob_handler_from_string(next_handler_name, len TSRMLS_CC); handler_zval = php_ob_handler_from_string(next_handler_name.s, len TSRMLS_CC);
result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); result = php_ob_init_named(initial_size, block_size, IS_STRING, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) { if (result != SUCCESS) {
zval_dtor(handler_zval); zval_dtor(handler_zval);
FREE_ZVAL(handler_zval); FREE_ZVAL(handler_zval);
} }
handler_name += len+1; handler_name.s += len+1;
handler_len -= len+1; handler_len -= len+1;
efree(next_handler_name); efree(next_handler_name.s);
} }
} }
if (result == SUCCESS) { if (result == SUCCESS) {
handler_zval = php_ob_handler_from_string(handler_name, handler_len TSRMLS_CC); handler_zval = php_ob_handler_from_string(handler_name.s, handler_len TSRMLS_CC);
result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC); result = php_ob_init_named(initial_size, block_size, IS_STRING, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) { if (result != SUCCESS) {
zval_dtor(handler_zval); zval_dtor(handler_zval);
FREE_ZVAL(handler_zval); FREE_ZVAL(handler_zval);
} }
} }
} else if (output_handler && output_handler->type == IS_UNICODE) { } else if (output_handler && output_handler->type == IS_UNICODE) {
UChar* next_handler_name; zstr next_handler_name;
UChar* handler_name = Z_USTRVAL_P(output_handler); zstr handler_name = Z_UNIVAL_P(output_handler);
handler_len = Z_USTRLEN_P(output_handler); handler_len = Z_UNILEN_P(output_handler);
result = SUCCESS; result = SUCCESS;
if (handler_len && handler_name[0] != 0) { if (handler_len && handler_name.u[0] != 0) {
while ((next_handler_name=u_strchr(handler_name, ',')) != NULL) { while ((next_handler_name.u=u_strchr(handler_name.u, ',')) != NULL) {
len = next_handler_name-handler_name; len = next_handler_name.u-handler_name.u;
next_handler_name = eustrndup(handler_name, len); next_handler_name.u = eustrndup(handler_name.u, len);
handler_zval = php_ob_handler_from_unicode(next_handler_name, len TSRMLS_CC); handler_zval = php_ob_handler_from_unicode(next_handler_name.u, len TSRMLS_CC);
result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); result = php_ob_init_named(initial_size, block_size, IS_UNICODE, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) { if (result != SUCCESS) {
zval_dtor(handler_zval); zval_dtor(handler_zval);
FREE_ZVAL(handler_zval); FREE_ZVAL(handler_zval);
} }
handler_name += len+1; handler_name.u += len+1;
handler_len -= len+1; handler_len -= len+1;
efree(next_handler_name); efree(next_handler_name.u);
} }
} }
if (result == SUCCESS) { if (result == SUCCESS) {
handler_zval = php_ob_handler_from_unicode(handler_name, handler_len TSRMLS_CC); handler_zval = php_ob_handler_from_unicode(handler_name.u, handler_len TSRMLS_CC);
result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC); result = php_ob_init_named(initial_size, block_size, IS_UNICODE, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) { if (result != SUCCESS) {
zval_dtor(handler_zval); zval_dtor(handler_zval);
FREE_ZVAL(handler_zval); FREE_ZVAL(handler_zval);
@ -582,7 +582,10 @@ static int php_ob_init(uint initial_size, uint block_size, zval *output_handler,
php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use ob_start(array($object,'method')) to specify instance $object and the name of a method of class %v to use as output handler", Z_OBJCE_P(output_handler)->name); php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use ob_start(array($object,'method')) to specify instance $object and the name of a method of class %v to use as output handler", Z_OBJCE_P(output_handler)->name);
result = FAILURE; result = FAILURE;
} else { } else {
result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC); zstr z_name;
z_name.s = OB_DEFAULT_HANDLER_NAME;
result = php_ob_init_named(initial_size, block_size, IS_STRING, z_name, NULL, chunk_size, erase TSRMLS_CC);
} }
return result; return result;
} }

View file

@ -296,7 +296,8 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a
while (1) { while (1) {
if (is_array) { if (is_array) {
UChar *escaped_index = NULL, *index_s; zstr escaped_index = NULL_ZSTR;
UChar *index_s;
int32_t new_idx_len = 0; int32_t new_idx_len = 0;
ip++; ip++;
@ -332,18 +333,18 @@ PHPAPI void php_u_register_variable_ex(UChar *var, zval *val, zval *track_vars_a
/* UTODO fix for magic_quotes_gpc case */ /* UTODO fix for magic_quotes_gpc case */
/* no need to addslashes() the index if it's the main variable name */ /* no need to addslashes() the index if it's the main variable name */
//escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); //escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
escaped_index = index; escaped_index.u = index;
} else { } else {
escaped_index = index; escaped_index.u = index;
} }
if (zend_u_symtable_find(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE if (zend_u_symtable_find(symtable1, IS_UNICODE, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
MAKE_STD_ZVAL(gpc_element); MAKE_STD_ZVAL(gpc_element);
array_init(gpc_element); array_init(gpc_element);
zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
} }
if (index!=escaped_index) { if (index!=escaped_index.u) {
efree(escaped_index); efree(escaped_index.u);
} }
} }
symtable1 = Z_ARRVAL_PP(gpc_element_p); symtable1 = Z_ARRVAL_PP(gpc_element_p);
@ -368,8 +369,10 @@ plain_var:
} else { } else {
/* UTODO fix for php_addslashes case */ /* UTODO fix for php_addslashes case */
//char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
UChar *escaped_index = index; zstr escaped_index;
zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
escaped_index.u = index;
zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
//efree(escaped_index); //efree(escaped_index);
} }
break; break;

View file

@ -264,7 +264,7 @@ static void add_u_protected_variable(UChar *varname TSRMLS_DC)
int dummy=1; int dummy=1;
normalize_u_protected_variable(varname TSRMLS_CC); normalize_u_protected_variable(varname TSRMLS_CC);
zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1, &dummy, sizeof(int), NULL); zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, ZSTR(varname), u_strlen(varname)+1, &dummy, sizeof(int), NULL);
} }
@ -278,7 +278,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC)
static zend_bool is_u_protected_variable(UChar *varname TSRMLS_DC) static zend_bool is_u_protected_variable(UChar *varname TSRMLS_DC)
{ {
normalize_u_protected_variable(varname TSRMLS_CC); normalize_u_protected_variable(varname TSRMLS_CC);
return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1); return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, ZSTR(varname), u_strlen(varname)+1);
} }
@ -1316,7 +1316,7 @@ var_done:
} }
temp_filename = EMPTY_STR; temp_filename = EMPTY_STR;
} else { } else {
zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, (zstr)temp_filename, u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL); zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, ZSTR(temp_filename), u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL);
} }
/* is_arr_upload is true when name of file upload field /* is_arr_upload is true when name of file upload field