# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
#endif
+#ifndef __GNUC__
+ZEND_API zstr null_zstr;
+ZEND_API zstr empty_zstr;
+#endif
+
#if defined(ZEND_WIN32) && ZEND_DEBUG
BOOL WINAPI IsDebuggerPresent(VOID);
#endif
case IS_OBJECT:
{
HashTable *properties = NULL;
- zstr class_name = (zstr)NULL;
+ zstr class_name = NULL_ZSTR;
zend_uint clen;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
case IS_OBJECT:
{
HashTable *properties = NULL;
- zstr class_name = (zstr)NULL;
+ zstr class_name = NULL_ZSTR;
zend_uint clen;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
extern zend_unicode_globals unicode_globals;
#endif
+#ifndef __GNUC__
+ null_zstr.v = NULL;
+ empty_zstr.u = EMPTY_STR;
+#endif
+
#ifdef ZTS
ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
#else
void *v;
} 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")
#undef SUCCESS
UChar *val;
int len;
} ustr;
+ struct { /* Unicersal string type */
+ zstr val;
+ int len;
+ } uni;
HashTable *ht; /* hash table value */
zend_object_value obj;
} zvalue_value;
zstr prot_name;
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);
property_info.name = prot_name;
property_info.name_length = prot_name_length;
zstr prot_name;
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);
pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS);
}
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_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_class_entry *old_scope = EG(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;
if (!property) {
return FAILURE;
zend_class_entry *old_scope = EG(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;
return property?*property:NULL;
}
#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) \
ZEND_SET_SYMBOL(&EG(symbol_table), name, var)
ZEND_FUNCTION(get_class)
{
zval **arg;
- zstr name = (zstr)EMPTY_STR;
+ zstr name = EMPTY_ZSTR;
zend_uint name_len = 0;
int dup;
array_init(return_value);
while (ptr) {
- zstr free_class_name = (zstr)NULL;
+ zstr free_class_name = NULL_ZSTR;
int function_name_string = 1;
- class_name = (zstr)NULL;
+ class_name = NULL_ZSTR;
call_type = NULL;
arg_array = NULL;
class_name = ptr->function_state.function->common.scope->name;
call_type = "::";
} else {
- class_name = (zstr)NULL;
+ class_name = NULL_ZSTR;
call_type = NULL;
}
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
fn_flags = 0;
}
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);
}
} else {
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;
if (op == ZEND_RECV_INIT) {
if (Z_TYPE(initialization->u.constant) == IS_NULL ||
}
}
} else {
- cur_arg_info->class_name.v = NULL;
+ cur_arg_info->class_name = NULL_ZSTR;
cur_arg_info->class_name_len = 0;
}
opline->result.u.EA.type |= EXT_TYPE_UNUSED;
zstr prot_name;
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) {
zval **prop;
HashTable *ht;
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);
}
struct _zend_module_entry *module;
} 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 {
zend_uchar type; /* MUST be the first element of this struct! */
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)
} else {
lookup_name_len = c->name_len;
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) {
cur_arg_info = &zf->common.arg_info[arg_num-1];
fname = zf->common.function_name;
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 (!arg) {
/* 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.
*/
-#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);
if (space) {
*space = "";
}
- return (zstr)EMPTY_STR;
+ return EMPTY_ZSTR;
}
switch (EG(function_state_ptr)->function->type) {
case ZEND_USER_FUNCTION:
if (space) {
*space = ce ? "::" : "";
}
- return ce ? ce->name : (zstr)EMPTY_STR;
+ return ce ? ce->name : EMPTY_ZSTR;
}
default:
if (space) {
*space = "";
}
- return (zstr)EMPTY_STR;
+ return EMPTY_ZSTR;
}
}
ZEND_API zstr get_active_function_name(TSRMLS_D)
{
+ zstr ret;
+
if (!zend_is_executing(TSRMLS_C)) {
- return (zstr)NULL;
+ return NULL_ZSTR;
}
switch (EG(function_state_ptr)->function->type) {
case ZEND_USER_FUNCTION: {
if (function_name.v) {
return function_name;
+ } else if (UG(unicode)) {
+ ret.u = u_main;
} else {
- return UG(unicode)?(zstr)u_main:(zstr)"main";
+ ret.s = "main";
}
+ return ret;
}
break;
case ZEND_INTERNAL_FUNCTION:
return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
break;
default:
- return (zstr)NULL;
+ return NULL_ZSTR;
}
}
break;
case IS_BOOL:
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;
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;
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;
}
zend_hash_move_forward(Z_ARRVAL_P(p));
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_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.function_name);
}
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_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_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);
}
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_FMT "%v%s%v%s"
#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]->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 ? ", ..." : "")
typedef struct _zend_abstract_info {
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);
}
/*
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) \
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_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)
{
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);
}
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)
if (q->nKeyLength==0) {
zend_hash_index_del(ht, q->h);
} 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 (p->nKeyLength == 0) {
zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
} 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) {
pCopyConstructor(new_entry);
pCopyConstructor(t);
}
} 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);
}
}
p = source->pListHead;
while (p) {
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);
}
}
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);
}
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);
}
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_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_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)
return 1;
}
} 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(ht2);
return 1;
if (type == 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 {
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);
}
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));
- return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, (zstr)arKey, nKeyLength, 0);
+ 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);
}
ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
if (!fn_proxy || !*fn_proxy) {
if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
/* 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) {
*fn_proxy = fcic.function_handler;
if (!obj_ce) {
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) {
}
<ST_IN_SCRIPTING>"__CLASS__" {
- zstr class_name = (zstr)NULL;
+ zstr class_name = NULL_ZSTR;
if (CG(active_class_entry)) {
class_name = CG(active_class_entry)->name;
}
<ST_IN_SCRIPTING>"__FUNCTION__" {
- zstr func_name = (zstr)NULL;
+ zstr func_name = NULL_ZSTR;
if (CG(active_op_array)) {
func_name = CG(active_op_array)->function_name;
}
<ST_IN_SCRIPTING>"__METHOD__" {
- zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : (zstr)NULL;
- zstr func_name = CG(active_op_array)? CG(active_op_array)->function_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 : NULL_ZSTR;
size_t len = 0;
if (UG(unicode)) {
*/
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) {
- 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;
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
*/
updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC);
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;
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
/* 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)) {
- 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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to private %v::__destruct() from context '%v'%s",
ce->name,
- EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR,
+ EG(scope) ? EG(scope)->name : EMPTY_ZSTR,
EG(in_execution) ? "" : " during shutdown ignored");
return;
}
zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to protected %v::__destruct() from context '%v'%s",
ce->name,
- EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR,
+ EG(scope) ? EG(scope)->name : EMPTY_ZSTR,
EG(in_execution) ? "" : " during shutdown ignored");
return;
}
return dest;
} 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)
{
+ zstr ret;
+
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 {
- 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 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) {
- UChar *ret;
int ret_len;
if (normalize) {
- zend_normalize_identifier(&ret, &ret_len, source.u, length, 1);
+ zend_normalize_identifier(&ret.u, &ret_len, source.u, length, 1);
} else {
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;
- return (zstr)ret;
- } else {
+ } else {
*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)
#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_RESVAL(zval) (zval).value.lval
-#define Z_UNIVAL(zval) ((zstr)(Z_STRVAL(zval)))
-#define Z_UNILEN(zval) Z_STRLEN(zval)
+#define Z_UNIVAL(zval) (zval).value.uni.val
+#define Z_UNILEN(zval) (zval).value.uni.len
#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_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.function_name);
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_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.function_name);
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
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)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
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);
}
}
}
if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) {
int ret;
- UChar *uname;
+ zstr name;
- uname = malloc(UBYTES(ce->name_length+1));
- u_charsToUChars(ce->name.s, uname, 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);
- free(uname);
+ name.u = malloc(UBYTES(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, name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL);
+ free(name.u);
return ret;
}
return FAILURE;
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
} 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);
}
}
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
} 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 */
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
} 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);
}
}
{
zval **stack, /* Input stack */
**val; /* Value to be popped */
- zstr key = (zstr)NULL;
+ zstr key = NULL_ZSTR;
int key_len = 0;
ulong index;
zend_uchar key_type;
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else {
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 {
- 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 (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} 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 (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} 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]) {
goto out;
if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} 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]) {
goto out;
PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen)
{
zval **val;
- zstr retval = (zstr)NULL;
+ zstr retval = NULL_ZSTR;
HashTable *object_properties;
TSRMLS_FETCH();
{
int ret = SUCCESS;
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);
- 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 (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) {
if (context->notifier) {
php_stream_notification_free(context->notifier);
ZVAL_ADDREF(*tmp);
context->notifier->dtor = user_space_stream_notifier_dtor;
}
- 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)) {
+ if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
parse_context_options(context, *tmp TSRMLS_CC);
}
- 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)) {
+ if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "input_encoding", sizeof("input_encoding"), (void**)&tmp)) {
zval strval = **tmp;
if (context->input_encoding) {
convert_to_string(&strval);
context->input_encoding = Z_STRVAL(strval);
}
- 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)) {
+ if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "output_encoding", sizeof("output_encoding"), (void**)&tmp)) {
zval strval = **tmp;
if (context->output_encoding) {
convert_to_string(&strval);
context->output_encoding = Z_STRVAL(strval);
}
- 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)) {
+ if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "default_mode", sizeof("default_mode"), (void**)&tmp)) {
zval longval = **tmp;
zval_copy_ctor(&longval);
{
int count;
zend_bool incomplete_class;
+ zstr star;
+
+ star.s = "*";
incomplete_class = php_var_serialize_class_name(buf, struc TSRMLS_CC);
/* count after serializing name, since php_var_serialize_class_name
break;
}
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);
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) {
*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);
char *space;
zstr class_name = get_active_class_name(&space TSRMLS_CC);
int origin_len;
- zstr function = (zstr)NULL;
+ zstr function = NULL_ZSTR;
char *origin;
char *message;
char *stage;
zval *handler_zval;
if (output_handler && output_handler->type == IS_STRING) {
- char* next_handler_name;
- char* handler_name = Z_STRVAL_P(output_handler);
- handler_len = Z_STRLEN_P(output_handler);
+ zstr next_handler_name;
+ zstr handler_name = Z_UNIVAL_P(output_handler);
+ handler_len = Z_UNILEN_P(output_handler);
result = SUCCESS;
- if (handler_len && handler_name[0] != '\0') {
- while ((next_handler_name=strchr(handler_name, ',')) != NULL) {
- len = next_handler_name-handler_name;
- next_handler_name = estrndup(handler_name, len);
- handler_zval = php_ob_handler_from_string(next_handler_name, 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);
+ if (handler_len && handler_name.s[0] != '\0') {
+ while ((next_handler_name.s=strchr(handler_name.s, ',')) != NULL) {
+ len = next_handler_name.s-handler_name.s;
+ next_handler_name.s = estrndup(handler_name.s, len);
+ 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, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) {
zval_dtor(handler_zval);
FREE_ZVAL(handler_zval);
}
- handler_name += len+1;
+ handler_name.s += len+1;
handler_len -= len+1;
- efree(next_handler_name);
+ efree(next_handler_name.s);
}
}
if (result == SUCCESS) {
- handler_zval = php_ob_handler_from_string(handler_name, 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);
+ 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, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) {
zval_dtor(handler_zval);
FREE_ZVAL(handler_zval);
}
}
} else if (output_handler && output_handler->type == IS_UNICODE) {
- UChar* next_handler_name;
- UChar* handler_name = Z_USTRVAL_P(output_handler);
- handler_len = Z_USTRLEN_P(output_handler);
+ zstr next_handler_name;
+ zstr handler_name = Z_UNIVAL_P(output_handler);
+ handler_len = Z_UNILEN_P(output_handler);
result = SUCCESS;
- if (handler_len && handler_name[0] != 0) {
- while ((next_handler_name=u_strchr(handler_name, ',')) != NULL) {
- len = next_handler_name-handler_name;
- next_handler_name = eustrndup(handler_name, len);
- handler_zval = php_ob_handler_from_unicode(next_handler_name, 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);
+ if (handler_len && handler_name.u[0] != 0) {
+ while ((next_handler_name.u=u_strchr(handler_name.u, ',')) != NULL) {
+ len = next_handler_name.u-handler_name.u;
+ next_handler_name.u = eustrndup(handler_name.u, len);
+ 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, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) {
zval_dtor(handler_zval);
FREE_ZVAL(handler_zval);
}
- handler_name += len+1;
+ handler_name.u += len+1;
handler_len -= len+1;
- efree(next_handler_name);
+ efree(next_handler_name.u);
}
}
if (result == SUCCESS) {
- handler_zval = php_ob_handler_from_unicode(handler_name, 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);
+ 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, handler_name, handler_zval, chunk_size, erase TSRMLS_CC);
if (result != SUCCESS) {
zval_dtor(handler_zval);
FREE_ZVAL(handler_zval);
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;
} 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;
}
while (1) {
if (is_array) {
- UChar *escaped_index = NULL, *index_s;
+ zstr escaped_index = NULL_ZSTR;
+ UChar *index_s;
int32_t new_idx_len = 0;
ip++;
/* UTODO fix for magic_quotes_gpc case */
/* 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 = index;
+ escaped_index.u = index;
} 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) {
MAKE_STD_ZVAL(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) {
- efree(escaped_index);
+ if (index!=escaped_index.u) {
+ efree(escaped_index.u);
}
}
symtable1 = Z_ARRVAL_PP(gpc_element_p);
} else {
/* UTODO fix for php_addslashes case */
//char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
- UChar *escaped_index = index;
- zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
+ zstr escaped_index;
+
+ 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);
}
break;
int dummy=1;
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);
}
static zend_bool is_u_protected_variable(UChar *varname TSRMLS_DC)
{
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);
}
}
temp_filename = EMPTY_STR;
} 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