From: Dmitry Stogov Date: Mon, 20 Feb 2006 19:03:43 +0000 (+0000) Subject: Preparation for portable string API (use macroses to access zval). X-Git-Tag: RELEASE_1_2~153 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b424a326108361ddd8cebba39e8092c411c939df;p=php Preparation for portable string API (use macroses to access zval). --- diff --git a/Zend/zend.c b/Zend/zend.c index ca3eb8c79a..13dce09ff8 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -339,11 +339,11 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) ZEND_API void zend_make_string_zval(zval *expr, zval *expr_copy, int *use_copy) { - if (expr->type==IS_STRING) { + if (Z_TYPE_P(expr)==IS_STRING) { *use_copy = 0; return; } - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_OBJECT: { TSRMLS_FETCH(); @@ -369,7 +369,7 @@ ZEND_API void zend_make_string_zval(zval *expr, zval *expr_copy, int *use_copy) convert_to_string(expr_copy); break; } - expr_copy->type = IS_STRING; + Z_TYPE_P(expr_copy) = IS_STRING; *use_copy = 1; } @@ -380,33 +380,33 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop if ( /* UTODO: clean this up */ - (expr->type == IS_STRING && + (Z_TYPE_P(expr) == IS_STRING && (!strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), &temp), ucnv_getName(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &temp))))) { *use_copy = 0; return; } - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_NULL: - expr_copy->value.str.len = 0; - expr_copy->value.str.val = STR_EMPTY_ALLOC(); + Z_STRLEN_P(expr_copy) = 0; + Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); break; case IS_BOOL: - if (expr->value.lval) { - expr_copy->value.str.len = 1; - expr_copy->value.str.val = estrndup("1", 1); + if (Z_LVAL_P(expr)) { + Z_STRLEN_P(expr_copy) = 1; + Z_STRVAL_P(expr_copy) = estrndup("1", 1); } else { - expr_copy->value.str.len = 0; - expr_copy->value.str.val = STR_EMPTY_ALLOC(); + Z_STRLEN_P(expr_copy) = 0; + Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; case IS_RESOURCE: - expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); - expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval); + Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); + Z_STRLEN_P(expr_copy) = sprintf(Z_STRVAL_P(expr_copy), "Resource id #%ld", Z_LVAL_P(expr)); break; case IS_ARRAY: - expr_copy->value.str.len = sizeof("Array")-1; - expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len); + Z_STRLEN_P(expr_copy) = sizeof("Array")-1; + Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy)); break; case IS_OBJECT: if(Z_OBJ_HT_P(expr)->cast_object && Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { @@ -438,7 +438,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } break; } - expr_copy->type = IS_STRING; + Z_TYPE_P(expr_copy) = IS_STRING; *use_copy = 1; } @@ -447,11 +447,11 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy) { TSRMLS_FETCH(); - if (expr->type==IS_UNICODE) { + if (Z_TYPE_P(expr)==IS_UNICODE) { *use_copy = 0; return; } - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_OBJECT: if(Z_OBJ_HT_P(expr)->cast_object && Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_UNICODE TSRMLS_CC) == SUCCESS) { break; @@ -468,8 +468,8 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy) ZVAL_EMPTY_UNICODE(expr_copy); break; case IS_ARRAY: - expr_copy->value.ustr.len = sizeof("Array")-1; - expr_copy->value.ustr.val = zend_ascii_to_unicode("Array", sizeof("Array") ZEND_FILE_LINE_CC); + Z_USTRLEN_P(expr_copy) = sizeof("Array")-1; + Z_USTRVAL_P(expr_copy) = zend_ascii_to_unicode("Array", sizeof("Array") ZEND_FILE_LINE_CC); break; default: *expr_copy = *expr; @@ -477,7 +477,7 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy) convert_to_unicode(expr_copy); break; } - expr_copy->type = IS_UNICODE; + Z_TYPE_P(expr_copy) = IS_UNICODE; *use_copy = 1; } @@ -497,32 +497,32 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in if (use_copy) { expr = &expr_copy; } - if (expr->value.str.len==0) { /* optimize away empty strings */ + if (Z_STRLEN_P(expr)==0) { /* optimize away empty strings */ if (use_copy) { zval_dtor(expr); } return 0; } - write_func(expr->value.str.val, expr->value.str.len); + write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr)); if (use_copy) { zval_dtor(expr); } - return expr->value.str.len; + return Z_STRLEN_P(expr); } ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) { - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_ARRAY: ZEND_PUTS("Array ("); - if (++expr->value.ht->nApplyCount>1) { + if (++Z_ARRVAL_P(expr)->nApplyCount>1) { ZEND_PUTS(" *RECURSION*"); - expr->value.ht->nApplyCount--; + Z_ARRVAL_P(expr)->nApplyCount--; return; } - print_flat_hash(expr->value.ht TSRMLS_CC); + print_flat_hash(Z_ARRVAL_P(expr) TSRMLS_CC); ZEND_PUTS(")"); - expr->value.ht->nApplyCount--; + Z_ARRVAL_P(expr)->nApplyCount--; break; case IS_OBJECT: { @@ -570,16 +570,16 @@ ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) { - switch (expr->type) { + switch (Z_TYPE_P(expr)) { case IS_ARRAY: ZEND_PUTS("Array\n"); - if (++expr->value.ht->nApplyCount>1) { + if (++Z_ARRVAL_P(expr)->nApplyCount>1) { ZEND_PUTS(" *RECURSION*"); - expr->value.ht->nApplyCount--; + Z_ARRVAL_P(expr)->nApplyCount--; return; } - print_hash(expr->value.ht, indent, 0 TSRMLS_CC); - expr->value.ht->nApplyCount--; + print_hash(Z_ARRVAL_P(expr), indent, 0 TSRMLS_CC); + Z_ARRVAL_P(expr)->nApplyCount--; break; case IS_OBJECT: { @@ -1029,7 +1029,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i /* This zval can be used to initialize allocate zval's to an uninit'ed value */ zval_used_for_init.is_ref = 0; zval_used_for_init.refcount = 1; - zval_used_for_init.type = IS_NULL; + Z_TYPE(zval_used_for_init) = IS_NULL; #ifdef ZTS ts_allocate_id(&unicode_globals_id, sizeof(zend_unicode_globals), (ts_allocate_ctor) unicode_globals_ctor, (ts_allocate_dtor) unicode_globals_dtor); @@ -1436,11 +1436,11 @@ ZEND_API void zend_error(int type, const char *format, ...) # endif #endif va_copy(usr_copy, args); - z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0, format, usr_copy); - z_error_message->type = IS_STRING; + Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); + Z_TYPE_P(z_error_message) = IS_STRING; if (UG(unicode)) { - char *str = z_error_message->value.str.val; - int len = z_error_message->value.str.len; + char *str = Z_STRVAL_P(z_error_message); + int len = Z_STRLEN_P(z_error_message); ZVAL_RT_STRINGL(z_error_message, str, len, 1); efree(str); @@ -1449,18 +1449,18 @@ ZEND_API void zend_error(int type, const char *format, ...) va_end(usr_copy); #endif - z_error_type->value.lval = type; - z_error_type->type = IS_LONG; + Z_LVAL_P(z_error_type) = type; + Z_TYPE_P(z_error_type) = IS_LONG; if (error_filename) { ZVAL_RT_STRING(z_error_filename, error_filename, 1); } - z_error_lineno->value.lval = error_lineno; - z_error_lineno->type = IS_LONG; + Z_LVAL_P(z_error_lineno) = error_lineno; + Z_TYPE_P(z_error_lineno) = IS_LONG; - z_context->value.ht = EG(active_symbol_table); - z_context->type = IS_ARRAY; + Z_ARRVAL_P(z_context) = EG(active_symbol_table); + Z_TYPE_P(z_context) = IS_ARRAY; zval_copy_ctor(z_context); params = (zval ***) emalloc(sizeof(zval **)*5); diff --git a/Zend/zend.h b/Zend/zend.h index 81f0709363..7310ed1593 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -645,7 +645,7 @@ END_EXTERN_C() zval *original_var = varptr; \ ALLOC_ZVAL(varptr); \ varptr->value = original_var->value; \ - varptr->type = original_var->type; \ + Z_TYPE_P(varptr) = Z_TYPE_P(original_var); \ varptr->is_ref = 0; \ varptr->refcount = 1; \ zval_copy_ctor(varptr); \ @@ -658,6 +658,7 @@ END_EXTERN_C() #define ZEND_INTERNAL_ENCODING "UTF-16" +#include "zend_operators.h" #include "zend_variables.h" #define ZEND_U_EQUAL(type, ustr, ulen, str, slen) \ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 77c5937799..21039ecca6 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -169,7 +169,7 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr if(!dup) { efree(class_name); } - value_ptr->value.obj = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); + Z_OBJVAL_P(value_ptr) = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); zval_ptr_dtor(value); *value = value_ptr; } @@ -1008,10 +1008,10 @@ ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC) { TSRMLS_FETCH(); - ALLOC_HASHTABLE_REL(arg->value.ht); + ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg)); - zend_u_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); - arg->type = IS_ARRAY; + zend_u_hash_init(Z_ARRVAL_P(arg), 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); + Z_TYPE_P(arg) = IS_ARRAY; return SUCCESS; } @@ -1141,9 +1141,9 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type zend_update_class_constants(class_type TSRMLS_CC); - arg->type = IS_OBJECT; + Z_TYPE_P(arg) = IS_OBJECT; if (class_type->create_object == NULL) { - arg->value.obj = zend_objects_new(&object, class_type TSRMLS_CC); + Z_OBJVAL_P(arg) = zend_objects_new(&object, class_type TSRMLS_CC); if (properties) { object->properties = properties; } else { @@ -1152,7 +1152,7 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); } } else { - arg->value.obj = class_type->create_object(class_type TSRMLS_CC); + Z_OBJVAL_P(arg) = class_type->create_object(class_type TSRMLS_CC); } return SUCCESS; } @@ -2514,7 +2514,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze { int retval; char *lcname, *lmname, *mname, *colon; - int clen, mlen; + unsigned int clen, mlen; zend_function *fptr; zend_class_entry **pce; HashTable *ftable; @@ -2603,7 +2603,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC) { char *lcname; - int lcname_len; + unsigned int lcname_len; zend_class_entry *ce_local, **pce; zend_function *fptr_local; zval **zobj_ptr_local; @@ -3259,7 +3259,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in if (*property != value) { if (PZVAL_IS_REF(*property)) { zval_dtor(*property); - (*property)->type = value->type; + Z_TYPE_PP(property) = Z_TYPE_P(value); (*property)->value = value->value; if (value->refcount > 0) { zval_copy_ctor(*property); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 035b4238e6..48a6c72f37 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -613,13 +613,13 @@ END_EXTERN_C() #if ZEND_DEBUG #define CHECK_ZVAL_STRING(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", (z)->value.str.val); } + if (Z_STRVAL_P(z)[Z_STRLEN_P(z)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } #define CHECK_ZVAL_STRING_REL(z) \ - if ((z)->value.str.val[ (z)->value.str.len ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", (z)->value.str.val ZEND_FILE_LINE_RELAY_CC); } + if (Z_STRVAL_P(z)[Z_STRLEN_P(z)] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } #define CHECK_ZVAL_UNICODE(z) \ - if ((z)->value.ustr.val[ (z)->value.ustr.len ] != 0 ) { zend_error(E_WARNING, "String is not zero-terminated"); } + if (Z_USTRVAL_P(z)[Z_USTRLEN_P(z)] != 0 ) { zend_error(E_WARNING, "String is not zero-terminated"); } #define CHECK_ZVAL_UNICODE_REL(z) \ - if ((z)->value.ustr.val[ (z)->value.ustr.len ] != 0) { zend_error(E_WARNING, "String is not zero-terminated (source: %s:%d)", ZEND_FILE_LINE_RELAY_C); } + if (Z_USTRVAL_P(z)[Z_USTRLEN_P(z)] != 0) { zend_error(E_WARNING, "String is not zero-terminated (source: %s:%d)", ZEND_FILE_LINE_RELAY_C); } #else #define CHECK_ZVAL_STRING(z) #define CHECK_ZVAL_STRING_REL(z) @@ -627,42 +627,42 @@ END_EXTERN_C() #define CHECK_ZVAL_UNICODE_REL(z) #endif -#define ZVAL_RESOURCE(z, l) { \ - (z)->type = IS_RESOURCE; \ - (z)->value.lval = l; \ +#define ZVAL_RESOURCE(z, l) { \ + Z_TYPE_P(z) = IS_RESOURCE; \ + Z_LVAL_P(z) = l; \ } -#define ZVAL_BOOL(z, b) { \ - (z)->type = IS_BOOL; \ - (z)->value.lval = ((b) != 0); \ +#define ZVAL_BOOL(z, b) { \ + Z_TYPE_P(z) = IS_BOOL; \ + Z_LVAL_P(z) = ((b) != 0); \ } -#define ZVAL_NULL(z) { \ - (z)->type = IS_NULL; \ +#define ZVAL_NULL(z) { \ + Z_TYPE_P(z) = IS_NULL; \ } -#define ZVAL_LONG(z, l) { \ - (z)->type = IS_LONG; \ - (z)->value.lval = l; \ +#define ZVAL_LONG(z, l) { \ + Z_TYPE_P(z) = IS_LONG; \ + Z_LVAL_P(z) = l; \ } -#define ZVAL_DOUBLE(z, d) { \ - (z)->type = IS_DOUBLE; \ - (z)->value.dval = d; \ +#define ZVAL_DOUBLE(z, d) { \ + Z_TYPE_P(z) = IS_DOUBLE; \ + Z_DVAL_P(z) = d; \ } #define ZVAL_STRING(z, s, duplicate) { \ char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = IS_STRING; \ + Z_STRLEN_P(z) = strlen(__s); \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, Z_STRLEN_P(z)):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_STRINGL(z, s, l, duplicate) { \ char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = IS_STRING; \ + Z_STRLEN_P(z) = __l; \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, __l):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_ASCII_STRING(z, s, duplicate) \ @@ -672,9 +672,9 @@ END_EXTERN_C() ZVAL_UNICODEL(z, u_str, length, 0); \ } else { \ char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = IS_STRING; \ + Z_STRLEN_P(z) = strlen(__s); \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, Z_STRLEN_P(z)):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_ASCII_STRINGL(z, s, l, duplicate) \ @@ -682,10 +682,10 @@ END_EXTERN_C() UChar *u_str = zend_ascii_to_unicode((s), (l)+1 ZEND_FILE_LINE_CC); \ ZVAL_UNICODEL(z, u_str, l, 0); \ } else { \ - char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = IS_STRING; \ + char *__s=(s); int __l=l; \ + Z_STRLEN_P(z) = __l; \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, __l):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_U_STRING(conv, z, s, duplicate) \ @@ -698,9 +698,9 @@ END_EXTERN_C() ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ char *__s=(s); \ - (z)->value.str.len = strlen(__s); \ - (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \ - (z)->type = IS_STRING; \ + Z_STRLEN_P(z) = strlen(__s); \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, Z_STRLEN_P(z)):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_U_STRINGL(conv, z, s, l, duplicate) \ @@ -711,10 +711,10 @@ END_EXTERN_C() zend_convert_to_unicode(conv, &u_str, &u_len, s, l, &status); \ ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ - char *__s=(s); int __l=l; \ - (z)->value.str.len = __l; \ - (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \ - (z)->type = IS_STRING; \ + char *__s=(s); int __l=l; \ + Z_STRLEN_P(z) = __l; \ + Z_STRVAL_P(z) = (duplicate?estrndup(__s, __l):__s); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_RT_STRING(z, s, duplicate) \ @@ -725,28 +725,28 @@ END_EXTERN_C() #define ZVAL_UNICODE(z, u, duplicate) { \ UChar *__u=(u); \ - (z)->value.ustr.len = u_strlen(__u); \ - (z)->value.ustr.val = (duplicate?eustrndup(__u, (z)->value.ustr.len):__u); \ - (z)->type = IS_UNICODE; \ + Z_USTRLEN_P(z) = u_strlen(__u); \ + Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, Z_USTRLEN_P(z)):__u); \ + Z_TYPE_P(z) = IS_UNICODE; \ } #define ZVAL_UNICODEL(z, u, l, duplicate) { \ UChar *__u=(u); int32_t __l=l; \ - (z)->value.ustr.len = __l; \ - (z)->value.ustr.val = (duplicate?eustrndup(__u, __l):__u); \ - (z)->type = IS_UNICODE; \ + Z_USTRLEN_P(z) = __l; \ + Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, __l):__u); \ + Z_TYPE_P(z) = IS_UNICODE; \ } -#define ZVAL_EMPTY_STRING(z) { \ - (z)->value.str.len = 0; \ - (z)->value.str.val = STR_EMPTY_ALLOC(); \ - (z)->type = IS_STRING; \ +#define ZVAL_EMPTY_STRING(z) { \ + Z_STRLEN_P(z) = 0; \ + Z_STRVAL_P(z) = STR_EMPTY_ALLOC(); \ + Z_TYPE_P(z) = IS_STRING; \ } #define ZVAL_EMPTY_UNICODE(z) { \ - (z)->value.ustr.len = 0; \ - (z)->value.ustr.val = USTR_MAKE(""); \ - (z)->type = IS_UNICODE; \ + Z_USTRLEN_P(z) = 0; \ + Z_USTRVAL_P(z) = USTR_MAKE(""); \ + Z_TYPE_P(z) = IS_UNICODE; \ } #define ZVAL_ZVAL(z, zv, copy, dtor) { \ @@ -925,8 +925,8 @@ END_EXTERN_C() zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \ } -#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL))) -#define ZVAL_IS_NULL(z) ((z)->type==IS_NULL) +#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL))) +#define ZVAL_IS_NULL(z) (Z_TYPE_P(z)==IS_NULL) /* For compatibility */ #define ZEND_MINIT ZEND_MODULE_STARTUP_N diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index a56d22b0fc..6edd6146ff 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -659,7 +659,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC) if (zend_get_configuration_directive("display_memory_cache_stats", sizeof("display_memory_cache_stats"), &display_memory_cache_stats)==FAILURE) { break; } - if (!atoi(display_memory_cache_stats.value.str.val)) { + if (!atoi(Z_STRVAL(display_memory_cache_stats))) { break; } fprintf(stderr, "Memory cache statistics\n" diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 95dc9efc35..0d35011691 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -201,7 +201,7 @@ ZEND_FUNCTION(func_get_arg) RETURN_FALSE; } convert_to_long_ex(z_requested_offset); - requested_offset = (*z_requested_offset)->value.lval; + requested_offset = Z_LVAL_PP(z_requested_offset); if (requested_offset < 0) { zend_error(E_WARNING, "func_get_arg(): The argument number should be >= 0"); @@ -265,7 +265,7 @@ ZEND_FUNCTION(func_get_args) *element = **((zval **) (p-(arg_count-i))); zval_copy_ctor(element); INIT_PZVAL(element); - zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &element, sizeof(zval *), NULL); } } /* }}} */ @@ -276,7 +276,7 @@ ZEND_FUNCTION(func_get_args) ZEND_NAMED_FUNCTION(zend_if_strlen) { zval **str; - + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -306,7 +306,7 @@ ZEND_FUNCTION(strcmp) void *s1, *s2; int32_t s1_len, s2_len; zend_uchar s1_type, s2_type; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len, &s1_type, &s2, &s2_len, &s2_type) == FAILURE) { return; @@ -328,7 +328,7 @@ ZEND_FUNCTION(strncmp) int32_t s1_len, s2_len; long count; zend_uchar s1_type, s2_type; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TTl", &s1, &s1_len, &s1_type, &s2, &s2_len, &s2_type, &count) == FAILURE) { return; @@ -371,7 +371,7 @@ ZEND_FUNCTION(strncasecmp) int s1_len, s2_len; zend_uchar s1_type, s2_type; long len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TTl", &s1, &s1_len, &s1_type, &s2, &s2_len, &s2_type, &len) == FAILURE) { return; @@ -395,7 +395,7 @@ ZEND_FUNCTION(each) ulong num_key; zval **inserted_pointer; HashTable *target_hash; - + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -420,9 +420,9 @@ ZEND_FUNCTION(each) tmp->refcount=0; entry=tmp; } - zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(return_value), 1, &entry, sizeof(zval *), NULL); entry->refcount++; - zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "value", sizeof("value"), &entry, sizeof(zval *), NULL); entry->refcount++; /* add the key elements */ @@ -437,7 +437,7 @@ ZEND_FUNCTION(each) add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer); break; } - zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL); (*inserted_pointer)->refcount++; zend_hash_move_forward(target_hash); } @@ -479,7 +479,7 @@ ZEND_FUNCTION(define) zval **var, **val, **non_cs; int case_sensitive; zend_constant c; - + switch (ZEND_NUM_ARGS()) { case 2: if (zend_get_parameters_ex(2, &var, &val)==FAILURE) { @@ -492,7 +492,7 @@ ZEND_FUNCTION(define) RETURN_FALSE; } convert_to_long_ex(non_cs); - if ((*non_cs)->value.lval) { + if (Z_LVAL_PP(non_cs)) { case_sensitive = 0; } else { case_sensitive = CONST_CS; @@ -503,7 +503,7 @@ ZEND_FUNCTION(define) break; } - switch ((*val)->type) { + switch (Z_TYPE_PP(val)) { case IS_LONG: case IS_DOUBLE: case IS_STRING: @@ -521,7 +521,7 @@ ZEND_FUNCTION(define) if (Z_TYPE_PP(var) != (UG(unicode)?IS_UNICODE:IS_STRING)) { convert_to_text_ex(var); } - + c.value = **val; zval_copy_ctor(&c.value); c.flags = case_sensitive; /* non persistent */ @@ -547,11 +547,11 @@ ZEND_FUNCTION(defined) { zval **var; zval c; - + if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &var)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } - + convert_to_text_ex(var); if (zend_u_get_constant(Z_TYPE_PP(var), Z_UNIVAL_PP(var), Z_UNILEN_PP(var), &c TSRMLS_CC)) { zval_dtor(&c); @@ -568,10 +568,10 @@ ZEND_FUNCTION(defined) ZEND_FUNCTION(get_class) { zval **arg; - char *name = EMPTY_STR; + char *name = (char*)EMPTY_STR; zend_uint name_len = 0; int dup; - + if (!ZEND_NUM_ARGS()) { if (EG(scope)) { RETURN_TEXTL(EG(scope)->name, EG(scope)->name_length, 1); @@ -601,7 +601,7 @@ ZEND_FUNCTION(get_parent_class) zend_class_entry *ce = NULL; char *name; zend_uint name_length; - + if (!ZEND_NUM_ARGS()) { ce = EG(scope); if (ce && ce->parent) { @@ -623,7 +623,7 @@ ZEND_FUNCTION(get_parent_class) } } else if (Z_TYPE_PP(arg) == (UG(unicode)?IS_UNICODE:IS_STRING)) { zend_class_entry **pce; - + if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_UNIVAL_PP(arg), Z_UNILEN_PP(arg), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } @@ -655,13 +655,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) zend_error(E_WARNING, "Unknown class passed as parameter"); RETURN_FALSE; } - instance_ce = *the_ce; + instance_ce = *the_ce; } else if (Z_TYPE_PP(obj) != IS_OBJECT) { RETURN_FALSE; } else { instance_ce = NULL; } - + /* TBI!! new object handlers */ if (Z_TYPE_PP(obj) == IS_OBJECT && !HAS_CLASS_ENTRY(**obj)) { RETURN_FALSE; @@ -752,12 +752,12 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re zval_copy_ctor(prop_copy); INIT_PZVAL(prop_copy); - /* this is necessary to make it able to work with default array + /* this is necessary to make it able to work with default array * properties, returned to user */ if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) { zval_update_constant(&prop_copy, 0 TSRMLS_CC); } - + add_u_assoc_zval(return_value, key_type==HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, prop_name, prop_copy); } } @@ -807,7 +807,7 @@ ZEND_FUNCTION(get_object_vars) ZEND_WRONG_PARAM_COUNT(); } - if ((*obj)->type != IS_OBJECT) { + if (Z_TYPE_PP(obj) != IS_OBJECT) { RETURN_FALSE; } if (Z_OBJ_HT_PP(obj)->get_properties == NULL) { @@ -883,7 +883,7 @@ ZEND_FUNCTION(get_class_methods) zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos); while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) { - if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC) + if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC) || (EG(scope) && (((mptr->common.fn_flags & ZEND_ACC_PROTECTED) && instanceof_function(EG(scope), mptr->common.scope TSRMLS_CC)) @@ -891,7 +891,7 @@ ZEND_FUNCTION(get_class_methods) EG(scope) == mptr->common.scope)))) { MAKE_STD_ZVAL(method_name); ZVAL_TEXT(method_name, mptr->common.function_name, 1); - zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name, sizeof(zval *), NULL); } zend_hash_move_forward_ex(&ce->function_table, &pos); } @@ -907,7 +907,7 @@ ZEND_FUNCTION(method_exists) unsigned int lcname_len; char *lcname; zend_class_entry * ce, **pce; - + if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -933,11 +933,11 @@ ZEND_FUNCTION(method_exists) union _zend_function *func = NULL; efree(lcname); - if (Z_TYPE_PP(klass) == IS_OBJECT + if (Z_TYPE_PP(klass) == IS_OBJECT && Z_OBJ_HT_PP(klass)->get_method != NULL && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name) TSRMLS_CC)) != NULL ) { - if (func->type == ZEND_INTERNAL_FUNCTION + if (func->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)func)->handler == zend_std_call_user_call ) { efree(((zend_internal_function*)func)->function_name); @@ -972,7 +972,7 @@ ZEND_FUNCTION(property_exists) RETURN_FALSE; } - switch((*object)->type) { + switch(Z_TYPE_PP(object)) { case IS_STRING: case IS_UNICODE: if (!Z_UNILEN_PP(object)) { @@ -1006,7 +1006,7 @@ ZEND_FUNCTION(property_exists) } RETURN_BOOL(EG(scope) == ce); RETURN_FALSE; - + case IS_OBJECT: if (Z_OBJ_HANDLER_PP(object, has_property) && Z_OBJ_HANDLER_PP(object, has_property)(*object, *property, 2 TSRMLS_CC)) { RETURN_TRUE; @@ -1038,7 +1038,7 @@ ZEND_FUNCTION(class_exists) } if (!autoload) { - lc_name = zend_u_str_case_fold(type, class_name, class_name_len, 1, &lc_name_len); + lc_name = zend_u_str_case_fold(type, class_name, class_name_len, 1, &lc_name_len); found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce); efree(lc_name); RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE)); @@ -1069,7 +1069,7 @@ ZEND_FUNCTION(interface_exists) } if (!autoload) { - lc_name = zend_u_str_case_fold(type, iface_name, iface_name_len, 1, &lc_name_len); + lc_name = zend_u_str_case_fold(type, iface_name, iface_name_len, 1, &lc_name_len); found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce); efree(lc_name); RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE); @@ -1084,7 +1084,7 @@ ZEND_FUNCTION(interface_exists) /* }}} */ -/* {{{ proto bool function_exists(string function_name) +/* {{{ proto bool function_exists(string function_name) Checks if the function exists */ ZEND_FUNCTION(function_exists) { @@ -1093,7 +1093,7 @@ ZEND_FUNCTION(function_exists) unsigned int lcname_len; char *lcname; zend_bool retval; - + if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -1101,7 +1101,7 @@ ZEND_FUNCTION(function_exists) lcname = zend_u_str_case_fold(Z_TYPE_PP(function_name), Z_UNIVAL_PP(function_name), Z_UNILEN_PP(function_name), 1, &lcname_len); retval = (zend_u_hash_find(EG(function_table), Z_TYPE_PP(function_name), lcname, lcname_len+1, (void **)&func) == SUCCESS); - + efree(lcname); /* @@ -1128,10 +1128,10 @@ ZEND_FUNCTION(leak) if (ZEND_NUM_ARGS()>=1) { if (zend_get_parameters_ex(1, &leak)==SUCCESS) { convert_to_long_ex(leak); - leakbytes = (*leak)->value.lval; + leakbytes = Z_LVAL_PP(leak); } } - + emalloc(leakbytes); } /* }}} */ @@ -1185,7 +1185,7 @@ ZEND_FUNCTION(trigger_error) ZEND_WRONG_PARAM_COUNT(); } convert_to_long_ex(z_error_type); - error_type = (*z_error_type)->value.lval; + error_type = Z_LVAL_PP(z_error_type); switch (error_type) { case E_USER_ERROR: case E_USER_WARNING: @@ -1198,7 +1198,7 @@ ZEND_FUNCTION(trigger_error) } break; default: - ZEND_WRONG_PARAM_COUNT(); + ZEND_WRONG_PARAM_COUNT(); } convert_to_text_ex(z_error_message); zend_error(error_type, "%R", Z_TYPE_PP(z_error_message), Z_UNIVAL_PP(z_error_message)); @@ -1215,7 +1215,7 @@ ZEND_FUNCTION(set_error_handler) zend_bool had_orig_error_handler=0; zval error_handler_name; long error_type = E_ALL | E_STRICT; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) { return; } @@ -1349,7 +1349,7 @@ static int copy_class_or_interface_name(zend_class_entry **pce, int num_args, va zend_class_entry *ce = *pce; TSRMLS_FETCH(); - if ((hash_key->nKeyLength==0 || + if ((hash_key->nKeyLength==0 || (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] != 0) || (hash_key->type == IS_STRING && hash_key->u.string[0] != 0)) && (comply_mask == (ce->ce_flags & mask))) { @@ -1381,7 +1381,7 @@ ZEND_FUNCTION(get_declared_interfaces) { zend_uint mask = ZEND_ACC_INTERFACE; zend_uint comply = 1; - + if (ZEND_NUM_ARGS() != 0) { ZEND_WRONG_PARAM_COUNT(); } @@ -1397,7 +1397,7 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z zval *internal_ar = va_arg(args, zval *), *user_ar = va_arg(args, zval *); - if (hash_key->nKeyLength == 0 || + if (hash_key->nKeyLength == 0 || (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == 0) || (hash_key->type == IS_STRING && hash_key->u.unicode[0] == 0)) { return 0; @@ -1416,7 +1416,7 @@ static int copy_function_name(zend_function *func, int num_args, va_list args, z add_next_index_unicodel(user_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1); } } - + return 0; } @@ -1427,26 +1427,26 @@ ZEND_FUNCTION(get_defined_functions) { zval *internal; zval *user; - + if (ZEND_NUM_ARGS() != 0) { ZEND_WRONG_PARAM_COUNT(); } - + MAKE_STD_ZVAL(internal); MAKE_STD_ZVAL(user); - + array_init(internal); array_init(user); array_init(return_value); - + zend_hash_apply_with_arguments(EG(function_table), (apply_func_args_t) copy_function_name, 2, internal, user); - - if (zend_hash_add(return_value->value.ht, "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { + + if (zend_hash_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) { zend_error(E_WARNING, "Cannot add internal functions to return value from get_defined_functions()"); RETURN_FALSE; } - - if (zend_hash_add(return_value->value.ht, "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { + + if (zend_hash_add(Z_ARRVAL_P(return_value), "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) { zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()"); RETURN_FALSE; } @@ -1457,12 +1457,12 @@ ZEND_FUNCTION(get_defined_functions) /* {{{ proto array get_defined_vars(void) Returns an associative array of names and values of all currently defined variable names (variables in the current scope) */ ZEND_FUNCTION(get_defined_vars) -{ +{ zval *tmp; - + array_init(return_value); - - zend_hash_copy(return_value->value.ht, EG(active_symbol_table), + + zend_hash_copy(Z_ARRVAL_P(return_value), EG(active_symbol_table), (copy_ctor_func_t)zval_add_ref, &tmp, sizeof(zval *)); } /* }}} */ @@ -1629,7 +1629,7 @@ ZEND_FUNCTION(get_defined_constants) modules = ecalloc(zend_hash_num_elements(&module_registry) + 2, sizeof(zval *)); module_names = emalloc((zend_hash_num_elements(&module_registry) + 2) * sizeof(char *)); - + module_names[0] = "internal"; zend_hash_internal_pointer_reset_ex(&module_registry, &pos); while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) { @@ -1681,7 +1681,7 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC) zval *arg_array, **arg; int arg_count = (ulong) *p; - *curpos -= (arg_count+2); + *curpos -= (arg_count+2); MAKE_STD_ZVAL(arg_array); array_init(arg_array); @@ -1708,13 +1708,13 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) HashPosition iterator; int i = 0; - zend_hash_internal_pointer_reset_ex(arg_array->value.ht, &iterator); - while (zend_hash_get_current_data_ex(arg_array->value.ht, (void **) &tmp, &iterator) == SUCCESS) { + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arg_array), &iterator); + while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arg_array), (void **) &tmp, &iterator) == SUCCESS) { if (i++) { ZEND_PUTS(", "); } zend_print_flat_zval_r(*tmp TSRMLS_CC); - zend_hash_move_forward_ex(arg_array->value.ht, &iterator); + zend_hash_move_forward_ex(Z_ARRVAL_P(arg_array), &iterator); } } @@ -1777,11 +1777,11 @@ ZEND_FUNCTION(debug_print_backtrace) char *free_class_name = NULL; int function_name_string = 1; - class_name = call_type = NULL; + class_name = call_type = NULL; arg_array = NULL; skip = ptr; - /* skip internal handler */ + /* skip internal handler */ if (!skip->op_array && skip->prev_execute_data && skip->prev_execute_data->opline && @@ -1809,7 +1809,7 @@ ZEND_FUNCTION(debug_print_backtrace) } else { zend_uint class_name_len; int dup; - + dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); if(!dup) { free_class_name = class_name; @@ -1829,7 +1829,7 @@ ZEND_FUNCTION(debug_print_backtrace) arg_array = debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC); frames_on_stack--; } - } + } } else { /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ zend_bool build_filename_arg = 1; @@ -1839,7 +1839,7 @@ ZEND_FUNCTION(debug_print_backtrace) function_name = "unknown"; build_filename_arg = 0; } else - switch (ptr->opline->op2.u.constant.value.lval) { + switch (Z_LVAL(ptr->opline->op2.u.constant)) { case ZEND_EVAL: function_name = "eval"; build_filename_arg = 0; @@ -1857,9 +1857,9 @@ ZEND_FUNCTION(debug_print_backtrace) function_name = "require_once"; break; default: - /* this can actually happen if you use debug_backtrace() in your error_handler and + /* this can actually happen if you use debug_backtrace() in your error_handler and * you're in the top-scope */ - function_name = "unknown"; + function_name = "unknown"; build_filename_arg = 0; break; } @@ -1979,7 +1979,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno); /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function - * and debug_baktrace() might have been called by the error_handler. in this case we don't + * and debug_baktrace() might have been called by the error_handler. in this case we don't * want to pop anything of the argument-stack */ } else { filename = NULL; @@ -1996,7 +1996,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int } else { zend_uint class_name_len; int dup; - + dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); add_assoc_text_ex(stack_frame, "class", sizeof("class"), class_name, dup); } @@ -2016,7 +2016,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(&cur_arg_pos TSRMLS_CC)); frames_on_stack--; } - } + } } else { /* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */ zend_bool build_filename_arg = 1; @@ -2026,7 +2026,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int function_name = "unknown"; build_filename_arg = 0; } else - switch (ptr->opline->op2.u.constant.value.lval) { + switch (Z_LVAL(ptr->opline->op2.u.constant)) { case ZEND_EVAL: function_name = "eval"; build_filename_arg = 0; @@ -2044,9 +2044,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int function_name = "require_once"; break; default: - /* this can actually happen if you use debug_backtrace() in your error_handler and + /* this can actually happen if you use debug_backtrace() in your error_handler and * you're in the top-scope */ - function_name = "unknown"; + function_name = "unknown"; build_filename_arg = 0; break; } @@ -2056,7 +2056,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int MAKE_STD_ZVAL(arg_array); array_init(arg_array); - + /* include_filename always points to the last filename of the last last called-fuction. if we have called include in the frame above - this is the file we have included. */ @@ -2070,7 +2070,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int add_next_index_zval(return_value, stack_frame); - include_filename = filename; + include_filename = filename; ptr = skip->prev_execute_data; } @@ -2085,7 +2085,7 @@ ZEND_FUNCTION(debug_backtrace) if (ZEND_NUM_ARGS()) { ZEND_WRONG_PARAM_COUNT(); } - + zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC); } /* }}} */ @@ -2134,7 +2134,7 @@ ZEND_FUNCTION(get_extension_funcs) RETURN_FALSE; } efree(lcname); - + if (!(func = module->functions)) { RETURN_FALSE; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 898bb9f756..3e4682b48d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -93,14 +93,14 @@ static void build_runtime_defined_function_key(zval *result, zend_uchar type, ch if (type == IS_UNICODE) { name_length *= sizeof(UChar); } - result->value.str.len = 1+name_length+strlen(filename)+char_pos_len; - result->value.str.val = (char *) emalloc(result->value.str.len+1); + Z_STRLEN_P(result) = 1+name_length+strlen(filename)+char_pos_len; + Z_STRVAL_P(result) = (char *) emalloc(Z_STRLEN_P(result)+1); /* UTODO: function key should probably store UTF-16 value instead of converting to runtime encoding */ - result->value.str.val[0] = '\0'; - memcpy(result->value.str.val+1, name, name_length); - sprintf(result->value.str.val+1+name_length, "%s%s", filename, char_pos_buf); - result->type = IS_STRING; + Z_STRVAL_P(result)[0] = '\0'; + memcpy(Z_STRVAL_P(result)+1, name, name_length); + sprintf(Z_STRVAL_P(result)+1+name_length, "%s%s", filename, char_pos_buf); + Z_TYPE_P(result) = IS_STRING; result->refcount = 1; } @@ -126,8 +126,8 @@ int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_ static void init_compiler_declarables(TSRMLS_D) { - CG(declarables).ticks.type = IS_LONG; - CG(declarables).ticks.value.lval = 0; + Z_TYPE(CG(declarables).ticks) = IS_LONG; + Z_LVAL(CG(declarables).ticks) = 0; } @@ -361,8 +361,8 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar zend_llist *fetch_list_ptr; if (varname->op_type == IS_CONST && - (varname->u.constant.type == IS_STRING || - varname->u.constant.type == IS_UNICODE) && + (Z_TYPE(varname->u.constant) == IS_STRING || + Z_TYPE(varname->u.constant) == IS_UNICODE) && !zend_u_is_auto_global(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant) TSRMLS_CC) && !(Z_UNILEN(varname->u.constant) == (sizeof("this")-1) && ZEND_U_EQUAL(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", sizeof("this")-1)) && @@ -391,8 +391,8 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar opline_ptr->op2.u.EA.type = ZEND_FETCH_LOCAL; if (varname->op_type == IS_CONST && - (varname->u.constant.type == IS_STRING || - varname->u.constant.type == IS_UNICODE)) { + (Z_TYPE(varname->u.constant) == IS_STRING || + Z_TYPE(varname->u.constant) == IS_UNICODE)) { if (zend_u_is_auto_global(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant) TSRMLS_CC)) { opline_ptr->op2.u.EA.type = ZEND_FETCH_GLOBAL; } @@ -524,17 +524,17 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body char *method_type; if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - modifiers->u.constant.value.lval |= ZEND_ACC_ABSTRACT; + Z_LVAL(modifiers->u.constant) |= ZEND_ACC_ABSTRACT; method_type = "Interface"; } else { method_type = "Abstract"; } - if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) { - if(modifiers->u.constant.value.lval & ZEND_ACC_PRIVATE) { + if (Z_LVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) { + if(Z_LVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) { zend_error(E_COMPILE_ERROR, "%s function %v::%R() cannot be declared private", method_type, CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } - if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { + if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_RAISE_ABSTRACT_ERROR; @@ -545,7 +545,7 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body zend_error(E_COMPILE_ERROR, "%s function %v::%R() cannot contain body", method_type, CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } } else { - if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) { + if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { zend_error(E_COMPILE_ERROR, "Non-abstract method %v::%R() must contain body", CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } } @@ -554,8 +554,8 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body static zend_bool opline_is_fetch_this(zend_op *opline TSRMLS_DC) { if ((opline->opcode == ZEND_FETCH_W) && (opline->op1.op_type == IS_CONST) - && (opline->op1.u.constant.type == IS_STRING || - opline->op1.u.constant.type == IS_UNICODE) + && (Z_TYPE(opline->op1.u.constant) == IS_STRING || + Z_TYPE(opline->op1.u.constant) == IS_UNICODE) && (Z_UNILEN(opline->op1.u.constant) == (sizeof("this")-1)) && ZEND_U_EQUAL(Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), "this", sizeof("this")-1)) { return 1; @@ -1007,7 +1007,7 @@ void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC) SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); - if (op1->u.constant.value.str.len>0) { + if (Z_STRLEN(op1->u.constant)>0) { opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_STRING; opline->result = *result; @@ -1075,15 +1075,15 @@ void zend_do_free(znode *op1 TSRMLS_DC) int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier) { - if ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) - && (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK) - && ((current_access_type->u.constant.value.lval & ZEND_ACC_PPP_MASK) != (new_modifier->u.constant.value.lval & ZEND_ACC_PPP_MASK))) { + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK) + && ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) != (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK))) { zend_error(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); } - if (((current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { + if (((Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { zend_error(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); } - return (current_access_type->u.constant.value.lval | new_modifier->u.constant.value.lval); + return (Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)); } @@ -1099,12 +1099,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n if (is_method) { if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - if ((fn_flags_znode->u.constant.value.lval & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) { + if ((Z_LVAL(fn_flags_znode->u.constant) & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) { zend_error(E_COMPILE_ERROR, "Access type for interface method %v::%R() must be omitted", CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } - fn_flags_znode->u.constant.value.lval |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ + Z_LVAL(fn_flags_znode->u.constant) |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ } - fn_flags = fn_flags_znode->u.constant.value.lval; /* must be done *after* the above check */ + fn_flags = Z_LVAL(fn_flags_znode->u.constant); /* must be done *after* the above check */ } else { fn_flags = 0; } @@ -1197,9 +1197,9 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n opline->op1.op_type = IS_CONST; build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(function_name->u.constant), lcname, lcname_len TSRMLS_CC); opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = Z_TYPE(function_name->u.constant); - opline->op2.u.constant.value.str.val = lcname; - opline->op2.u.constant.value.str.len = lcname_len; + Z_TYPE(opline->op2.u.constant) = Z_TYPE(function_name->u.constant); + Z_STRVAL(opline->op2.u.constant) = lcname; + Z_STRLEN(opline->op2.u.constant) = lcname_len; opline->op2.u.constant.refcount = 1; opline->extended_value = ZEND_DECLARE_FUNCTION; zend_u_hash_update(CG(function_table), Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); @@ -1346,7 +1346,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia if (class_type->op_type != IS_UNUSED) { cur_arg_info->allow_null = 0; - if (class_type->u.constant.type == IS_STRING || class_type->u.constant.type == IS_UNICODE) { + if (Z_TYPE(class_type->u.constant) == IS_STRING || Z_TYPE(class_type->u.constant) == IS_UNICODE) { cur_arg_info->class_name = Z_UNIVAL(class_type->u.constant); cur_arg_info->class_name_len = Z_UNILEN(class_type->u.constant); if (op == ZEND_RECV_INIT) { @@ -1434,14 +1434,14 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) last_op_number = get_next_op_number(CG(active_op_array))-1; last_op = &CG(active_op_array)->opcodes[last_op_number]; - if ((last_op->op2.op_type == IS_CONST) && (last_op->op2.u.constant.type == IS_STRING) && (last_op->op2.u.constant.value.str.len == sizeof(ZEND_CLONE_FUNC_NAME)-1) - && !zend_binary_strcasecmp(last_op->op2.u.constant.value.str.val, last_op->op2.u.constant.value.str.len, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { + if ((last_op->op2.op_type == IS_CONST) && (Z_TYPE(last_op->op2.u.constant) == IS_STRING) && (Z_STRLEN(last_op->op2.u.constant) == sizeof(ZEND_CLONE_FUNC_NAME)-1) + && !zend_binary_strcasecmp(Z_STRVAL(last_op->op2.u.constant), Z_STRLEN(last_op->op2.u.constant), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); } if (last_op->opcode == ZEND_FETCH_OBJ_R) { last_op->opcode = ZEND_INIT_METHOD_CALL; - left_bracket->u.constant.value.lval = ZEND_INIT_FCALL_BY_NAME; + Z_LVAL(left_bracket->u.constant) = ZEND_INIT_FCALL_BY_NAME; } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_FCALL_BY_NAME; @@ -1537,15 +1537,15 @@ void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *cla Z_USTRVAL(result->u.constant) = erealloc(Z_USTRVAL(result->u.constant), UBYTES(length+1)); Z_USTRVAL(result->u.constant)[Z_USTRLEN(result->u.constant)] = ':'; Z_USTRVAL(result->u.constant)[Z_USTRLEN(result->u.constant)+1] = ':'; - memcpy(&Z_USTRVAL(result->u.constant)[Z_USTRLEN(result->u.constant) + sizeof("::")-1], class_name->u.constant.value.str.val, UBYTES(Z_USTRLEN(class_name->u.constant)+1)); + memcpy(&Z_USTRVAL(result->u.constant)[Z_USTRLEN(result->u.constant) + sizeof("::")-1], Z_STRVAL(class_name->u.constant), UBYTES(Z_USTRLEN(class_name->u.constant)+1)); STR_FREE(Z_USTRVAL(class_name->u.constant)); } else { - result->u.constant.value.str.val = erealloc(result->u.constant.value.str.val, length+1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len], "::", sizeof("::")-1); - memcpy(&result->u.constant.value.str.val[result->u.constant.value.str.len + sizeof("::")-1], class_name->u.constant.value.str.val, class_name->u.constant.value.str.len+1); - STR_FREE(class_name->u.constant.value.str.val); + Z_STRVAL(result->u.constant) = erealloc(Z_STRVAL(result->u.constant), length+1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)], "::", sizeof("::")-1); + memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant) + sizeof("::")-1], Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)+1); + STR_FREE(Z_STRVAL(class_name->u.constant)); } - result->u.constant.value.str.len = length; + Z_STRLEN(result->u.constant) = length; } void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC) @@ -1588,10 +1588,10 @@ void zend_do_end_function_call(znode *function_name, znode *result, znode *argum if (is_method && function_name && function_name->op_type == IS_UNUSED) { /* clone */ - if (argument_list->u.constant.value.lval != 0) { + if (Z_LVAL(argument_list->u.constant) != 0) { zend_error(E_WARNING, "Clone method does not require arguments"); } - opline = &CG(active_op_array)->opcodes[function_name->u.constant.value.lval]; + opline = &CG(active_op_array)->opcodes[Z_LVAL(function_name->u.constant)]; } else { opline = get_next_op(CG(active_op_array) TSRMLS_CC); if (!is_method && !is_dynamic_fcall && function_name->op_type==IS_CONST) { @@ -1609,7 +1609,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, znode *argum SET_UNUSED(opline->op2); zend_stack_del_top(&CG(function_call_stack)); - opline->extended_value = argument_list->u.constant.value.lval; + opline->extended_value = Z_LVAL(argument_list->u.constant); } @@ -2658,8 +2658,8 @@ void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) } opline->op2 = *expr; } else { - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 1; + Z_TYPE(opline->op2.u.constant) = IS_LONG; + Z_LVAL(opline->op2.u.constant) = 1; INIT_PZVAL(&opline->op2.u.constant); opline->op2.op_type = IS_CONST; } @@ -2856,7 +2856,7 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(class_name->u.constant), lcname, lcname_len TSRMLS_CC); opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = Z_TYPE(class_name->u.constant); + Z_TYPE(opline->op2.u.constant) = Z_TYPE(class_name->u.constant); opline->op2.u.constant.refcount = 1; if (doing_inheritance) { @@ -3075,7 +3075,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty *property = value->u.constant; } else { INIT_PZVAL(property); - property->type = IS_NULL; + Z_TYPE_P(property) = IS_NULL; } if (CG(doc_comment)) { @@ -3086,7 +3086,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty } zend_u_declare_property_ex(CG(active_class_entry), Z_TYPE(var_name->u.constant), Z_UNIVAL(var_name->u.constant), Z_UNILEN(var_name->u.constant), property, access_type, comment, comment_len TSRMLS_CC); - efree(var_name->u.constant.value.str.val); + efree(Z_STRVAL(var_name->u.constant)); } @@ -3104,7 +3104,7 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) *property = value->u.constant; } else { INIT_PZVAL(property); - property->type = IS_NULL; + Z_TYPE_P(property) = IS_NULL; } if (zend_u_hash_add(&CG(active_class_entry)->constants_table, Z_TYPE(var_name->u.constant), Z_UNIVAL(var_name->u.constant), Z_UNILEN(var_name->u.constant)+1, &property, sizeof(zval *), NULL)==FAILURE) { @@ -3131,7 +3131,7 @@ void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS opline_ptr = (zend_op *) le->data; if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) { - efree(opline_ptr->op1.u.constant.value.str.val); + efree(Z_STRVAL(opline_ptr->op1.u.constant)); SET_UNUSED(opline_ptr->op1); /* this means $this for objects */ opline_ptr->op2 = *property; /* if it was usual fetch, we change it to object fetch */ @@ -3268,7 +3268,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con } else { *result = *constant_name; } - result->u.constant.type = IS_CONSTANT; + Z_TYPE(result->u.constant) = IS_CONSTANT; break; case ZEND_RT: { @@ -3312,10 +3312,10 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) opline->opcode = ZEND_DO_FCALL; opline->result.u.var = get_temporary_variable(CG(active_op_array)); opline->result.op_type = IS_VAR; - opline->op1.u.constant.value.str.val = estrndup("shell_exec", sizeof("shell_exec")-1); - opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1; + Z_STRVAL(opline->op1.u.constant) = estrndup("shell_exec", sizeof("shell_exec")-1); + Z_STRLEN(opline->op1.u.constant) = sizeof("shell_exec")-1; INIT_PZVAL(&opline->op1.u.constant); - opline->op1.u.constant.type = IS_STRING; + Z_TYPE(opline->op1.u.constant) = IS_STRING; opline->op1.op_type = IS_CONST; opline->extended_value = 1; SET_UNUSED(opline->op2); @@ -3377,27 +3377,27 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr) switch (Z_TYPE(offset->u.constant)) { case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ - element->type |= IS_CONSTANT_INDEX; + Z_TYPE_P(element) |= IS_CONSTANT_INDEX; /* break missing intentionally */ utype = UG(unicode)?IS_UNICODE:IS_STRING; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(result->u.constant.value.ht, utype, Z_UNIVAL(offset->u.constant), Z_UNILEN(offset->u.constant)+1, &element, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL(result->u.constant), utype, Z_UNIVAL(offset->u.constant), Z_UNILEN(offset->u.constant)+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_NULL: - zend_symtable_update(result->u.constant.value.ht, "", 1, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL(result->u.constant), "", 1, &element, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element, sizeof(zval *), NULL); break; case IS_DOUBLE: - zend_hash_index_update(result->u.constant.value.ht, (long)offset->u.constant.value.dval, &element, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL(result->u.constant), (long)Z_DVAL(offset->u.constant), &element, sizeof(zval *), NULL); break; } } else { - zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL(result->u.constant), &element, sizeof(zval *), NULL); } } @@ -3479,8 +3479,8 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) opline->result.u.var = get_temporary_variable(CG(active_op_array)); opline->op1 = last_container; opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = *((int *) dimension->data); + Z_TYPE(opline->op2.u.constant) = IS_LONG; + Z_LVAL(opline->op2.u.constant) = *((int *) dimension->data); INIT_PZVAL(&opline->op2.u.constant); opline->extended_value = ZEND_FETCH_ADD_LOCK; last_container = opline->result; @@ -3603,7 +3603,7 @@ void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC) opline->result.u.var = get_temporary_variable(CG(active_op_array)); opline->op1 = *op1; SET_UNUSED(opline->op2); - opline->op2.u.constant.value.lval = type; + Z_LVAL(opline->op2.u.constant) = type; *result = opline->result; } zend_do_extended_fcall_end(TSRMLS_C); @@ -3616,7 +3616,7 @@ void zend_do_indirect_references(znode *result, znode *num_references, znode *va zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_normalization(variable, variable TSRMLS_CC); - for (i=1; iu.constant.value.lval; i++) { + for (i=1; iu.constant); i++) { fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC); zend_do_normalization(variable, result TSRMLS_CC); } @@ -3903,7 +3903,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) } else if (UG(unicode) && ZEND_U_EQUAL(Z_TYPE(var->u.constant), Z_UNIVAL(var->u.constant), Z_UNILEN(var->u.constant), "encoding", sizeof("encoding")-1)) { UErrorCode status = U_ZERO_ERROR; - if (val->u.constant.type == IS_CONSTANT) { + if (Z_TYPE(val->u.constant) == IS_CONSTANT) { zend_error(E_COMPILE_ERROR, "Cannot use constants as encoding"); } /* @@ -3925,7 +3925,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) * we can safely cache the script encoding in the op array here. */ CG(active_op_array)->script_encoding = zend_get_compiled_script_encoding(TSRMLS_C); - efree(val->u.constant.value.str.val); + efree(Z_STRVAL(val->u.constant)); } zval_dtor(&var->u.constant); } @@ -3937,7 +3937,7 @@ void zend_do_declare_end(znode *declare_token TSRMLS_DC) zend_stack_top(&CG(declare_stack), (void **) &declarables); /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */ - if ((get_next_op_number(CG(active_op_array)) - declare_token->u.opline_num) - ((CG(declarables).ticks.value.lval)?1:0)) { + if ((get_next_op_number(CG(active_op_array)) - declare_token->u.opline_num) - ((Z_LVAL(CG(declarables).ticks))?1:0)) { CG(declarables) = *declarables; } } @@ -3952,18 +3952,18 @@ void zend_do_end_heredoc(TSRMLS_D) return; } - if (opline->op2.u.constant.type == IS_UNICODE) { - opline->op2.u.constant.value.ustr.val[(opline->op2.u.constant.value.ustr.len--)-1] = 0; - if (opline->op2.u.constant.value.ustr.len>0) { - if (opline->op2.u.constant.value.ustr.val[opline->op2.u.constant.value.ustr.len-1]=='\r') { - opline->op2.u.constant.value.ustr.val[(opline->op2.u.constant.value.ustr.len--)-1] = 0; + if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) { + Z_USTRVAL(opline->op2.u.constant)[(Z_USTRLEN(opline->op2.u.constant)--)-1] = 0; + if (Z_USTRLEN(opline->op2.u.constant)>0) { + if (Z_USTRVAL(opline->op2.u.constant)[Z_USTRLEN(opline->op2.u.constant)-1]=='\r') { + Z_USTRVAL(opline->op2.u.constant)[(Z_USTRLEN(opline->op2.u.constant)--)-1] = 0; } } } else { - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; - if (opline->op2.u.constant.value.str.len>0) { - if (opline->op2.u.constant.value.str.val[opline->op2.u.constant.value.str.len-1]=='\r') { - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; + Z_STRVAL(opline->op2.u.constant)[(Z_STRLEN(opline->op2.u.constant)--)-1] = 0; + if (Z_STRLEN(opline->op2.u.constant)>0) { + if (Z_STRVAL(opline->op2.u.constant)[Z_STRLEN(opline->op2.u.constant)-1]=='\r') { + Z_STRVAL(opline->op2.u.constant)[(Z_STRLEN(opline->op2.u.constant)--)-1] = 0; } } } @@ -3979,8 +3979,8 @@ void zend_do_exit(znode *result, znode *message TSRMLS_DC) SET_UNUSED(opline->op2); result->op_type = IS_CONST; - result->u.constant.type = IS_BOOL; - result->u.constant.value.lval = 1; + Z_TYPE(result->u.constant) = IS_BOOL; + Z_LVAL(result->u.constant) = 1; } void zend_do_begin_silence(znode *strudel_token TSRMLS_DC) @@ -4112,7 +4112,7 @@ void zend_do_extended_fcall_end(TSRMLS_D) void zend_do_ticks(TSRMLS_D) { - if (CG(declarables).ticks.value.lval) { + if (Z_LVAL(CG(declarables).ticks)) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_TICKS; @@ -4169,7 +4169,7 @@ again: CG(increment_lineno) = 0; } - zendlval->u.constant.type = IS_LONG; + Z_TYPE(zendlval->u.constant) = IS_LONG; retval = lex_scan(&zendlval->u.constant TSRMLS_CC); switch (retval) { case T_COMMENT: @@ -4189,7 +4189,7 @@ again: retval = T_ECHO; break; case T_END_HEREDOC: - efree(zendlval->u.constant.value.str.val); + efree(Z_STRVAL(zendlval->u.constant)); break; } diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index e1459f962a..7c4bfec095 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -118,31 +118,31 @@ void zend_register_standard_constants(TSRMLS_D) { zend_constant c; - c.value.type = IS_BOOL; + Z_TYPE(c.value) = IS_BOOL; c.flags = CONST_PERSISTENT; c.module_number = 0; c.name = zend_strndup(ZEND_STRL("TRUE")); c.name_len = sizeof("TRUE"); - c.value.value.lval = 1; - c.value.type = IS_BOOL; + Z_LVAL(c.value) = 1; + Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); c.name = zend_strndup(ZEND_STRL("FALSE")); c.name_len = sizeof("FALSE"); - c.value.value.lval = 0; - c.value.type = IS_BOOL; + Z_LVAL(c.value) = 0; + Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE")); c.name_len = sizeof("ZEND_THREAD_SAFE"); - c.value.value.lval = ZTS_V; - c.value.type = IS_BOOL; + Z_LVAL(c.value) = ZTS_V; + Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); c.name = zend_strndup(ZEND_STRL("NULL")); c.name_len = sizeof("NULL"); - c.value.type = IS_NULL; + Z_TYPE(c.value) = IS_NULL; zend_register_constant(&c TSRMLS_CC); } } @@ -170,8 +170,8 @@ ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, { zend_constant c; - c.value.type = IS_LONG; - c.value.value.lval = lval; + Z_TYPE(c.value) = IS_LONG; + Z_LVAL(c.value) = lval; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -184,8 +184,8 @@ ZEND_API void zend_register_double_constant(char *name, uint name_len, double dv { zend_constant c; - c.value.type = IS_DOUBLE; - c.value.value.dval = dval; + Z_TYPE(c.value) = IS_DOUBLE; + Z_DVAL(c.value) = dval; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -198,9 +198,9 @@ ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *st { zend_constant c; - c.value.type = IS_STRING; - c.value.value.str.val = strval; - c.value.value.str.len = strlen; + Z_TYPE(c.value) = IS_STRING; + Z_STRVAL(c.value) = strval; + Z_STRLEN(c.value) = strlen; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -286,7 +286,7 @@ ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zva } if (zend_u_hash_find(EG(zend_constants), type, name, name_len+1, (void **) &c) == FAILURE) { - int lookup_name_len; + unsigned int lookup_name_len; lookup_name = zend_u_str_case_fold(type, name, name_len, 1, &lookup_name_len); @@ -317,7 +317,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC) { - int lookup_name_len; + unsigned int lookup_name_len; char *lookup_name = NULL; char *name; int ret = SUCCESS; diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index eab7f65881..6945af9fe8 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -81,8 +81,8 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t zend_object *object; zval *trace; - obj.value.obj = zend_objects_new(&object, class_type TSRMLS_CC); - obj.value.obj.handlers = &default_exception_handlers; + Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC); + Z_OBJ_HT(obj) = &default_exception_handlers; ALLOC_HASHTABLE(object->properties); zend_u_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); @@ -97,7 +97,7 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC); - return obj.value.obj; + return Z_OBJVAL(obj); } static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) @@ -125,7 +125,7 @@ ZEND_METHOD(exception, __clone) Exception constructor */ ZEND_METHOD(exception, __construct) { - char *message = NULL; + void *message = NULL; long code = 0; zval *object; int argc = ZEND_NUM_ARGS(), message_len; @@ -141,7 +141,7 @@ ZEND_METHOD(exception, __construct) if (message_type == IS_UNICODE) { zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } else if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *u_str; int32_t u_len; @@ -164,7 +164,7 @@ ZEND_METHOD(exception, __construct) ErrorException constructor */ ZEND_METHOD(error_exception, __construct) { - char *message = NULL, *filename = NULL; + void *message = NULL, *filename = NULL; long code = 0, severity = E_ERROR, lineno; zval *object; int argc = ZEND_NUM_ARGS(), message_len, filename_len; @@ -450,7 +450,7 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k if (UG(unicode)) { zval tmp; - ZVAL_UNICODEL(&tmp, class_name, class_name_len, 1); + ZVAL_UNICODEL(&tmp, (UChar*)class_name, class_name_len, 1); convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv))); TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp)); zval_dtor(&tmp); @@ -800,7 +800,7 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) { zend_class_entry *exception_ce; - if (exception == NULL || exception->type != IS_OBJECT) { + if (exception == NULL || Z_TYPE_P(exception) != IS_OBJECT) { zend_error(E_ERROR, "Need to supply an object when throwing an exception"); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index cee2bcf4c6..ecc0f9bb2a 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -125,7 +125,7 @@ static inline void zend_pzval_unlock_free_func(zval *z) #define INIT_PZVAL_COPY(z,v) \ (z)->value = (v)->value; \ - (z)->type = (v)->type; \ + Z_TYPE_P(z) = Z_TYPE_P(v); \ (z)->refcount = 1; \ (z)->is_ref = 0; @@ -134,7 +134,7 @@ static inline void zend_pzval_unlock_free_func(zval *z) zval *_tmp; \ ALLOC_ZVAL(_tmp); \ _tmp->value = (val)->value; \ - _tmp->type = (val)->type; \ + Z_TYPE_P(_tmp) = Z_TYPE_P(val); \ _tmp->refcount = 1; \ _tmp->is_ref = 0; \ val = _tmp; \ @@ -179,35 +179,35 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_ should_free->var = ptr; /* T->str_offset.str here is always IS_STRING or IS_UNICODE */ - if (T->str_offset.str->type == IS_STRING) { + if (Z_TYPE_P(T->str_offset.str) == IS_STRING) { if (((int)T->str_offset.offset<0) - || (T->str_offset.str->value.str.len <= T->str_offset.offset)) { + || (Z_STRLEN_P(T->str_offset.str) <= T->str_offset.offset)) { zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); - ptr->value.str.val = STR_EMPTY_ALLOC(); - ptr->value.str.len = 0; + Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); + Z_STRLEN_P(ptr) = 0; } else { - char c = str->value.str.val[T->str_offset.offset]; + char c = Z_STRVAL_P(str)[T->str_offset.offset]; - ptr->value.str.val = estrndup(&c, 1); - ptr->value.str.len = 1; + Z_STRVAL_P(ptr) = estrndup(&c, 1); + Z_STRLEN_P(ptr) = 1; } - ptr->type = T->str_offset.str->type; + Z_TYPE_P(ptr) = IS_STRING; } else { if (((int)T->str_offset.offset<0) || (Z_USTRCPLEN_P(T->str_offset.str) <= T->str_offset.offset)) { zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset); - ptr->value.ustr.val = USTR_MAKE(""); - ptr->value.ustr.len = 0; + Z_USTRVAL_P(ptr) = USTR_MAKE(""); + Z_USTRLEN_P(ptr) = 0; } else { - UChar32 c = zend_get_codepoint_at(str->value.ustr.val, str->value.ustr.len, T->str_offset.offset); + UChar32 c = zend_get_codepoint_at(Z_USTRVAL_P(str), Z_USTRLEN_P(str), T->str_offset.offset); int32_t i = 0; - ptr->value.ustr.val = eumalloc(3); /* potentially 2 code units + null */ - U16_APPEND_UNSAFE(ptr->value.ustr.val, i, c); - ptr->value.ustr.val[i] = 0; - ptr->value.ustr.len = i; + Z_USTRVAL_P(ptr) = eumalloc(3); /* potentially 2 code units + null */ + U16_APPEND_UNSAFE(Z_USTRVAL_P(ptr), i, c); + Z_USTRVAL_P(ptr)[i] = 0; + Z_USTRLEN_P(ptr) = i; } - ptr->type = IS_UNICODE; + Z_TYPE_P(ptr) = IS_UNICODE; } PZVAL_UNLOCK_FREE(str); ptr->refcount=1; @@ -457,10 +457,10 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va static inline void make_real_object(zval **object_ptr TSRMLS_DC) { /* this should modify object only if it's empty */ - if ((*object_ptr)->type == IS_NULL - || ((*object_ptr)->type == IS_BOOL && (*object_ptr)->value.lval==0) - || ((*object_ptr)->type == IS_STRING && (*object_ptr)->value.str.len == 0) - || ((*object_ptr)->type == IS_UNICODE && (*object_ptr)->value.ustr.len == 0)) { + if (Z_TYPE_PP(object_ptr) == IS_NULL + || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr)==0) + || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0) + || (Z_TYPE_PP(object_ptr) == IS_UNICODE && Z_USTRLEN_PP(object_ptr) == 0)) { if (!PZVAL_IS_REF(*object_ptr)) { SEPARATE_ZVAL(object_ptr); } @@ -583,7 +583,7 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT || (opcode == ZEND_ASSIGN_OBJ && !Z_OBJ_HT_P(object)->write_property)) { + if (Z_TYPE_P(object) != IS_OBJECT || (opcode == ZEND_ASSIGN_OBJ && !Z_OBJ_HT_P(object)->write_property)) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op2); if (!RETURN_VALUE_UNUSED(result)) { @@ -612,8 +612,8 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); - value->value.obj = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC); - if (!dup) { + Z_OBJVAL_P(value) = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC); + if (!dup) { efree(class_name); } } else if (value_op->op_type == IS_TMP_VAR) { @@ -675,7 +675,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 if (!variable_ptr_ptr) { temp_variable *T = &T(op1->u.var); - if (UG(unicode) && Z_TYPE_P(T->str_offset.str) == IS_STRING && value->type != IS_STRING) { + if (UG(unicode) && Z_TYPE_P(T->str_offset.str) == IS_STRING && Z_TYPE_P(value) != IS_STRING) { convert_to_unicode(T->str_offset.str); } @@ -688,23 +688,23 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset); break; } - if (T->str_offset.offset >= T->str_offset.str->value.str.len) { + if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { zend_uint i; - if (T->str_offset.str->value.str.len==0) { - STR_FREE(T->str_offset.str->value.str.val); - T->str_offset.str->value.str.val = (char *) emalloc(T->str_offset.offset+1+1); + if (Z_STRLEN_P(T->str_offset.str)==0) { + STR_FREE(Z_STRVAL_P(T->str_offset.str)); + Z_STRVAL_P(T->str_offset.str) = (char *) emalloc(T->str_offset.offset+1+1); } else { - T->str_offset.str->value.str.val = (char *) erealloc(T->str_offset.str->value.str.val, T->str_offset.offset+1+1); + Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); } - for (i=T->str_offset.str->value.str.len; istr_offset.offset; i++) { - T->str_offset.str->value.str.val[i] = ' '; + for (i=Z_STRLEN_P(T->str_offset.str); istr_offset.offset; i++) { + Z_STRVAL_P(T->str_offset.str)[i] = ' '; } - T->str_offset.str->value.str.val[T->str_offset.offset+1] = 0; - T->str_offset.str->value.str.len = T->str_offset.offset+1; + Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; + Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; } - if (value->type!=IS_STRING) { + if (Z_TYPE_P(value)!=IS_STRING) { tmp = *value; if (op2->op_type & (IS_VAR|IS_CV|IS_CONST)) { zval_copy_ctor(&tmp); @@ -713,14 +713,14 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 final_value = &tmp; } - T->str_offset.str->value.str.val[T->str_offset.offset] = final_value->value.str.val[0]; + Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_STRVAL_P(final_value)[0]; if (op2->op_type == IS_TMP_VAR) { if (final_value == &T(op2->u.var).tmp_var) { /* we can safely free final_value here * because separation is done only * in case op2->op_type == IS_VAR */ - STR_FREE(final_value->value.str.val); + STR_FREE(Z_STRVAL_P(final_value)); } } if (final_value == &tmp) { @@ -731,7 +731,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 T(result->u.var).var = &T->str_offset.str; */ } while (0); - else if (T->str_offset.str->type == IS_UNICODE) do { + else if (Z_TYPE_P(T->str_offset.str) == IS_UNICODE) do { zval tmp; zval *final_value = value; @@ -739,23 +739,23 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset); break; } - if (T->str_offset.offset >= T->str_offset.str->value.ustr.len) { + if (T->str_offset.offset >= Z_USTRLEN_P(T->str_offset.str)) { zend_uint i; - if (T->str_offset.str->value.ustr.len==0) { - USTR_FREE(T->str_offset.str->value.ustr.val); - T->str_offset.str->value.ustr.val = eumalloc(T->str_offset.offset+1+1); + if (Z_USTRLEN_P(T->str_offset.str)==0) { + USTR_FREE(Z_USTRVAL_P(T->str_offset.str)); + Z_USTRVAL_P(T->str_offset.str) = eumalloc(T->str_offset.offset+1+1); } else { - T->str_offset.str->value.ustr.val = eurealloc(T->str_offset.str->value.ustr.val, T->str_offset.offset+1+1); + Z_USTRVAL_P(T->str_offset.str) = eurealloc(Z_USTRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); } - for (i=T->str_offset.str->value.ustr.len; istr_offset.offset; i++) { - T->str_offset.str->value.ustr.val[i] = 0x20; /* ' ' */ + for (i=Z_USTRLEN_P(T->str_offset.str); istr_offset.offset; i++) { + Z_USTRVAL_P(T->str_offset.str)[i] = 0x20; /* ' ' */ } - T->str_offset.str->value.ustr.val[T->str_offset.offset+1] = 0; - T->str_offset.str->value.ustr.len = T->str_offset.offset+1; + Z_USTRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; + Z_USTRLEN_P(T->str_offset.str) = T->str_offset.offset+1; } - if (value->type!=IS_UNICODE) { + if (Z_TYPE_P(value)!=IS_UNICODE) { tmp = *value; if (op2->op_type & (IS_VAR|IS_CV|IS_CONST)) { zval_copy_ctor(&tmp); @@ -764,14 +764,14 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 final_value = &tmp; } - T->str_offset.str->value.ustr.val[T->str_offset.offset] = final_value->value.ustr.val[0]; + Z_USTRVAL_P(T->str_offset.str)[T->str_offset.offset] = Z_USTRVAL_P(final_value)[0]; if (op2->op_type == IS_TMP_VAR) { if (final_value == &T(op2->u.var).tmp_var) { /* we can safely free final_value here * because separation is done only * in case op2->op_type == IS_VAR */ - USTR_FREE(final_value->value.ustr.val); + USTR_FREE(Z_USTRVAL_P(final_value)); } } if (final_value == &tmp) { @@ -833,7 +833,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 variable_ptr->refcount = refcount; variable_ptr->is_ref = 1; zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); + Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); if (type != IS_TMP_VAR) { value->refcount--; } @@ -852,7 +852,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2 *variable_ptr = *value; INIT_PZVAL(variable_ptr); zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); + Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); zval_ptr_dtor(&value); } } @@ -967,7 +967,7 @@ static inline void zend_receive(zval **variable_ptr_ptr, zval *value TSRMLS_DC) *variable_ptr = *value; INIT_PZVAL(variable_ptr); zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); - variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); + Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); } if (!dup) { efree(class_name); @@ -1031,7 +1031,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim zval **retval; char *offset_key; int offset_key_length; - zend_uchar ztype = dim->type; + zend_uchar ztype = Z_TYPE_P(dim); int free_offset = 0; switch (ztype) { @@ -1086,17 +1086,17 @@ fetch_string_dim: } break; case IS_RESOURCE: - zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", dim->value.lval, dim->value.lval); + zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim)); /* Fall Through */ case IS_DOUBLE: case IS_BOOL: case IS_LONG: { long index; - if (dim->type == IS_DOUBLE) { - index = (long)dim->value.dval; + if (Z_TYPE_P(dim) == IS_DOUBLE) { + index = (long)Z_DVAL_P(dim); } else { - index = dim->value.lval; + index = Z_LVAL_P(dim); } if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { switch (type) { @@ -1159,10 +1159,10 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container return; } - if (container->type==IS_NULL - || (container->type==IS_BOOL && container->value.lval==0) - || (container->type==IS_STRING && container->value.str.len==0) - || (container->type==IS_UNICODE && container->value.ustr.len==0)) { + if (Z_TYPE_P(container)==IS_NULL + || (Z_TYPE_P(container)==IS_BOOL && Z_LVAL_P(container)==0) + || (Z_TYPE_P(container)==IS_STRING && Z_STRLEN_P(container)==0) + || (Z_TYPE_P(container)==IS_UNICODE && Z_USTRLEN_P(container)==0)) { switch (type) { case BP_VAR_RW: case BP_VAR_W: @@ -1176,7 +1176,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container } } - switch (container->type) { + switch (Z_TYPE_P(container)) { zval **retval; case IS_ARRAY: @@ -1188,13 +1188,13 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container zval *new_zval = &EG(uninitialized_zval); new_zval->refcount++; - if (zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) &retval) == FAILURE) { + if (zend_hash_next_index_insert(Z_ARRVAL_P(container), &new_zval, sizeof(zval *), (void **) &retval) == FAILURE) { zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied"); retval = &EG(error_zval_ptr); new_zval->refcount--; } } else { - retval = zend_fetch_dimension_address_inner(container->value.ht, dim, type TSRMLS_CC); + retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, type TSRMLS_CC); } if (result) { result->var.ptr_ptr = retval; @@ -1220,7 +1220,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } - if (dim->type != IS_LONG) { + if (Z_TYPE_P(dim) != IS_LONG) { tmp = *dim; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -1240,7 +1240,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container container = *container_ptr; result->str_offset.str = container; PZVAL_LOCK(container); - result->str_offset.offset = dim->value.lval; + result->str_offset.offset = Z_LVAL_P(dim); result->var.ptr_ptr = NULL; if (type == BP_VAR_R || type == BP_VAR_IS) { AI_USE_PTR(result->var); @@ -1266,7 +1266,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container switch (type) { case BP_VAR_RW: case BP_VAR_W: - if (overloaded_result->type != IS_OBJECT + if (Z_TYPE_P(overloaded_result) != IS_OBJECT && !overloaded_result->is_ref) { zend_error_noreturn(E_ERROR, "Objects used as arrays in post/pre increment/decrement must return values by reference"); } @@ -1333,10 +1333,10 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ return; } /* this should modify object only if it's empty */ - if (container->type == IS_NULL - || (container->type == IS_BOOL && container->value.lval==0) - || (container->type==IS_STRING && container->value.str.len==0) - || (container->type==IS_UNICODE && container->value.ustr.len==0)) { + if (Z_TYPE_P(container) == IS_NULL + || (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) + || (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0) + || (Z_TYPE_P(container) == IS_UNICODE && Z_USTRLEN_P(container)==0)) { switch (type) { case BP_VAR_RW: case BP_VAR_W: @@ -1349,7 +1349,7 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ } } - if (container->type != IS_OBJECT) { + if (Z_TYPE_P(container) != IS_OBJECT) { if (result) { if (type == BP_VAR_R || type == BP_VAR_IS) { result->var.ptr_ptr = &EG(uninitialized_zval_ptr); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 1ed9c2e570..178277b9f6 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -24,8 +24,8 @@ #include "zend_compile.h" #include "zend_hash.h" -#include "zend_variables.h" #include "zend_operators.h" +#include "zend_variables.h" typedef union _temp_variable { zval tmp_var; @@ -76,36 +76,36 @@ static inline int i_zend_is_true(zval *op) { int result; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: result = 0; break; case IS_LONG: case IS_BOOL: case IS_RESOURCE: - result = (op->value.lval?1:0); + result = (Z_LVAL_P(op)?1:0); break; case IS_DOUBLE: - result = (op->value.dval ? 1 : 0); + result = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { result = 0; } else { result = 1; } break; case IS_UNICODE: - if (op->value.ustr.len == 0 - || (op->value.ustr.len==1 && op->value.ustr.val[0]=='0')) { + if (Z_USTRLEN_P(op) == 0 + || (Z_USTRLEN_P(op)==1 && Z_USTRVAL_P(op)[0]=='0')) { result = 0; } else { result = 1; } break; case IS_ARRAY: - result = (zend_hash_num_elements(op->value.ht)?1:0); + result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); break; case IS_OBJECT: if(IS_ZEND_STD_OBJECT(*op)) { @@ -203,7 +203,7 @@ void zend_shutdown_timeout_thread(); /* 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) && (zval)->type == 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 : (char*)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 : (char*)EMPTY_STR) ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index e028ed9e75..f4fceac07f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -161,8 +161,8 @@ void init_executor(TSRMLS_D) ALLOC_ZVAL(globals); globals->refcount=1; globals->is_ref=1; - globals->type = IS_ARRAY; - globals->value.ht = &EG(symbol_table); + Z_TYPE_P(globals) = IS_ARRAY; + Z_ARRVAL_P(globals) = &EG(symbol_table); zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL); } EG(active_symbol_table) = &EG(symbol_table); @@ -397,7 +397,7 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) zval_dtor(*zval_ptr); safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC); } else if ((*zval_ptr)->refcount == 1) { - if ((*zval_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(zval_ptr) == IS_OBJECT) { TSRMLS_FETCH(); if (EG(ze1_compatibility_mode)) { @@ -437,7 +437,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) zend_bool inline_change = (zend_bool) (unsigned long) arg; zval const_value; - if (p->type == IS_CONSTANT) { + if (Z_TYPE_P(p) == IS_CONSTANT) { int refcount; zend_uchar is_ref; @@ -451,20 +451,20 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", Z_UNIVAL_P(p), Z_UNIVAL_P(p)); - p->type = UG(unicode)?IS_UNICODE:IS_STRING; + Z_TYPE_P(p) = UG(unicode)?IS_UNICODE:IS_STRING; if (!inline_change) { zval_copy_ctor(p); } } else { if (inline_change) { - STR_FREE(p->value.str.val); + STR_FREE(Z_STRVAL_P(p)); } *p = const_value; } p->refcount = refcount; p->is_ref = is_ref; - } else if (p->type == IS_CONSTANT_ARRAY) { + } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) { zval **element, *new_val; char *str_index; uint str_index_len; @@ -472,42 +472,42 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) SEPARATE_ZVAL_IF_NOT_REF(pp); p = *pp; - p->type = IS_ARRAY; + Z_TYPE_P(p) = IS_ARRAY; /* First go over the array and see if there are any constant indices */ - zend_hash_internal_pointer_reset(p->value.ht); - while (zend_hash_get_current_data(p->value.ht, (void **) &element)==SUCCESS) { + zend_hash_internal_pointer_reset(Z_ARRVAL_P(p)); + while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element)==SUCCESS) { if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) { - zend_hash_move_forward(p->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX; - if (zend_hash_get_current_key_ex(p->value.ht, &str_index, &str_index_len, &num_index, 0, NULL) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { - zend_hash_move_forward(p->value.ht); + if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { + zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } if (!zend_u_get_constant(UG(unicode)?IS_UNICODE:IS_STRING, str_index, str_index_len-1, &const_value TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index); - zend_hash_move_forward(p->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } if (UG(unicode)) { - if (const_value.type == IS_UNICODE && - const_value.value.ustr.len == str_index_len-1 && + if (Z_TYPE(const_value) == IS_UNICODE && + Z_USTRLEN(const_value) == str_index_len-1 && !u_strncmp(Z_USTRVAL(const_value), (UChar*)str_index, str_index_len)) { /* constant value is the same as its name */ zval_dtor(&const_value); - zend_hash_move_forward(p->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } } else { - if (const_value.type == IS_STRING && - const_value.value.str.len == str_index_len-1 && - !strncmp(const_value.value.str.val, str_index, str_index_len)) { + if (Z_TYPE(const_value) == IS_STRING && + Z_STRLEN(const_value) == str_index_len-1 && + !strncmp(Z_STRVAL(const_value), str_index, str_index_len)) { /* constant value is the same as its name */ zval_dtor(&const_value); - zend_hash_move_forward(p->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } } @@ -523,27 +523,27 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) zval_ptr_dtor(element); *element = new_val; - switch (const_value.type) { + switch (Z_TYPE(const_value)) { case IS_STRING: case IS_UNICODE: - zend_u_symtable_update_current_key(p->value.ht, Z_TYPE(const_value), Z_UNIVAL(const_value), Z_UNILEN(const_value)+1); + zend_u_symtable_update_current_key(Z_ARRVAL_P(p), Z_TYPE(const_value), Z_UNIVAL(const_value), Z_UNILEN(const_value)+1); break; case IS_BOOL: case IS_LONG: - zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_LONG, NULL, 0, const_value.value.lval); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value)); break; case IS_DOUBLE: - zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_LONG, NULL, 0, (long)const_value.value.dval); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, (long)Z_DVAL(const_value)); break; case IS_NULL: - zend_hash_update_current_key(p->value.ht, HASH_KEY_IS_STRING, "", 1, 0); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0); break; } - zend_hash_move_forward(p->value.ht); + zend_hash_move_forward(Z_ARRVAL_P(p)); zval_dtor(&const_value); } - zend_hash_apply_with_argument(p->value.ht, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); - zend_hash_internal_pointer_reset(p->value.ht); + zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); + zend_hash_internal_pointer_reset(Z_ARRVAL_P(p)); } return 0; } @@ -612,7 +612,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS zval *params_array; int call_via_handler = 0; char *old_func_name = NULL; - int clen , mlen, fname_len; + unsigned int clen; + int mlen, fname_len; char *mname, *colon, *fname, *lcname; if (EG(exception)) { @@ -646,13 +647,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS *fci->retval_ptr_ptr = NULL; if (!fci_cache || !fci_cache->initialized) { - if (fci->function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */ + if (Z_TYPE_P(fci->function_name)==IS_ARRAY) { /* assume array($obj, $name) couple */ zval **tmp_object_ptr, **tmp_real_function_name; - if (zend_hash_index_find(fci->function_name->value.ht, 0, (void **) &tmp_object_ptr)==FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_P(fci->function_name), 0, (void **) &tmp_object_ptr)==FAILURE) { return FAILURE; } - if (zend_hash_index_find(fci->function_name->value.ht, 1, (void **) &tmp_real_function_name)==FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_P(fci->function_name), 1, (void **) &tmp_real_function_name)==FAILURE) { return FAILURE; } fci->function_name = *tmp_real_function_name; @@ -734,12 +735,12 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } } - if (fci->function_name->type != IS_STRING && - fci->function_name->type != IS_UNICODE) { + if (Z_TYPE_P(fci->function_name) != IS_STRING && + Z_TYPE_P(fci->function_name) != IS_UNICODE) { return FAILURE; } - if (UG(unicode) && fci->function_name->type == IS_STRING) { + if (UG(unicode) && Z_TYPE_P(fci->function_name) == IS_STRING) { old_func_name = Z_STRVAL_P(fci->function_name); Z_STRVAL_P(fci->function_name) = estrndup(Z_STRVAL_P(fci->function_name), Z_STRLEN_P(fci->function_name)); @@ -1143,32 +1144,32 @@ ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr, UChar *str = (UChar*)string; if (retval_ptr) { - pv.value.ustr.len = u_strlen(str)+sizeof("return ;")-1; - pv.value.ustr.val = eumalloc(pv.value.ustr.len+1); - u_strcpy(pv.value.ustr.val, u_return); - u_strcat(pv.value.ustr.val, str); - u_strcat(pv.value.ustr.val, u_semicolon); + Z_USTRLEN(pv) = u_strlen(str)+sizeof("return ;")-1; + Z_USTRVAL(pv) = eumalloc(Z_USTRLEN(pv)+1); + u_strcpy(Z_USTRVAL(pv), u_return); + u_strcat(Z_USTRVAL(pv), str); + u_strcat(Z_USTRVAL(pv), u_semicolon); } else { - pv.value.ustr.len = u_strlen(str); - pv.value.ustr.val = eustrndup(str, pv.value.str.len); + Z_USTRLEN(pv) = u_strlen(str); + Z_USTRVAL(pv) = eustrndup(str, Z_USTRLEN(pv)); } } else { char *str = (char*)string; if (retval_ptr) { - pv.value.str.len = strlen(str)+sizeof("return ;")-1; - pv.value.str.val = emalloc(pv.value.str.len+1); - strcpy(pv.value.str.val, "return "); - strcat(pv.value.str.val, str); - strcat(pv.value.str.val, " ;"); + Z_STRLEN(pv) = strlen(str)+sizeof("return ;")-1; + Z_STRVAL(pv) = emalloc(Z_STRLEN(pv)+1); + strcpy(Z_STRVAL(pv), "return "); + strcat(Z_STRVAL(pv), str); + strcat(Z_STRVAL(pv), " ;"); } else { - pv.value.str.len = strlen(str); - pv.value.str.val = estrndup(str, pv.value.str.len); + Z_STRLEN(pv) = strlen(str); + Z_STRVAL(pv) = estrndup(str, Z_STRLEN(pv)); } } - pv.type = type; + Z_TYPE(pv) = type; - /*printf("Evaluating '%s'\n", pv.value.str.val);*/ + /*printf("Evaluating '%s'\n", Z_STRVAL(pv));*/ original_handle_op_arrays = CG(handle_op_arrays); CG(handle_op_arrays) = 0; diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index fd16c5eadd..be25855fb2 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -84,7 +84,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini zend_printf(""); zend_printf("\n", last_color); /* highlight stuff coming back from zendlex() */ - token.type = 0; + Z_TYPE(token) = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_INLINE_HTML: @@ -110,13 +110,13 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini break; case T_WHITESPACE: zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */ - token.type = 0; + Z_TYPE(token) = 0; continue; break; default: if (in_string) { next_color = syntax_highlighter_ini->highlight_string; - } else if (token.type == 0) { + } else if (Z_TYPE(token) == 0) { next_color = syntax_highlighter_ini->highlight_keyword; } else { next_color = syntax_highlighter_ini->highlight_default; @@ -135,15 +135,15 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini } switch (token_type) { case T_END_HEREDOC: - zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC); + zend_html_puts(Z_STRVAL(token), Z_STRLEN(token) TSRMLS_CC); break; default: zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); break; } - if (token.type == IS_STRING || - token.type == IS_UNICODE) { + if (Z_TYPE(token) == IS_STRING || + Z_TYPE(token) == IS_UNICODE) { switch (token_type) { case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: @@ -159,7 +159,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini } else if (token_type == T_END_HEREDOC) { efree(Z_UNIVAL(token)); } - token.type = 0; + Z_TYPE(token) = 0; } if (last_color != syntax_highlighter_ini->highlight_html) { zend_printf("\n"); @@ -177,7 +177,7 @@ ZEND_API void zend_strip(TSRMLS_D) int prev_space = 0; CG(literal_type) = IS_STRING; - token.type = 0; + Z_TYPE(token) = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_WHITESPACE: @@ -188,7 +188,7 @@ ZEND_API void zend_strip(TSRMLS_D) /* lack of break; is intentional */ case T_COMMENT: case T_DOC_COMMENT: - token.type = 0; + Z_TYPE(token) = 0; continue; case EOF: @@ -196,14 +196,14 @@ ZEND_API void zend_strip(TSRMLS_D) case T_END_HEREDOC: zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); - efree(token.value.str.val); + efree(Z_STRVAL(token)); /* read the following character, either newline or ; */ if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) { zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); } zend_write("\n", sizeof("\n") - 1); prev_space = 1; - token.type = 0; + Z_TYPE(token) = 0; continue; default: @@ -211,8 +211,8 @@ ZEND_API void zend_strip(TSRMLS_D) break; } - if (token.type == IS_STRING || - token.type == IS_UNICODE) { + if (Z_TYPE(token) == IS_STRING || + Z_TYPE(token) == IS_UNICODE) { switch (token_type) { case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: @@ -227,7 +227,7 @@ ZEND_API void zend_strip(TSRMLS_D) break; } } - prev_space = token.type = 0; + prev_space = Z_TYPE(token) = 0; } } diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index bff8f2c408..a8ec19243a 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -60,14 +60,14 @@ ZEND_API void zend_indent() memset(emit_whitespace, 0, sizeof(int)*256); /* highlight stuff coming back from zendlex() */ - token.type = 0; + Z_TYPE(token) = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_INLINE_HTML: zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); break; case T_WHITESPACE: { - token.type = 0; + Z_TYPE(token) = 0; /* eat whitespace, emit newlines */ for (i=0; iname, p->name_length, &default_value))==SUCCESS) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) { - hashed_ini_entry->value = default_value.value.str.val; - hashed_ini_entry->value_length = default_value.value.str.len; + || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) { + hashed_ini_entry->value = Z_STRVAL(default_value); + hashed_ini_entry->value_length = Z_STRLEN(default_value); config_directive_success = 1; } } diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 8d9098f9ed..67a53f4040 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -58,11 +58,11 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) int i_op1, i_op2; char str_result[MAX_LENGTH_OF_LONG]; - i_op1 = atoi(op1->value.str.val); - free(op1->value.str.val); + i_op1 = atoi(Z_STRVAL_P(op1)); + free(Z_STRVAL_P(op1)); if (op2) { - i_op2 = atoi(op2->value.str.val); - free(op2->value.str.val); + i_op2 = atoi(Z_STRVAL_P(op2)); + free(Z_STRVAL_P(op2)); } else { i_op2 = 0; } @@ -85,30 +85,30 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) break; } - result->value.str.len = zend_sprintf(str_result, "%d", i_result); - result->value.str.val = (char *) malloc(result->value.str.len+1); - memcpy(result->value.str.val, str_result, result->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; + Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result); + Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1); + memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result)); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_TYPE_P(result) = IS_STRING; } void zend_ini_init_string(zval *result) { - result->value.str.val = malloc(1); - result->value.str.val[0] = 0; - result->value.str.len = 0; - result->type = IS_STRING; + Z_STRVAL_P(result) = malloc(1); + Z_STRVAL_P(result)[0] = 0; + Z_STRLEN_P(result) = 0; + Z_TYPE_P(result) = IS_STRING; } void zend_ini_add_string(zval *result, zval *op1, zval *op2) -{ - int length = op1->value.str.len + op2->value.str.len; - - result->value.str.val = (char *) realloc(op1->value.str.val, length+1); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[length] = 0; - result->value.str.len = length; - result->type = IS_STRING; +{ + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + + Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[length] = 0; + Z_STRLEN_P(result) = length; + Z_TYPE_P(result) = IS_STRING; } void zend_ini_get_constant(zval *result, zval *name) @@ -116,15 +116,15 @@ void zend_ini_get_constant(zval *result, zval *name) zval z_constant; TSRMLS_FETCH(); - if (!memchr(name->value.str.val, ':', name->value.str.len) - && zend_get_constant(name->value.str.val, name->value.str.len, &z_constant TSRMLS_CC)) { + if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) + && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { /* z_constant is emalloc()'d */ convert_to_string(&z_constant); - result->value.str.val = zend_strndup(z_constant.value.str.val, z_constant.value.str.len); - result->value.str.len = z_constant.value.str.len; - result->type = z_constant.type; + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); + Z_STRLEN_P(result) = Z_STRLEN(z_constant); + Z_TYPE_P(result) = Z_TYPE(z_constant); zval_dtor(&z_constant); - free(name->value.str.val); + free(Z_STRVAL_P(name)); } else { *result = *name; } @@ -136,13 +136,13 @@ void zend_ini_get_var(zval *result, zval *name) char *envvar; TSRMLS_FETCH(); - if (zend_get_configuration_directive(name->value.str.val, name->value.str.len+1, &curval) == SUCCESS) { - result->value.str.val = zend_strndup(curval.value.str.val, curval.value.str.len); - result->value.str.len = curval.value.str.len; - } else if ((envvar = zend_getenv(name->value.str.val, name->value.str.len TSRMLS_CC)) != NULL || - (envvar = getenv(name->value.str.val)) != NULL) { - result->value.str.val = strdup(envvar); - result->value.str.len = strlen(envvar); + if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) { + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval)); + Z_STRLEN_P(result) = Z_STRLEN(curval); + } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL || + (envvar = getenv(Z_STRVAL_P(name))) != NULL) { + Z_STRVAL_P(result) = strdup(envvar); + Z_STRLEN_P(result) = strlen(envvar); } else { zend_ini_init_string(result); } @@ -208,7 +208,6 @@ ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_erro ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg) { - int len; zend_ini_parser_param ini_parser_param; TSRMLS_FETCH(); @@ -253,22 +252,22 @@ statement_list: statement: TC_STRING '=' string_or_value { #if DEBUG_CFG_PARSER - printf("'%s' = '%s'\n", $1.value.str.val, $3.value.str.val); + printf("'%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3)); #endif ZEND_INI_PARSER_CB(&$1, &$3, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); - free($1.value.str.val); - free($3.value.str.val); + free(Z_STRVAL($1)); + free(Z_STRVAL($3)); } | TC_STRING BRACK '=' string_or_value { #if DEBUG_CFG_PARSER - printf("'%s'[ ] = '%s'\n", $1.value.str.val, $4.value.str.val); + printf("'%s'[ ] = '%s'\n", Z_STRVAL($1), Z_STRVAL($4)); #endif ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG); - free($1.value.str.val); - free($4.value.str.val); + free(Z_STRVAL($1)); + free(Z_STRVAL($4)); } - | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); } - | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); } + | TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); } + | SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL($1)); } | '\n' ; @@ -284,8 +283,8 @@ string_or_value: var_string_list: - var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } - | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); } + var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } + | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free(Z_STRVAL($2)); } | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); } | /* empty */ { zend_ini_init_string(&$$); } ; diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index c42051938f..74476968ff 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -116,17 +116,17 @@ NEWLINE ("\r"|"\n"|"\r\n") } [ ]*("true"|"on"|"yes")[ ]* { - ini_lval->value.str.val = zend_strndup("1", 1); - ini_lval->value.str.len = 1; - ini_lval->type = IS_STRING; + Z_STRVAL_P(ini_lval) = zend_strndup("1", 1); + Z_STRLEN_P(ini_lval) = 1; + Z_TYPE_P(ini_lval) = IS_STRING; return CFG_TRUE; } [ ]*("false"|"off"|"no"|"none")[ ]* { - ini_lval->value.str.val = zend_strndup("", 0); - ini_lval->value.str.len = 0; - ini_lval->type = IS_STRING; + Z_STRVAL_P(ini_lval) = zend_strndup("", 0); + Z_STRLEN_P(ini_lval) = 0; + Z_TYPE_P(ini_lval) = IS_STRING; return CFG_FALSE; } @@ -145,9 +145,9 @@ NEWLINE ("\r"|"\n"|"\r\n") yytext++; yyleng--; - ini_lval->value.str.val = zend_strndup(yytext, yyleng); - ini_lval->value.str.len = yyleng; - ini_lval->type = IS_STRING; + Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); + Z_STRLEN_P(ini_lval) = yyleng; + Z_TYPE_P(ini_lval) = IS_STRING; return SECTION; } @@ -171,9 +171,9 @@ NEWLINE ("\r"|"\n"|"\r\n") /* eat leading " */ yytext++; - ini_lval->value.str.val = zend_strndup(yytext, yyleng - 2); - ini_lval->value.str.len = yyleng - 2; - ini_lval->type = IS_STRING; + Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng - 2); + Z_STRLEN_P(ini_lval) = yyleng - 2; + Z_TYPE_P(ini_lval) = IS_STRING; return TC_ENCAPSULATED_STRING; } @@ -186,7 +186,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } "}" { - ini_lval->value.lval = (long) yytext[0]; + Z_LVAL_P(ini_lval) = (long) yytext[0]; return yytext[0]; } @@ -213,9 +213,9 @@ NEWLINE ("\r"|"\n"|"\r\n") } } if (yyleng!=0) { - ini_lval->value.str.val = zend_strndup(yytext, yyleng); - ini_lval->value.str.len = yyleng; - ini_lval->type = IS_STRING; + Z_STRVAL_P(ini_lval) = zend_strndup(yytext, yyleng); + Z_STRLEN_P(ini_lval) = yyleng; + Z_TYPE_P(ini_lval) = IS_STRING; return TC_STRING; } else { /* whitespace */ diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 07b9d450c2..cd1bc70874 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -201,7 +201,7 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st } return HASH_KEY_IS_LONG; } - switch (retval->type) { + switch (Z_TYPE_P(retval)) { default: zend_error(E_WARNING, "Illegal type returned from %v::key()", iter->ce->name); case IS_NULL: @@ -211,13 +211,13 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st case IS_STRING: *str_key = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); - *str_key_len = retval->value.str.len+1; + *str_key_len = Z_STRLEN_P(retval)+1; zval_ptr_dtor(&retval); return HASH_KEY_IS_STRING; case IS_UNICODE: *str_key = (char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); - *str_key_len = retval->value.str.len+1; + *str_key_len = Z_USTRLEN_P(retval)+1; zval_ptr_dtor(&retval); return HASH_KEY_IS_UNICODE; @@ -225,10 +225,10 @@ ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **st case IS_RESOURCE: case IS_BOOL: case IS_LONG: { - if (retval->type == IS_DOUBLE) { - *int_key = (long)retval->value.dval; + if (Z_TYPE_P(retval) == IS_DOUBLE) { + *int_key = (long)Z_DVAL_P(retval); } else { - *int_key = retval->value.lval; + *int_key = Z_LVAL_P(retval); } } zval_ptr_dtor(&retval); @@ -430,12 +430,12 @@ int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len zval_ptr_dtor(&retval); return FAILURE; case IS_STRING: - *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); *buf_len = Z_STRLEN_P(retval); result = SUCCESS; break; case IS_UNICODE: - *buffer = (char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); + *buffer = (unsigned char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); *buf_len = Z_USTRLEN_P(retval); result = SUCCESS; break; diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index 9621e3b160..7de3a26f09 100755 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -67,8 +67,8 @@ ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC) MAKE_STD_ZVAL(wrapped); Z_TYPE_P(wrapped) = IS_OBJECT; - wrapped->value.obj.handle = zend_objects_store_put(iter, iter_wrapper_dtor, NULL, NULL TSRMLS_CC); - wrapped->value.obj.handlers = &iterator_object_handlers; + Z_OBJ_HANDLE_P(wrapped) = zend_objects_store_put(iter, iter_wrapper_dtor, NULL, NULL TSRMLS_CC); + Z_OBJ_HT_P(wrapped) = &iterator_object_handlers; return wrapped; } diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 624f6649af..a0addb86dc 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -6,7 +6,7 @@ | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | +----------------------------------------------------------------------+ | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | + | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.zend.com/license/2_00.txt. | | If you did not receive a copy of the Zend license and are unable to | @@ -20,13 +20,13 @@ /* $Id$ */ -/* +/* * LALR shift/reduce conflicts and how they are resolved: * * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift. - * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift. + * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift. * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift. - * + * */ @@ -192,7 +192,7 @@ unticked_statement: | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); } | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); } | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); } - | T_FOR + | T_FOR '(' for_expr ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); } @@ -216,13 +216,13 @@ unticked_statement: | expr ';' { zend_do_free(&$1 TSRMLS_CC); } | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); } | T_UNSET '(' unset_variables ')' ';' - | T_FOREACH '(' variable { zend_do_foreach_begin(&$1, &$2, &$3, 1 TSRMLS_CC); } T_AS - { zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); } - foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } + | T_FOREACH '(' variable { zend_do_foreach_begin(&$1, &$2, &$3, 1 TSRMLS_CC); } T_AS + { zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); } + foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); } - | T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS - { zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); } - variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } + | T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS + { zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); } + variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); } foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); } | T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); } | ';' /* empty statement */ @@ -245,7 +245,7 @@ non_empty_additional_catches: additional_catch { $$ = $1; } | non_empty_additional_catches additional_catch { $$ = $2; } ; - + additional_catch: T_CATCH '(' fully_qualified_class_name { $$.u.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); } @@ -289,13 +289,13 @@ unticked_function_declaration_statement: unticked_class_declaration_statement: class_entry_type T_STRING extends_from - { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); } + { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); } implements_list '{' class_statement_list '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); } | interface_entry T_STRING - { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); } + { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); } interface_extends_list '{' class_statement_list @@ -420,44 +420,44 @@ new_else_single: ; -parameter_list: +parameter_list: non_empty_parameter_list | /* empty */ ; non_empty_parameter_list: - optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$2, 0 TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$3, 1 TSRMLS_CC); } - | optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, &$1, &$3, 1 TSRMLS_CC); } - | optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, &$1, &$2, 0 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$4, 0 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$5, 1 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$7, &$3, &$5, 1 TSRMLS_CC); } - | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; $$.u.constant.value.lval++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, &$3, &$4, 0 TSRMLS_CC); } + optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$2, 0 TSRMLS_CC); } + | optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$3, 1 TSRMLS_CC); } + | optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, &$1, &$3, 1 TSRMLS_CC); } + | optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, &$1, &$2, 0 TSRMLS_CC); } + | non_empty_parameter_list ',' optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$4, 0 TSRMLS_CC); } + | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$5, 1 TSRMLS_CC); } + | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$7, &$3, &$5, 1 TSRMLS_CC); } + | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, &$3, &$4, 0 TSRMLS_CC); } ; optional_class_type: /* empty */ { $$.op_type = IS_UNUSED; } | T_STRING { $$ = $1; } - | T_ARRAY { $$.op_type = IS_CONST; $$.u.constant.type=IS_NULL;} + | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NULL;} ; function_call_parameter_list: non_empty_function_call_parameter_list { $$ = $1; } - | /* empty */ { $$.u.constant.value.lval = 0; } + | /* empty */ { Z_LVAL($$.u.constant) = 0; } ; non_empty_function_call_parameter_list: - expr_without_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); } - | variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); } - | '&' w_variable { $$.u.constant.value.lval = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval TSRMLS_CC); } - | non_empty_function_call_parameter_list ',' '&' w_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; zend_do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval TSRMLS_CC); } + expr_without_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); } + | variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); } + | '&' w_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); } + | non_empty_function_call_parameter_list ',' expr_without_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); } + | non_empty_function_call_parameter_list ',' variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); } + | non_empty_function_call_parameter_list ',' '&' w_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$4, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); } ; global_var_list: @@ -489,40 +489,40 @@ class_statement_list: class_statement: - variable_modifiers { CG(access_type) = $1.u.constant.value.lval; } class_variable_declaration ';' + variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';' | class_constant_declaration ';' - | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '(' + | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '(' parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); } ; method_body: - ';' /* abstract method */ { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; } - | '{' inner_statement_list '}' { $$.u.constant.value.lval = 0; } + ';' /* abstract method */ { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } + | '{' inner_statement_list '}' { Z_LVAL($$.u.constant) = 0; } ; variable_modifiers: non_empty_member_modifiers { $$ = $1; } - | T_VAR { zend_error(E_STRICT, "var: Deprecated. Please use the public/private/protected modifiers"); $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } + | T_VAR { zend_error(E_STRICT, "var: Deprecated. Please use the public/private/protected modifiers"); Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } ; method_modifiers: - /* empty */ { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } - | non_empty_member_modifiers { $$ = $1; if (!($$.u.constant.value.lval & ZEND_ACC_PPP_MASK)) { $$.u.constant.value.lval |= ZEND_ACC_PUBLIC; } } + /* empty */ { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } + | non_empty_member_modifiers { $$ = $1; if (!(Z_LVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } } ; non_empty_member_modifiers: member_modifier { $$ = $1; } - | non_empty_member_modifiers member_modifier { $$.u.constant.value.lval = zend_do_verify_access_types(&$1, &$2); } + | non_empty_member_modifiers member_modifier { Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); } ; member_modifier: - T_PUBLIC { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; } - | T_PROTECTED { $$.u.constant.value.lval = ZEND_ACC_PROTECTED; } - | T_PRIVATE { $$.u.constant.value.lval = ZEND_ACC_PRIVATE; } - | T_STATIC { $$.u.constant.value.lval = ZEND_ACC_STATIC; } - | T_ABSTRACT { $$.u.constant.value.lval = ZEND_ACC_ABSTRACT; } - | T_FINAL { $$.u.constant.value.lval = ZEND_ACC_FINAL; } + T_PUBLIC { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } + | T_PROTECTED { Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; } + | T_PRIVATE { Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; } + | T_STATIC { Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; } + | T_ABSTRACT { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } + | T_FINAL { Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; } ; class_variable_declaration: @@ -537,14 +537,14 @@ class_constant_declaration: | T_CONST T_STRING '=' static_scalar { zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); } ; -echo_expr_list: +echo_expr_list: echo_expr_list ',' expr { zend_do_echo(&$3, 0 TSRMLS_CC); } | expr { zend_do_echo(&$1, 0 TSRMLS_CC); } ; for_expr: - /* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; } + /* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_LVAL($$.u.constant) = 1; } | non_empty_for_expr { $$ = $1; } ; @@ -553,7 +553,7 @@ non_empty_for_expr: | expr { $$ = $1; } ; -expr_without_variable: +expr_without_variable: T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); } | variable '=' expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); } | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); } @@ -569,14 +569,14 @@ expr_without_variable: | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); } | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); } | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); } - | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); } + | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); } | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); } | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); } | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); } | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); } | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } - | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } + | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); } | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); } @@ -591,8 +591,8 @@ expr_without_variable: | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); } - | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } - | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } + | '+' expr { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } + | '-' expr { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); } | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); } | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); } @@ -611,8 +611,8 @@ expr_without_variable: | internal_functions_in_yacc { $$ = $1; } | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } - | T_STRING_CAST expr { zend_do_cast(&$$, &$2, UG(unicode)?IS_UNICODE:IS_STRING TSRMLS_CC); } - | T_UNICODE_CAST expr { zend_do_cast(&$$, &$2, IS_UNICODE TSRMLS_CC); } + | T_STRING_CAST expr { zend_do_cast(&$$, &$2, UG(unicode)?IS_UNICODE:IS_STRING TSRMLS_CC); } + | T_UNICODE_CAST expr { zend_do_cast(&$$, &$2, IS_UNICODE TSRMLS_CC); } | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); } | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); } | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); } @@ -629,11 +629,11 @@ function_call: T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); } function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); } - | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list + | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} - | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } - function_call_parameter_list + | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); } + function_call_parameter_list ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);} | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); } function_call_parameter_list ')' @@ -669,14 +669,14 @@ dynamic_class_name_variable_property: ; exit_expr: - /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } - | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } + /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } + | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; } | '(' expr ')' { $$ = $2; } ; ctor_arguments: - /* empty */ { $$.u.constant.value.lval=0; } + /* empty */ { Z_LVAL($$.u.constant)=0; } | '(' function_call_parameter_list ')' { $$ = $2; } ; @@ -697,8 +697,8 @@ static_scalar: /* compile-time evaluated scalars */ common_scalar { $$ = $1; } | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); } | '+' static_scalar { $$ = $2; } - | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; $$.u.constant.type = IS_CONSTANT_ARRAY; } + | '-' static_scalar { zval minus_one; Z_TYPE(minus_one) = IS_LONG; Z_LVAL(minus_one) = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; } + | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } | static_class_constant { $$ = $1; } ; @@ -775,7 +775,7 @@ variable_property: method_or_not: '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); } - function_call_parameter_list ')' + function_call_parameter_list ')' { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_push_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_METHOD_CALL; } | /* empty */ { zend_do_declare_implicit_property(TSRMLS_C); $$.u.EA.type = ZEND_PARSED_MEMBER; } @@ -802,13 +802,13 @@ base_variable: | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_VARIABLE; } | static_member { $$ = $1; $$.u.EA.type = ZEND_PARSED_STATIC_MEMBER; } ; - + reference_variable: reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); } | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); } ; - + compound_variable: T_VARIABLE { $$ = $1; } @@ -838,8 +838,8 @@ variable_name: ; simple_indirect_reference: - '$' { $$.u.constant.value.lval = 1; } - | simple_indirect_reference '$' { $$.u.constant.value.lval++; } + '$' { Z_LVAL($$.u.constant) = 1; } + | simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; } ; assignment_list: @@ -878,11 +878,11 @@ encaps_list: | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } | encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } | encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '[' { $2.u.constant.value.lval = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list ']' { $2.u.constant.value.lval = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '{' { $2.u.constant.value.lval = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list '}' { $2.u.constant.value.lval = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } - | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); $2.u.constant.value.lval = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); } + | encaps_list '[' { Z_LVAL($2.u.constant) = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } + | encaps_list ']' { Z_LVAL($2.u.constant) = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } + | encaps_list '{' { Z_LVAL($2.u.constant) = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } + | encaps_list '}' { Z_LVAL($2.u.constant) = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); } + | encaps_list T_OBJECT_OPERATOR { znode tmp; Z_LVAL($2.u.constant) = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); Z_LVAL($2.u.constant) = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); } | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); } ; @@ -919,7 +919,7 @@ internal_functions_in_yacc: isset_variables: variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); } | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); } -; +; class_constant: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 2ae42a360f..a5beb25b3c 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -416,18 +416,18 @@ static inline int zend_copy_string_value(zval *zendlval, char *str, zend_uint st int32_t consumed = 0; if (type == IS_UNICODE) { - consumed = zend_convert_scanner_output(&zendlval->value.ustr.val, &zendlval->value.ustr.len, str, str_len, &status TSRMLS_CC); + consumed = zend_convert_scanner_output(&Z_USTRVAL_P(zendlval), &Z_USTRLEN_P(zendlval), str, str_len, &status TSRMLS_CC); if (U_FAILURE(status)) { zend_error(E_COMPILE_WARNING,"Illegal or truncated character in input: offset %d, state=%d", consumed, YYSTATE); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } - zendlval->type = IS_UNICODE; + Z_TYPE_P(zendlval) = IS_UNICODE; } else { - zendlval->value.str.val = (char *)estrndup(str, str_len); - zendlval->value.str.len = str_len; - zendlval->type = type; + Z_STRVAL_P(zendlval) = (char *)estrndup(str, str_len); + Z_STRLEN_P(zendlval) = str_len; + Z_TYPE_P(zendlval) = type; } return 1; @@ -786,8 +786,8 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR zend_bool original_in_compilation = CG(in_compilation); retval_znode.op_type = IS_CONST; - retval_znode.u.constant.type = IS_LONG; - retval_znode.u.constant.value.lval = 1; + Z_TYPE(retval_znode.u.constant) = IS_LONG; + Z_LVAL(retval_znode.u.constant) = 1; retval_znode.u.constant.is_ref = 0; retval_znode.u.constant.refcount = 1; @@ -840,13 +840,13 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) zend_op_array *retval; char *opened_path = NULL; - if (filename->type != IS_STRING) { + if (Z_TYPE_P(filename) != IS_STRING) { tmp = *filename; zval_copy_ctor(&tmp); convert_to_string(&tmp); filename = &tmp; } - file_handle.filename = filename->value.str.val; + file_handle.filename = Z_STRVAL_P(filename); file_handle.free_filename = 0; file_handle.type = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; @@ -857,7 +857,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) int dummy = 1; if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(filename->value.str.val, filename->value.str.len); + file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename)); } zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL); @@ -888,14 +888,14 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D } /* enforce two trailing NULLs for flex... */ - STR_REALLOC(str->value.str.val, str->value.str.len+2); + STR_REALLOC(Z_STRVAL_P(str), Z_STRLEN_P(str)+2); - str->value.str.val[str->value.str.len+1]=0; + Z_STRVAL_P(str)[Z_STRLEN_P(str)+1]=0; SCNG(yy_in)=NULL; zend_prepare_scanner_converters(encoding, 0 TSRMLS_CC); - yy_scan_buffer(str->value.str.val, str->value.str.len+2 TSRMLS_CC); + yy_scan_buffer(Z_STRVAL_P(str), Z_STRLEN_P(str)+2 TSRMLS_CC); zend_set_compiled_filename(filename TSRMLS_CC); zend_set_compiled_script_encoding((char*)ucnv_getName(SCNG(output_conv), &status) TSRMLS_CC); @@ -1014,8 +1014,8 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ END_EXTERN_C() #define zend_copy_value(zendlval, yytext, yyleng) \ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); \ - zendlval->value.str.len = yyleng; + Z_STRVAL_P(zendlval) = (char *)estrndup(yytext, yyleng); \ + Z_STRLEN_P(zendlval) = yyleng; int zend_scan_unicode_double_string(zval *zendlval TSRMLS_DC) { @@ -1034,8 +1034,8 @@ int zend_scan_unicode_double_string(zval *zendlval TSRMLS_DC) } /* convert escape sequences */ - s = t = zendlval->value.ustr.val; - end = s+zendlval->value.ustr.len; + s = t = Z_USTRVAL_P(zendlval); + end = s+Z_USTRLEN_P(zendlval); while (svalue.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x72: /*'r'*/ *t++ = (UChar) 0x0D; /*'\r'*/ - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x74: /*'t'*/ *t++ = (UChar) 0x09; /*'\t'*/ - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x5C: /*'\\'*/ case 0x24: /*'$'*/ case 0x22: /*'"'*/ *t++ = *s; - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x43: /*'C'*/ { UChar *p = s+1; if (p < end && zend_parse_charname_sequence(&p, end, &codepoint)) { - zendlval->value.ustr.len -= p - s + 1; + Z_USTRLEN_P(zendlval) -= p - s + 1; s = p; if (U_IS_BMP(codepoint)) { *t++ = (UChar) codepoint; } else { *t++ = (UChar) U16_LEAD(codepoint); *t++ = (UChar) U16_TRAIL(codepoint); - zendlval->value.ustr.len++; + Z_USTRLEN_P(zendlval)++; } } else { zend_error(E_COMPILE_WARNING, "Invalid \\C{..} sequence"); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } break; @@ -1091,12 +1091,12 @@ int zend_scan_unicode_double_string(zval *zendlval TSRMLS_DC) case 0x75: /*'u'*/ min_digits = 4; max_digits = 4; - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x55: /*'U'*/ min_digits = 6; max_digits = 6; - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; default: digit = zend_get_octal_digit(*s); @@ -1110,7 +1110,7 @@ int zend_scan_unicode_double_string(zval *zendlval TSRMLS_DC) && (s+1) < end && (digit = zend_get_hex_digit(*(s+1))) >= 0) { min_digits = 1; max_digits = 2; - zendlval->value.ustr.len--; + Z_USTRLEN_P(zendlval)--; s++; n = 1; /* already have one digit */ codepoint = digit; @@ -1135,20 +1135,20 @@ int zend_scan_unicode_double_string(zval *zendlval TSRMLS_DC) if (n < min_digits) { /* can only happen for \u and \U sequences */ zend_error(E_COMPILE_WARNING,"\\%c escape sequence requires exactly %d hexadecimal digits", (char) c, min_digits); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } if (U_IS_BMP(codepoint)) { *t++ = (UChar) codepoint; - zendlval->value.ustr.len -= n; + Z_USTRLEN_P(zendlval) -= n; } else if (codepoint <= 0x10FFFF) { *t++ = (UChar) U16_LEAD(codepoint); *t++ = (UChar) U16_TRAIL(codepoint); - zendlval->value.ustr.len -= n-1; + Z_USTRLEN_P(zendlval) -= n-1; } else { zend_error(E_COMPILE_WARNING,"\\U%06x is above the highest valid codepoint 0x10FFFF", codepoint); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } } else { @@ -1176,8 +1176,8 @@ int zend_scan_unicode_single_string(zval *zendlval TSRMLS_DC) } /* convert escape sequences */ - s = t = zendlval->value.ustr.val; - end = s+zendlval->value.ustr.len; + s = t = Z_USTRVAL_P(zendlval); + end = s+Z_USTRLEN_P(zendlval); while (svalue.ustr.len--; + Z_USTRLEN_P(zendlval)--; break; case 0x43: /*'C'*/ { UChar *p = s+1; if (p < end && zend_parse_charname_sequence(&p, end, &codepoint)) { - zendlval->value.ustr.len -= p - s + 1; + Z_USTRLEN_P(zendlval) -= p - s + 1; s = p; if (U_IS_BMP(codepoint)) { *t++ = (UChar) codepoint; } else { *t++ = (UChar) U16_LEAD(codepoint); *t++ = (UChar) U16_TRAIL(codepoint); - zendlval->value.ustr.len++; + Z_USTRLEN_P(zendlval)++; } } else { zend_error(E_COMPILE_WARNING, "Invalid \\C{..} sequence"); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } break; @@ -1216,10 +1216,10 @@ int zend_scan_unicode_single_string(zval *zendlval TSRMLS_DC) if (zend_udigits_to_codepoint(s+1, end, &codepoint, 4)) { *t++ = (UChar) codepoint; s += 4; - zendlval->value.ustr.len -= 5; + Z_USTRLEN_P(zendlval) -= 5; } else { zend_error(E_COMPILE_WARNING,"\\u escape sequence requires exactly 4 hexadecimal digits"); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } break; @@ -1230,20 +1230,20 @@ int zend_scan_unicode_single_string(zval *zendlval TSRMLS_DC) if (zend_udigits_to_codepoint(s+1, end, &codepoint, 6)) { if (U_IS_BMP(codepoint)) { *t++ = (UChar) codepoint; - zendlval->value.ustr.len -= 7; + Z_USTRLEN_P(zendlval) -= 7; } else if (codepoint <= 0x10FFFF) { *t++ = (UChar) U16_LEAD(codepoint); *t++ = (UChar) U16_TRAIL(codepoint); - zendlval->value.ustr.len -= 6; + Z_USTRLEN_P(zendlval) -= 6; } else { zend_error(E_COMPILE_WARNING,"\\U%06x is above the highest valid codepoint 0x10FFFF", codepoint); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } s += 6; } else { zend_error(E_COMPILE_WARNING,"\\U escape sequence requires exactly 6 hexadecimal digits"); - efree(zendlval->value.ustr.val); + efree(Z_USTRVAL_P(zendlval)); return 0; } break; @@ -1268,14 +1268,14 @@ int zend_scan_binary_double_string(zval *zendlval TSRMLS_DC) register char *s, *t; char *end; - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = estrndup(yytext+1, yyleng-2); + Z_STRLEN_P(zendlval) = yyleng-2; + Z_TYPE_P(zendlval) = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; case 'r': *t++ = '\r'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case 't': *t++ = '\t'; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; case '\\': case '$': case '"': *t++ = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; break; default: /* check for an octal */ @@ -1307,26 +1307,26 @@ int zend_scan_binary_double_string(zval *zendlval TSRMLS_DC) char octal_buf[4] = { 0, 0, 0, 0 }; octal_buf[0] = *s; - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if ((s+1)value.str.len--; + Z_STRLEN_P(zendlval)--; if ((s+1)value.str.len--; + Z_STRLEN_P(zendlval)--; } } *t++ = (char) strtol(octal_buf, NULL, 8); } else if (*s=='x' && (s+1)value.str.len--; /* for the 'x' */ + Z_STRLEN_P(zendlval)--; /* for the 'x' */ hex_buf[0] = *(++s); - zendlval->value.str.len--; + Z_STRLEN_P(zendlval)--; if ((s+1)value.str.len--; + Z_STRLEN_P(zendlval)--; } *t++ = (char) strtol(hex_buf, NULL, 16); } else { @@ -1350,14 +1350,14 @@ int zend_scan_binary_single_string(zval *zendlval TSRMLS_DC) register char *s, *t; char *end; - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = estrndup(yytext+1, yyleng-2); + Z_STRLEN_P(zendlval) = yyleng-2; + Z_TYPE_P(zendlval) = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; + s = t = Z_STRVAL_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (svalue.str.len--; + Z_STRLEN_P(zendlval)--; break; default: *t++ = '\\'; @@ -1846,34 +1846,34 @@ NEWLINE ("\r"|"\n"|"\r\n") {LNUM} { errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); + Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); if (errno == ERANGE) { /* overflow */ - zendlval->value.dval = zend_strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; + Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); + Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } else { - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } } {HNUM} { errno = 0; - zendlval->value.lval = strtoul(yytext, NULL, 16); + Z_LVAL_P(zendlval) = strtoul(yytext, NULL, 16); if (errno == ERANGE) { /* overflow */ /* not trying strtod - it returns trash on 0x-es */ - zendlval->value.lval = LONG_MAX; /* maximal long */ + Z_LVAL_P(zendlval) = LONG_MAX; /* maximal long */ zend_error(E_NOTICE,"Hex number is too big: %s", yytext); } else { - if (zendlval->value.lval < 0) { + if (Z_LVAL_P(zendlval) < 0) { /* maintain consistency with the old way */ - zendlval->value.dval = (unsigned long) zendlval->value.lval; - zendlval->type = IS_DOUBLE; + Z_DVAL_P(zendlval) = (unsigned long) Z_LVAL_P(zendlval); + Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } @@ -1885,8 +1885,8 @@ NEWLINE ("\r"|"\n"|"\r\n") } {DNUM}|{EXPONENT_DNUM} { - zendlval->value.dval = zend_strtod(yytext, NULL); - zendlval->type = IS_DOUBLE; + Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); + Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } @@ -1940,7 +1940,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { func_name = (char*)EMPTY_STR; } - zendlval->value.str.len = len; + Z_USTRLEN_P(zendlval) = len; Z_USTRVAL_P(zendlval) = eumalloc(len+1); if (class_name) { u_strcpy(Z_USTRVAL_P(zendlval), (UChar*)class_name); @@ -1951,7 +1951,7 @@ NEWLINE ("\r"|"\n"|"\r\n") Z_USTRVAL_P(zendlval)[0] = 0; } u_strcat(Z_USTRVAL_P(zendlval), (UChar*)func_name); - zendlval->type = IS_UNICODE; + Z_TYPE_P(zendlval) = IS_UNICODE; } else { if (class_name) { len += strlen(class_name) + 2; @@ -1960,21 +1960,21 @@ NEWLINE ("\r"|"\n"|"\r\n") len += strlen(func_name); } - zendlval->value.str.val = emalloc(len+1); - zendlval->value.str.len = sprintf(zendlval->value.str.val, "%s%s%s", + Z_STRVAL_P(zendlval) = emalloc(len+1); + Z_STRLEN_P(zendlval) = sprintf(Z_STRVAL_P(zendlval), "%s%s%s", class_name ? class_name : "", class_name && func_name ? "::" : "", func_name ? func_name : "" ); - zendlval->value.str.len = strlen(zendlval->value.str.val); - zendlval->type = IS_STRING; + Z_STRLEN_P(zendlval) = strlen(Z_STRVAL_P(zendlval)); + Z_TYPE_P(zendlval) = IS_STRING; } return T_METHOD_C; } "__LINE__" { - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; + Z_LVAL_P(zendlval) = CG(zend_lineno); + Z_TYPE_P(zendlval) = IS_LONG; return T_LINE; } @@ -1989,9 +1989,9 @@ NEWLINE ("\r"|"\n"|"\r\n") } (([^<]|"<"[^?%s<]){1,400})|"value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } @@ -1999,15 +1999,15 @@ NEWLINE ("\r"|"\n"|"\r\n") "" { HANDLE_NEWLINES(yytext, yyleng); if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; return T_INLINE_HTML; } } @@ -2015,15 +2015,15 @@ NEWLINE ("\r"|"\n"|"\r\n") "<%="|"value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; return T_INLINE_HTML; } } @@ -2031,24 +2031,24 @@ NEWLINE ("\r"|"\n"|"\r\n") "<%" { if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; return T_INLINE_HTML; } } "value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; HANDLE_NEWLINE(yytext[yyleng-1]); BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; @@ -2083,9 +2083,9 @@ NEWLINE ("\r"|"\n"|"\r\n") {WHITESPACE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } @@ -2110,18 +2110,18 @@ NEWLINE ("\r"|"\n"|"\r\n") CG(zend_lineno)++; /* intentional fall through */ default: - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(ST_IN_SCRIPTING); return T_COMMENT; } } {NEWLINE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(ST_IN_SCRIPTING); CG(zend_lineno)++; return T_COMMENT; @@ -2129,9 +2129,9 @@ NEWLINE ("\r"|"\n"|"\r\n") "?>"|"%>" { if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; yyless(yyleng-2); BEGIN(ST_IN_SCRIPTING); return T_COMMENT; @@ -2177,9 +2177,9 @@ NEWLINE ("\r"|"\n"|"\r\n") } ("?>"|""){NEWLINE}? { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } @@ -2188,9 +2188,9 @@ NEWLINE ("\r"|"\n"|"\r\n") "%>"{NEWLINE}? { if (CG(asp_tags)) { BEGIN(INITIAL); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - zendlval->value.str.val = yytext; /* no copying - intentional */ + Z_STRLEN_P(zendlval) = yyleng; + Z_TYPE_P(zendlval) = IS_STRING; + Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } else { yyless(1); @@ -2291,8 +2291,8 @@ NEWLINE ("\r"|"\n"|"\r\n") } if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { - zendlval->value.str.val = estrndup(yytext, label_len); /* unput destroys yytext */ - zendlval->value.str.len = label_len; + Z_STRVAL_P(zendlval) = estrndup(yytext, label_len); /* unput destroys yytext */ + Z_STRLEN_P(zendlval) = label_len; yyless(yyleng - (yyleng - label_len)); efree(CG(heredoc)); CG(heredoc)=NULL; @@ -2334,7 +2334,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "$"[^a-zA-Z_\x7f-\xff{] { - zendlval->value.lval = (long) yytext[0]; + Z_LVAL_P(zendlval) = (long) yytext[0]; if (yyleng == 2) { yyless(1); } @@ -2343,12 +2343,12 @@ NEWLINE ("\r"|"\n"|"\r\n") {ENCAPSED_TOKENS} { - zendlval->value.lval = (long) yytext[0]; + Z_LVAL_P(zendlval) = (long) yytext[0]; return yytext[0]; } "{$" { - zendlval->value.lval = (long) yytext[0]; + Z_LVAL_P(zendlval) = (long) yytext[0]; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; @@ -2356,22 +2356,22 @@ NEWLINE ("\r"|"\n"|"\r\n") "\\\"" { - zendlval->value.lval = (long) '"'; + Z_LVAL_P(zendlval) = (long) '"'; return T_CHARACTER; } "\\`" { - zendlval->value.lval = (long) '`'; + Z_LVAL_P(zendlval) = (long) '`'; return T_CHARACTER; } "\\"[0-7]{1,3} { - zendlval->value.lval = strtol(yytext+1, NULL, 8); + Z_LVAL_P(zendlval) = strtol(yytext+1, NULL, 8); return T_CHARACTER; } "\\x"[0-9A-Fa-f]{1,2} { - zendlval->value.lval = strtol (yytext+2, NULL, 16); + Z_LVAL_P(zendlval) = strtol (yytext+2, NULL, 16); return T_CHARACTER; } @@ -2383,7 +2383,7 @@ NEWLINE ("\r"|"\n"|"\r\n") if (CG(literal_type) == IS_UNICODE) { if (zend_digits_to_codepoint(yytext+2, yytext+yyleng, &codepoint, req_digits)) { if (codepoint <= 0x10FFFF) { - zendlval->value.lval = (long) codepoint; + Z_LVAL_P(zendlval) = (long) codepoint; /* give back if we grabbed more than needed for \u case */ if (yyleng > req_digits + 2) { yyless(req_digits + 2); @@ -2413,7 +2413,7 @@ NEWLINE ("\r"|"\n"|"\r\n") /* safe, since we have } at the end */ yytext[yyleng-1] = 0; if (zend_uchar_from_name(yytext+3, &codepoint)) { - zendlval->value.lval = (long) codepoint; + Z_LVAL_P(zendlval) = (long) codepoint; return T_CHARACTER; } else { zend_error(E_COMPILE_WARNING, "Invalid Unicode character name: '%s'", yytext+3); @@ -2439,19 +2439,19 @@ NEWLINE ("\r"|"\n"|"\r\n") "\\"{ANY_CHAR} { switch (yytext[1]) { case 'n': - zendlval->value.lval = (long) '\n'; + Z_LVAL_P(zendlval) = (long) '\n'; break; case 't': - zendlval->value.lval = (long) '\t'; + Z_LVAL_P(zendlval) = (long) '\t'; break; case 'r': - zendlval->value.lval = (long) '\r'; + Z_LVAL_P(zendlval) = (long) '\r'; break; case '\\': - zendlval->value.lval = (long) '\\'; + Z_LVAL_P(zendlval) = (long) '\\'; break; case '$': - zendlval->value.lval = (long) yytext[1]; + Z_LVAL_P(zendlval) = (long) yytext[1]; break; default: if (!zend_copy_string_value(zendlval, yytext, yyleng, CG(literal_type) TSRMLS_CC)) { diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 9f2f430272..ded470eb4b 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -99,8 +99,8 @@ ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int r rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type); if (rsrc_result) { - rsrc_result->value.lval = rsrc_id; - rsrc_result->type = IS_RESOURCE; + Z_RESVAL_P(rsrc_result) = rsrc_id; + Z_TYPE_P(rsrc_result) = IS_RESOURCE; } return rsrc_id; @@ -124,14 +124,14 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name); } return NULL; - } else if ((*passed_id)->type != IS_RESOURCE) { + } else if (Z_TYPE_PP(passed_id) != IS_RESOURCE) { if (resource_type_name) { class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name); } return NULL; } - id = (*passed_id)->value.lval; + id = Z_RESVAL_PP(passed_id); } else { id = default_id; } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 4804f1dad8..6d7ece8ecb 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -312,7 +312,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) silent = (type == BP_VAR_IS); zobj = Z_OBJ_P(object); - if (member->type != IS_UNICODE && (UG(unicode) || member->type != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -370,7 +370,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zobj = Z_OBJ_P(object); - if (member->type != IS_UNICODE && (UG(unicode) || member->type != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -392,7 +392,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM zval garbage = **variable_ptr; /* old value should be destroyed */ /* To check: can't *variable_ptr be some system variable like error_zval here? */ - (*variable_ptr)->type = value->type; + Z_TYPE_PP(variable_ptr) = Z_TYPE_P(value); (*variable_ptr)->value = value->value; if (value->refcount>0) { zval_copy_ctor(*variable_ptr); @@ -523,7 +523,7 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC zobj = Z_OBJ_P(object); - if (member->type != IS_UNICODE && (UG(unicode) || member->type != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_text(&tmp_member); @@ -569,7 +569,7 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) zobj = Z_OBJ_P(object); - if (member->type != IS_UNICODE && (UG(unicode) || member->type != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); @@ -790,7 +790,7 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method /* Ensure that if we're calling a private function, we're allowed to do so. */ - updated_fbc = zend_check_private_int(fbc, object->value.obj.handlers->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) { 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 : (char*)EMPTY_STR); } @@ -914,7 +914,7 @@ static union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC) } else if (constructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { /* Ensure that if we're calling a private function, we're allowed to do so. */ - if (object->value.obj.handlers->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 : (char*)EMPTY_STR); } } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) { @@ -956,7 +956,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists zobj = Z_OBJ_P(object); - if (member->type != IS_UNICODE && (UG(unicode) || member->type != IS_STRING)) { + if (Z_TYPE_P(member) != IS_UNICODE && (UG(unicode) || Z_TYPE_P(member) != IS_STRING)) { ALLOC_ZVAL(tmp_member); *tmp_member = *member; INIT_PZVAL(tmp_member); diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 012045880f..e0db9b11a0 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -145,7 +145,7 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC); -#define IS_ZEND_STD_OBJECT(z) ((z).type == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) +#define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) #define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index a24fb28e45..c53eb82193 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -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, "Call to private %v::__destruct() from context '%v'%s", ce->name, - EG(scope) ? EG(scope)->name : EMPTY_STR, + EG(scope) ? EG(scope)->name : (char*)EMPTY_STR, EG(in_execution) ? "" : " during shutdown ignored"); return; } @@ -57,16 +57,16 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl 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 : EMPTY_STR, + EG(scope) ? EG(scope)->name : (char*)EMPTY_STR, EG(in_execution) ? "" : " during shutdown ignored"); return; } } } - zobj.type = IS_OBJECT; - zobj.value.obj.handle = handle; - zobj.value.obj.handlers = &std_object_handlers; + Z_TYPE(zobj) = IS_OBJECT; + Z_OBJ_HANDLE(zobj) = handle; + Z_OBJ_HT(zobj) = &std_object_handlers; INIT_PZVAL(obj); /* Make sure that destructors are protected from previously thrown exceptions. @@ -127,7 +127,7 @@ static void zval_add_ref_or_clone(zval **p) ALLOC_ZVAL(*p); **p = *orig; INIT_PZVAL(*p); - (*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC); + Z_OBJVAL_PP(p) = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC); } } else { (*p)->refcount++; @@ -145,8 +145,8 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_va zval *new_obj; MAKE_STD_ZVAL(new_obj); - new_obj->type = IS_OBJECT; - new_obj->value.obj = new_obj_val; + Z_TYPE_P(new_obj) = IS_OBJECT; + Z_OBJVAL_P(new_obj) = new_obj_val; zval_copy_ctor(new_obj); zend_call_method_with_0_params(&new_obj, old_object->ce, &old_object->ce->clone, ZEND_CLONE_FUNC_NAME, NULL); diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index e7084f013b..4cc688dfa2 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -273,7 +273,7 @@ ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC) zval_add_ref(&pobj->object); MAKE_STD_ZVAL(retval); - retval->type = IS_OBJECT; + Z_TYPE_P(retval) = IS_OBJECT; Z_OBJ_HANDLE_P(retval) = zend_objects_store_put(pobj, NULL, (zend_objects_free_object_storage_t) zend_objects_proxy_free_storage, (zend_objects_store_clone_t) zend_objects_proxy_clone TSRMLS_CC); Z_OBJ_HT_P(retval) = &zend_object_proxy_handlers; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index a0ece2f3e3..82d8908cd5 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -112,19 +112,19 @@ ZEND_API double zend_string_to_double(const char *number, zend_uint length) ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) { - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_STRING: { char *strval; - strval = op->value.str.val; - switch ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval, 1))) { + strval = Z_STRVAL_P(op); + switch ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1))) { case IS_DOUBLE: case IS_LONG: break; default: - op->value.lval = strtol(op->value.str.val, NULL, 10); - op->type = IS_LONG; + Z_LVAL_P(op) = strtol(Z_STRVAL_P(op), NULL, 10); + Z_TYPE_P(op) = IS_LONG; break; } STR_FREE(strval); @@ -134,14 +134,14 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) { UChar *strval; - strval = op->value.ustr.val; - switch ((op->type=is_numeric_unicode(strval, op->value.ustr.len, &op->value.lval, &op->value.dval, 1))) { + strval = Z_USTRVAL_P(op); + switch ((Z_TYPE_P(op)=is_numeric_unicode(strval, Z_USTRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1))) { case IS_DOUBLE: case IS_LONG: break; default: - op->value.lval = zend_u_strtol(op->value.ustr.val, NULL, 10); - op->type = IS_LONG; + Z_LVAL_P(op) = zend_u_strtol(Z_USTRVAL_P(op), NULL, 10); + Z_TYPE_P(op) = IS_LONG; break; } USTR_FREE(strval); @@ -149,38 +149,38 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) } break; case IS_BOOL: - op->type = IS_LONG; + Z_TYPE_P(op) = IS_LONG; break; case IS_RESOURCE: - zend_list_delete(op->value.lval); - op->type = IS_LONG; + zend_list_delete(Z_LVAL_P(op)); + Z_TYPE_P(op) = IS_LONG; break; case IS_OBJECT: convert_to_long_base(op, 10); break; case IS_NULL: - op->type = IS_LONG; - op->value.lval = 0; + Z_TYPE_P(op) = IS_LONG; + Z_LVAL_P(op) = 0; break; } } #define zendi_convert_scalar_to_number(op, holder, result) \ if (op==result) { \ - if (op->type != IS_LONG) { \ + if (Z_TYPE_P(op) != IS_LONG) { \ convert_scalar_to_number(op TSRMLS_CC); \ } \ } else { \ - switch ((op)->type) { \ + switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval, 1))) { \ - case IS_DOUBLE: \ - case IS_LONG: \ - break; \ - default: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ - (holder).type = IS_LONG; \ + switch ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1))) { \ + case IS_DOUBLE: \ + case IS_LONG: \ + break; \ + default: \ + Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \ + Z_TYPE(holder) = IS_LONG; \ break; \ } \ (op) = &(holder); \ @@ -188,34 +188,34 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) } \ case IS_UNICODE: \ { \ - switch (((holder).type=is_numeric_unicode((op)->value.ustr.val, (op)->value.ustr.len, &(holder).value.lval, &(holder).value.dval, 1))) { \ + switch ((Z_TYPE(holder)=is_numeric_unicode(Z_USTRVAL_P(op), Z_USTRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1))) { \ case IS_DOUBLE: \ case IS_LONG: \ break; \ default: \ - (holder).value.lval = zend_u_strtol((op)->value.ustr.val, NULL, 10); \ - (holder).type = IS_LONG; \ + Z_LVAL(holder) = zend_u_strtol(Z_USTRVAL_P(op), NULL, 10); \ + Z_TYPE(holder) = IS_LONG; \ break; \ } \ (op) = &(holder); \ - break; \ - } \ + break; \ + } \ case IS_BOOL: \ case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ - (holder).type = IS_LONG; \ + Z_LVAL(holder) = Z_LVAL_P(op); \ + Z_TYPE(holder) = IS_LONG; \ (op) = &(holder); \ break; \ case IS_NULL: \ - (holder).value.lval = 0; \ - (holder).type = IS_LONG; \ + Z_LVAL(holder) = 0; \ + Z_TYPE(holder) = IS_LONG; \ (op) = &(holder); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ zval_copy_ctor(&(holder)); \ convert_to_long_base(&(holder), 10); \ - if ((holder).type == IS_LONG) { \ + if (Z_TYPE(holder) == IS_LONG) { \ (op) = &(holder); \ } \ break; \ @@ -228,22 +228,22 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) #define zendi_convert_to_long(op, holder, result) \ if (op == result) { \ convert_to_long(op); \ - } else if ((op)->type != IS_LONG) { \ - switch ((op)->type) { \ + } else if (Z_TYPE_P(op) != IS_LONG) { \ + switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ case IS_DOUBLE: \ - DVAL_TO_LVAL((op)->value.dval, (holder).value.lval); \ + DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL(holder)); \ break; \ case IS_STRING: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ + Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \ break; \ case IS_UNICODE: \ - (holder).value.lval = zend_u_strtol((op)->value.ustr.val, NULL, 10); \ + Z_LVAL(holder) = zend_u_strtol(Z_USTRVAL_P(op), NULL, 10); \ break; \ case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ + Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ @@ -252,14 +252,14 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) break; \ case IS_BOOL: \ case IS_RESOURCE: \ - (holder).value.lval = (op)->value.lval; \ + Z_LVAL(holder) = Z_LVAL_P(op); \ break; \ default: \ - zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - (holder).value.lval = 0; \ + zend_error(E_WARNING, "Cannot convert to ordinal value"); \ + Z_LVAL(holder) = 0; \ break; \ } \ - (holder).type = IS_LONG; \ + Z_TYPE(holder) = IS_LONG; \ (op) = &(holder); \ } @@ -267,37 +267,37 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) #define zendi_convert_to_boolean(op, holder, result) \ if (op==result) { \ convert_to_boolean(op); \ - } else if ((op)->type != IS_BOOL) { \ - switch ((op)->type) { \ + } else if (Z_TYPE_P(op) != IS_BOOL) { \ + switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ case IS_RESOURCE: \ case IS_LONG: \ - (holder).value.lval = ((op)->value.lval ? 1 : 0); \ + Z_LVAL(holder) = (Z_LVAL_P(op) ? 1 : 0); \ break; \ case IS_DOUBLE: \ - (holder).value.lval = ((op)->value.dval ? 1 : 0); \ + Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ - if ((op)->value.str.len == 0 \ - || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \ - (holder).value.lval = 0; \ + if (Z_STRLEN_P(op) == 0 \ + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ + Z_LVAL(holder) = 0; \ } else { \ - (holder).value.lval = 1; \ + Z_LVAL(holder) = 1; \ } \ break; \ case IS_UNICODE: \ - if ((op)->value.ustr.len == 0 \ - || ((op)->value.ustr.len==1 && \ - ((op)->value.ustr.val[0]=='0'))) { \ - (holder).value.lval = 0; \ + if (Z_USTRLEN_P(op) == 0 \ + || (Z_USTRLEN_P(op)==1 && \ + (Z_USTRVAL_P(op)[0]=='0'))) { \ + Z_LVAL(holder) = 0; \ } else { \ - (holder).value.lval = 1; \ + Z_LVAL(holder) = 1; \ } \ break; \ case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ + Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ (holder) = (*(op)); \ @@ -305,10 +305,10 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) convert_to_boolean(&(holder)); \ break; \ default: \ - (holder).value.lval = 0; \ + Z_LVAL(holder) = 0; \ break; \ } \ - (holder).type = IS_BOOL; \ + Z_TYPE(holder) = IS_BOOL; \ (op) = &(holder); \ } @@ -321,7 +321,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(op)->name); \ } else { \ zval_dtor(op); \ - op->type = ctype; \ + Z_TYPE_P(op) = ctype; \ op->value = dst.value; \ } \ } else { \ @@ -348,40 +348,40 @@ ZEND_API void convert_to_long_base(zval *op, int base) { long tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_BOOL: case IS_LONG: break; case IS_DOUBLE: - DVAL_TO_LVAL(op->value.dval, op->value.lval); + DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL_P(op)); break; case IS_STRING: { - char *strval = op->value.str.val; - op->value.lval = strtol(strval, NULL, base); + char *strval = Z_STRVAL_P(op); + Z_LVAL_P(op) = strtol(strval, NULL, base); STR_FREE(strval); } break; case IS_UNICODE: { - UChar *strval = op->value.ustr.val; - op->value.lval = zend_u_strtol(strval, NULL, base); + UChar *strval = Z_USTRVAL_P(op); + Z_LVAL_P(op) = zend_u_strtol(strval, NULL, base); USTR_FREE(strval); } break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.lval = tmp; + Z_LVAL_P(op) = tmp; break; case IS_OBJECT: { @@ -390,7 +390,7 @@ ZEND_API void convert_to_long_base(zval *op, int base) convert_object_to_type(op, IS_LONG, convert_to_long); - if (op->type == IS_LONG) { + if (Z_TYPE_P(op) == IS_LONG) { return; } @@ -409,11 +409,11 @@ ZEND_API void convert_to_long_base(zval *op, int base) default: zend_error(E_WARNING, "Cannot convert to ordinal value"); zval_dtor(op); - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; } - op->type = IS_LONG; + Z_TYPE_P(op) = IS_LONG; } @@ -421,42 +421,42 @@ ZEND_API void convert_to_double(zval *op) { double tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.dval = 0.0; + Z_DVAL_P(op) = 0.0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_BOOL: case IS_LONG: - op->value.dval = (double) op->value.lval; + Z_DVAL_P(op) = (double) Z_LVAL_P(op); break; case IS_DOUBLE: break; case IS_STRING: { - char *strval = op->value.str.val; + char *strval = Z_STRVAL_P(op); - op->value.dval = zend_strtod(strval, NULL); + Z_DVAL_P(op) = zend_strtod(strval, NULL); STR_FREE(strval); } break; case IS_UNICODE: { - UChar *strval = op->value.ustr.val; + UChar *strval = Z_USTRVAL_P(op); - op->value.dval = zend_u_strtod(strval, NULL); + Z_DVAL_P(op) = zend_u_strtod(strval, NULL); USTR_FREE(strval); } break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.dval = tmp; + Z_DVAL_P(op) = tmp; break; case IS_OBJECT: { @@ -465,7 +465,7 @@ ZEND_API void convert_to_double(zval *op) convert_object_to_type(op, IS_DOUBLE, convert_to_double); - if (op->type == IS_DOUBLE) { + if (Z_TYPE_P(op) == IS_DOUBLE) { return; } @@ -483,18 +483,18 @@ ZEND_API void convert_to_double(zval *op) break; } default: - zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type); + zend_error(E_WARNING, "Cannot convert to real value (type=%d)", Z_TYPE_P(op)); zval_dtor(op); - op->value.dval = 0; + Z_DVAL_P(op) = 0; break; } - op->type = IS_DOUBLE; + Z_TYPE_P(op) = IS_DOUBLE; } ZEND_API void convert_to_null(zval *op) { - if (op->type == IS_OBJECT) { + if (Z_TYPE_P(op) == IS_OBJECT) { if (Z_OBJ_HT_P(op)->cast_object) { zval *org; TSRMLS_FETCH(); @@ -510,7 +510,7 @@ ZEND_API void convert_to_null(zval *op) } zval_dtor(op); - op->type = IS_NULL; + Z_TYPE_P(op) = IS_NULL; } @@ -518,55 +518,55 @@ ZEND_API void convert_to_boolean(zval *op) { int tmp; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_BOOL: break; case IS_NULL: - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_delete(op->value.lval); + zend_list_delete(Z_LVAL_P(op)); } /* break missing intentionally */ case IS_LONG: - op->value.lval = (op->value.lval ? 1 : 0); + Z_LVAL_P(op) = (Z_LVAL_P(op) ? 1 : 0); break; case IS_DOUBLE: - op->value.lval = (op->value.dval ? 1 : 0); + Z_LVAL_P(op) = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: { - char *strval = op->value.str.val; + char *strval = Z_STRVAL_P(op); - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - op->value.lval = 0; + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + Z_LVAL_P(op) = 0; } else { - op->value.lval = 1; + Z_LVAL_P(op) = 1; } STR_FREE(strval); } break; case IS_UNICODE: { - UChar *strval = op->value.ustr.val; + UChar *strval = Z_USTRVAL_P(op); - if (op->value.ustr.len == 0 - || (op->value.ustr.len==1 && - (op->value.ustr.val[0]=='0'))) { - op->value.lval = 0; + if (Z_USTRVAL_P(op) == 0 + || (Z_USTRLEN_P(op)==1 && + (Z_USTRVAL_P(op)[0]=='0'))) { + Z_LVAL_P(op) = 0; } else { - op->value.lval = 1; + Z_LVAL_P(op) = 1; } USTR_FREE(strval); } break; case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); + tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - op->value.lval = tmp; + Z_LVAL_P(op) = tmp; break; case IS_OBJECT: { @@ -575,7 +575,7 @@ ZEND_API void convert_to_boolean(zval *op) convert_object_to_type(op, IS_BOOL, convert_to_boolean); - if (op->type == IS_BOOL) { + if (Z_TYPE_P(op) == IS_BOOL) { return; } @@ -592,18 +592,18 @@ ZEND_API void convert_to_boolean(zval *op) } default: zval_dtor(op); - op->value.lval = 0; + Z_LVAL_P(op) = 0; break; } - op->type = IS_BOOL; + Z_TYPE_P(op) = IS_BOOL; } ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) { - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.ustr.val = USTR_MAKE_REL(""); - op->value.ustr.len = 0; + Z_USTRVAL_P(op) = USTR_MAKE_REL(""); + Z_USTRLEN_P(op) = 0; break; case IS_UNICODE: break; @@ -611,60 +611,60 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) zend_error(E_ERROR, "Cannot convert binary type to Unicode type"); return; case IS_BOOL: - if (op->value.lval) { - op->value.ustr.val = USTR_MAKE_REL("1"); - op->value.ustr.len = 1; + if (Z_LVAL_P(op)) { + Z_USTRVAL_P(op) = USTR_MAKE_REL("1"); + Z_USTRLEN_P(op) = 1; } else { - op->value.ustr.val = USTR_MAKE_REL(""); - op->value.ustr.len = 0; + Z_USTRVAL_P(op) = USTR_MAKE_REL(""); + Z_USTRLEN_P(op) = 0; } break; case IS_RESOURCE: { - long tmp = op->value.lval; + long tmp = Z_LVAL_P(op); TSRMLS_FETCH(); - zend_list_delete(op->value.lval); - op->value.ustr.val = eumalloc_rel(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG + 1); - op->value.ustr.len = u_sprintf(op->value.ustr.val, "Resource id #%ld", tmp); + zend_list_delete(Z_LVAL_P(op)); + Z_USTRVAL_P(op) = eumalloc_rel(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG + 1); + Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "Resource id #%ld", tmp); break; } case IS_LONG: { int32_t capacity = MAX_LENGTH_OF_LONG + 1; - long lval = op->value.lval; + long lval = Z_LVAL_P(op); - op->value.ustr.val = eumalloc_rel(capacity); - op->value.ustr.len = u_sprintf(op->value.ustr.val, "%ld", lval); + Z_USTRVAL_P(op) = eumalloc_rel(capacity); + Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%ld", lval); break; } case IS_DOUBLE: { int32_t capacity; - double dval = op->value.dval; + double dval = Z_DVAL_P(op); TSRMLS_FETCH(); capacity = MAX_LENGTH_OF_DOUBLE + EG(precision) + 1; - op->value.ustr.val = eumalloc_rel(capacity); - op->value.ustr.len = u_sprintf(op->value.ustr.val, "%.*G", (int) EG(precision), dval); + Z_USTRVAL_P(op) = eumalloc_rel(capacity); + Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%.*G", (int) EG(precision), dval); break; } case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); - op->value.ustr.val = USTR_MAKE_REL("Array"); - op->value.ustr.len = sizeof("Array")-1; + Z_USTRVAL_P(op) = USTR_MAKE_REL("Array"); + Z_USTRLEN_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { TSRMLS_FETCH(); convert_object_to_type(op, IS_UNICODE, convert_to_unicode); - if (op->type == IS_UNICODE) { + if (Z_TYPE_P(op) == IS_UNICODE) { return; } zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); zval_dtor(op); - op->value.ustr.val = USTR_MAKE_REL("Object"); - op->value.ustr.len = sizeof("Object")-1; + Z_USTRVAL_P(op) = USTR_MAKE_REL("Object"); + Z_USTRLEN_P(op) = sizeof("Object")-1; break; } default: @@ -672,7 +672,7 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) ZVAL_BOOL(op, 0); break; } - op->type = IS_UNICODE; + Z_TYPE_P(op) = IS_UNICODE; } @@ -687,10 +687,10 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML long lval; double dval; - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_NULL: - op->value.str.val = STR_EMPTY_ALLOC(); - op->value.str.len = 0; + Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); + Z_STRLEN_P(op) = 0; break; case IS_STRING: return; @@ -698,56 +698,56 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML zval_unicode_to_string(op, conv TSRMLS_CC); break; case IS_BOOL: - if (op->value.lval) { - op->value.str.val = estrndup_rel("1", 1); - op->value.str.len = 1; + if (Z_LVAL_P(op)) { + Z_STRVAL_P(op) = estrndup_rel("1", 1); + Z_STRLEN_P(op) = 1; } else { - op->value.str.val = STR_EMPTY_ALLOC(); - op->value.str.len = 0; + Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); + Z_STRLEN_P(op) = 0; } break; case IS_RESOURCE: { - long tmp = op->value.lval; + long tmp = Z_LVAL_P(op); TSRMLS_FETCH(); - zend_list_delete(op->value.lval); - op->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); - op->value.str.len = sprintf(op->value.str.val, "Resource id #%ld", tmp); + zend_list_delete(Z_LVAL_P(op)); + Z_STRVAL_P(op) = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); + Z_STRLEN_P(op) = sprintf(Z_STRVAL_P(op), "Resource id #%ld", tmp); break; } case IS_LONG: - lval = op->value.lval; + lval = Z_LVAL_P(op); - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */ + Z_STRVAL_P(op) = (char *) emalloc_rel(MAX_LENGTH_OF_LONG + 1); + Z_STRLEN_P(op) = zend_sprintf(Z_STRVAL_P(op), "%ld", lval); /* SAFE */ break; case IS_DOUBLE: { TSRMLS_FETCH(); - dval = op->value.dval; - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */ + dval = Z_DVAL_P(op); + Z_STRVAL_P(op) = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); + Z_STRLEN_P(op) = zend_sprintf(Z_STRVAL_P(op), "%.*G", (int) EG(precision), dval); /* SAFE */ /* %G already handles removing trailing zeros from the fractional part, yay */ break; } case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); - op->value.str.val = estrndup_rel("Array", sizeof("Array")-1); - op->value.str.len = sizeof("Array")-1; + Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); + Z_STRLEN_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { TSRMLS_FETCH(); convert_object_to_type(op, IS_STRING, convert_to_string); - if (op->type == IS_STRING) { + if (Z_TYPE_P(op) == IS_STRING) { return; } zend_error(E_NOTICE, "Object of class %v to string conversion", Z_OBJCE_P(op)->name); zval_dtor(op); - op->value.str.val = estrndup_rel("Object", sizeof("Object")-1); - op->value.str.len = sizeof("Object")-1; + Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); + Z_STRLEN_P(op) = sizeof("Object")-1; break; } default: @@ -755,7 +755,7 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML ZVAL_BOOL(op, 0); break; } - op->type = IS_STRING; + Z_TYPE_P(op) = IS_STRING; } @@ -769,10 +769,10 @@ static void convert_scalar_to_array(zval *op, int type TSRMLS_DC) switch (type) { case IS_ARRAY: - ALLOC_HASHTABLE(op->value.ht); - zend_u_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); - zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL); - op->type = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_P(op)); + zend_u_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); + zend_hash_index_update(Z_ARRVAL_P(op), 0, (void *) &entry, sizeof(zval *), NULL); + Z_TYPE_P(op) = IS_ARRAY; break; case IS_OBJECT: { @@ -791,7 +791,7 @@ ZEND_API void convert_to_array(zval *op) { TSRMLS_FETCH(); - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_ARRAY: return; break; @@ -811,19 +811,19 @@ ZEND_API void convert_to_array(zval *op) } else { convert_object_to_type(op, IS_ARRAY, convert_to_array); - if (op->type == IS_ARRAY) { + if (Z_TYPE_P(op) == IS_ARRAY) { return; } } zval_dtor(op); - op->type = IS_ARRAY; - op->value.ht = ht; + Z_TYPE_P(op) = IS_ARRAY; + Z_ARRVAL_P(op) = ht; } return; case IS_NULL: - ALLOC_HASHTABLE(op->value.ht); - zend_u_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); - op->type = IS_ARRAY; + ALLOC_HASHTABLE(Z_ARRVAL_P(op)); + zend_u_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); + Z_TYPE_P(op) = IS_ARRAY; break; default: convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC); @@ -835,10 +835,10 @@ ZEND_API void convert_to_array(zval *op) ZEND_API void convert_to_object(zval *op) { TSRMLS_FETCH(); - switch (op->type) { + switch (Z_TYPE_P(op)) { case IS_ARRAY: { - object_and_properties_init(op, zend_standard_class_def, op->value.ht); + object_and_properties_init(op, zend_standard_class_def, Z_ARRVAL_P(op)); return; break; } @@ -907,7 +907,7 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) { + if (Z_TYPE_P(op1) == IS_ARRAY && Z_TYPE_P(op2) == IS_ARRAY) { zval *tmp; if ((result == op1) && (result == op2)) { @@ -918,39 +918,39 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) *result = *op1; zval_copy_ctor(result); } - zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); + zend_hash_merge(Z_ARRVAL_P(result), Z_ARRVAL_P(op2), (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); return SUCCESS; } zendi_convert_scalar_to_number(op1, op1_copy, result); zendi_convert_scalar_to_number(op2, op2_copy, result); - if (op1->type == IS_LONG && op2->type == IS_LONG) { - long lval = op1->value.lval + op2->value.lval; + if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { + long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); /* check for overflow by comparing sign bits */ - if ( (op1->value.lval & LONG_SIGN_MASK) == (op2->value.lval & LONG_SIGN_MASK) - && (op1->value.lval & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + if ( (Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { - result->value.dval = (double) op1->value.lval + (double) op2->value.lval; - result->type = IS_DOUBLE; + Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2); + Z_TYPE_P(result) = IS_DOUBLE; } else { - result->value.lval = lval; - result->type = IS_LONG; + Z_LVAL_P(result) = lval; + Z_TYPE_P(result) = IS_LONG; } return SUCCESS; } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) + op2->value.dval) : - (op1->value.dval + ((double) op2->value.lval))); - result->type = IS_DOUBLE; + if ((Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_LONG) + || (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_DOUBLE)) { + Z_DVAL_P(result) = (Z_TYPE_P(op1) == IS_LONG ? + (((double) Z_LVAL_P(op1)) + Z_DVAL_P(op2)) : + (Z_DVAL_P(op1) + ((double) Z_LVAL_P(op2)))); + Z_TYPE_P(result) = IS_DOUBLE; return SUCCESS; } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval + op2->value.dval; + if (Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_DOUBLE; + Z_DVAL_P(result) = Z_DVAL_P(op1) + Z_DVAL_P(op2); return SUCCESS; } zend_error(E_ERROR, "Unsupported operand types"); @@ -965,32 +965,32 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_scalar_to_number(op1, op1_copy, result); zendi_convert_scalar_to_number(op2, op2_copy, result); - if (op1->type == IS_LONG && op2->type == IS_LONG) { - long lval = op1->value.lval - op2->value.lval; + if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { + long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); /* check for overflow by comparing sign bits */ - if ( (op1->value.lval & LONG_SIGN_MASK) != (op2->value.lval & LONG_SIGN_MASK) - && (op1->value.lval & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + if ( (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { - result->value.dval = (double) op1->value.lval - (double) op2->value.lval; - result->type = IS_DOUBLE; + Z_DVAL_P(result) = (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2); + Z_TYPE_P(result) = IS_DOUBLE; } else { - result->value.lval = lval; - result->type = IS_LONG; + Z_LVAL_P(result) = lval; + Z_TYPE_P(result) = IS_LONG; } return SUCCESS; } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) - op2->value.dval) : - (op1->value.dval - ((double) op2->value.lval))); - result->type = IS_DOUBLE; + if ((Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_LONG) + || (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_DOUBLE)) { + Z_DVAL_P(result) = (Z_TYPE_P(op1) == IS_LONG ? + (((double) Z_LVAL_P(op1)) - Z_DVAL_P(op2)) : + (Z_DVAL_P(op1) - ((double) Z_LVAL_P(op2)))); + Z_TYPE_P(result) = IS_DOUBLE; return SUCCESS; } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval - op2->value.dval; + if (Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_DOUBLE; + Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); return SUCCESS; } zend_error(E_ERROR, "Unsupported operand types"); @@ -1005,24 +1005,24 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_scalar_to_number(op1, op1_copy, result); zendi_convert_scalar_to_number(op2, op2_copy, result); - if (op1->type == IS_LONG && op2->type == IS_LONG) { + if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { long overflow; - ZEND_SIGNED_MULTIPLY_LONG(op1->value.lval,op2->value.lval, result->value.lval,result->value.dval,overflow); - result->type = overflow ? IS_DOUBLE : IS_LONG; + ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result),overflow); + Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; return SUCCESS; } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) * op2->value.dval) : - (op1->value.dval * ((double) op2->value.lval))); - result->type = IS_DOUBLE; + if ((Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_LONG) + || (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_DOUBLE)) { + Z_DVAL_P(result) = (Z_TYPE_P(op1) == IS_LONG ? + (((double) Z_LVAL_P(op1)) * Z_DVAL_P(op2)) : + (Z_DVAL_P(op1) * ((double) Z_LVAL_P(op2)))); + Z_TYPE_P(result) = IS_DOUBLE; return SUCCESS; } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval * op2->value.dval; + if (Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_DOUBLE; + Z_DVAL_P(result) = Z_DVAL_P(op1) * Z_DVAL_P(op2); return SUCCESS; } zend_error(E_ERROR, "Unsupported operand types"); @@ -1036,32 +1036,32 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_scalar_to_number(op1, op1_copy, result); zendi_convert_scalar_to_number(op2, op2_copy, result); - if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) { + if ((Z_TYPE_P(op2) == IS_LONG && Z_LVAL_P(op2) == 0) || (Z_TYPE_P(op2) == IS_DOUBLE && Z_DVAL_P(op2) == 0.0)) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ } - if (op1->type == IS_LONG && op2->type == IS_LONG) { - if (op1->value.lval % op2->value.lval == 0) { /* integer */ - result->type = IS_LONG; - result->value.lval = op1->value.lval / op2->value.lval; + if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { + if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) / Z_LVAL_P(op2); } else { - result->type = IS_DOUBLE; - result->value.dval = ((double) op1->value.lval) / op2->value.lval; + Z_TYPE_P(result) = IS_DOUBLE; + Z_DVAL_P(result) = ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2); } return SUCCESS; } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) / op2->value.dval) : - (op1->value.dval / ((double) op2->value.lval))); - result->type = IS_DOUBLE; + if ((Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_LONG) + || (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_DOUBLE)) { + Z_DVAL_P(result) = (Z_TYPE_P(op1) == IS_LONG ? + (((double) Z_LVAL_P(op1)) / Z_DVAL_P(op2)) : + (Z_DVAL_P(op1) / ((double) Z_LVAL_P(op2)))); + Z_TYPE_P(result) = IS_DOUBLE; return SUCCESS; } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval / op2->value.dval; + if (Z_TYPE_P(op1) == IS_DOUBLE && Z_TYPE_P(op2) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_DOUBLE; + Z_DVAL_P(result) = Z_DVAL_P(op1) / Z_DVAL_P(op2); return SUCCESS; } zend_error(E_ERROR, "Unsupported operand types"); @@ -1076,18 +1076,18 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - if (op2->value.lval == 0) { + if (Z_LVAL_P(op2) == 0) { ZVAL_BOOL(result, 0); return FAILURE; /* modulus by zero */ } - if (abs(op2->value.lval) == 1) { + if (abs(Z_LVAL_P(op2)) == 1) { ZVAL_LONG(result, 0); return SUCCESS; } - result->type = IS_LONG; - result->value.lval = op1->value.lval % op2->value.lval; + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2); return SUCCESS; } @@ -1097,11 +1097,11 @@ ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - result->type = IS_BOOL; + Z_TYPE_P(result) = IS_BOOL; zendi_convert_to_boolean(op1, op1_copy, result); zendi_convert_to_boolean(op2, op2_copy, result); - result->value.lval = op1->value.lval ^ op2->value.lval; + Z_LVAL_P(result) = Z_LVAL_P(op1) ^ Z_LVAL_P(op2); return SUCCESS; } @@ -1112,8 +1112,8 @@ ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) zendi_convert_to_boolean(op1, op1_copy, result); - result->type = IS_BOOL; - result->value.lval = !op1->value.lval; + Z_TYPE_P(result) = IS_BOOL; + Z_LVAL_P(result) = !Z_LVAL_P(op1); return SUCCESS; } @@ -1124,23 +1124,23 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) op1 = &op1_copy; - if (op1->type == IS_DOUBLE) { - op1->value.lval = (long) op1->value.dval; - op1->type = IS_LONG; + if (Z_TYPE_P(op1) == IS_DOUBLE) { + Z_LVAL_P(op1) = (long) Z_DVAL_P(op1); + Z_TYPE_P(op1) = IS_LONG; } - if (op1->type == IS_LONG) { - result->value.lval = ~op1->value.lval; - result->type = IS_LONG; + if (Z_TYPE_P(op1) == IS_LONG) { + Z_LVAL_P(result) = ~Z_LVAL_P(op1); + Z_TYPE_P(result) = IS_LONG; return SUCCESS; } - if (op1->type == IS_STRING) { + if (Z_TYPE_P(op1) == IS_STRING) { int i; - result->type = op1->type; - result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len); - result->value.str.len = op1->value.str.len; - for (i = 0; i < op1->value.str.len; i++) { - result->value.str.val[i] = ~op1->value.str.val[i]; + Z_TYPE_P(result) = Z_TYPE_P(op1); + Z_STRVAL_P(result) = estrndup(Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + Z_STRLEN_P(result) = Z_STRLEN_P(op1); + for (i = 0; i < Z_STRLEN_P(op1); i++) { + Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; } return SUCCESS; } @@ -1153,12 +1153,12 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_STRING && op2->type == IS_STRING) { + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1166,28 +1166,28 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = op1->type; - result_len = longer->value.str.len; - result_str = estrndup(longer->value.str.val, longer->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] |= shorter->value.str.val[i]; + Z_TYPE_P(result) = Z_TYPE_P(op1); + result_len = Z_STRLEN_P(longer); + result_str = estrndup(Z_STRVAL_P(longer), Z_STRLEN_P(longer)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] |= Z_STRVAL_P(shorter)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval | op2->value.lval; + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) | Z_LVAL_P(op2); return SUCCESS; } @@ -1196,12 +1196,12 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_STRING && op2->type == IS_STRING) { + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1209,21 +1209,21 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = op1->type; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] &= longer->value.str.val[i]; + Z_TYPE_P(result) = Z_TYPE_P(op1); + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] &= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } @@ -1231,8 +1231,8 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval & op2->value.lval; + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) & Z_LVAL_P(op2); return SUCCESS; } @@ -1241,12 +1241,12 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_STRING && op2->type == IS_STRING) { + if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; int i, result_len; - if (op1->value.str.len >= op2->value.str.len) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1254,21 +1254,21 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - result->type = op1->type; - result_len = shorter->value.str.len; - result_str = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result_str[i] ^= longer->value.str.val[i]; + Z_TYPE_P(result) = Z_TYPE_P(op1); + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_str[i] ^= Z_STRVAL_P(longer)[i]; } if (result==op1) { - STR_FREE(result->value.str.val); + STR_FREE(Z_STRVAL_P(result)); } - result->value.str.val = result_str; - result->value.str.len = result_len; + Z_STRVAL_P(result) = result_str; + Z_STRLEN_P(result) = result_len; return SUCCESS; } - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } @@ -1276,8 +1276,8 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval ^ op2->value.lval; + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) ^ Z_LVAL_P(op2); return SUCCESS; } @@ -1286,15 +1286,15 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval << op2->value.lval; - result->type = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) << Z_LVAL_P(op2); + Z_TYPE_P(result) = IS_LONG; return SUCCESS; } @@ -1303,15 +1303,15 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_error(E_ERROR, "Unsupported operand types"); return FAILURE; } zendi_convert_to_long(op1, op1_copy, result); zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval >> op2->value.lval; - result->type = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1) >> Z_LVAL_P(op2); + Z_TYPE_P(result) = IS_LONG; return SUCCESS; } @@ -1319,27 +1319,27 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* must support result==op1 */ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) { - if (op1->type == IS_UNICODE) { - UChar32 codepoint = (UChar32) op2->value.lval; + if (Z_TYPE_P(op1) == IS_UNICODE) { + UChar32 codepoint = (UChar32) Z_LVAL_P(op2); if (U_IS_BMP(codepoint)) { - result->value.ustr.len = op1->value.ustr.len + 1; - result->value.ustr.val = eurealloc(op1->value.ustr.val, result->value.ustr.len+1); - result->value.ustr.val[result->value.ustr.len - 1] = (UChar) op2->value.lval; + Z_USTRLEN_P(result) = Z_USTRLEN_P(op1) + 1; + Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(op1), Z_USTRLEN_P(result)+1); + Z_USTRVAL_P(result)[Z_USTRLEN_P(result) - 1] = (UChar) Z_LVAL_P(op2); } else { - result->value.ustr.len = op1->value.ustr.len + 2; - result->value.ustr.val = eurealloc(op1->value.ustr.val, result->value.ustr.len+1); - result->value.ustr.val[result->value.ustr.len - 2] = (UChar) U16_LEAD(codepoint); - result->value.ustr.val[result->value.ustr.len - 1] = (UChar) U16_TRAIL(codepoint); + Z_USTRLEN_P(result) = Z_USTRLEN_P(op1) + 2; + Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(op1), Z_USTRLEN_P(result)+1); + Z_USTRVAL_P(result)[Z_USTRLEN_P(result) - 2] = (UChar) U16_LEAD(codepoint); + Z_USTRVAL_P(result)[Z_USTRLEN_P(result) - 1] = (UChar) U16_TRAIL(codepoint); } - result->value.ustr.val[result->value.ustr.len] = 0; - result->type = IS_UNICODE; + Z_USTRVAL_P(result)[Z_USTRLEN_P(result)] = 0; + Z_TYPE_P(result) = IS_UNICODE; } else { - result->value.str.len = op1->value.str.len + 1; - result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1); - result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval; - result->value.str.val[result->value.str.len] = 0; - result->type = op1->type; + Z_STRLEN_P(result) = Z_STRLEN_P(op1) + 1; + Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), Z_STRLEN_P(result)+1); + Z_STRVAL_P(result)[Z_STRLEN_P(result) - 1] = (char) Z_LVAL_P(op2); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_TYPE_P(result) = Z_TYPE_P(op1); } return SUCCESS; } @@ -1348,24 +1348,24 @@ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) /* must support result==op1 */ ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) { - assert(op1->type == op2->type); + assert(Z_TYPE_P(op1) == Z_TYPE_P(op2)); - if (op1->type == IS_UNICODE) { - int32_t length = op1->value.ustr.len + op2->value.ustr.len; + if (Z_TYPE_P(op1) == IS_UNICODE) { + int32_t length = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2); - result->value.ustr.val = eurealloc(op1->value.ustr.val, length+1); - u_memcpy(result->value.ustr.val+op1->value.ustr.len, op2->value.ustr.val, op2->value.ustr.len); - result->value.ustr.val[length] = 0; - result->value.ustr.len = length; - result->type = IS_UNICODE; + Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(op1), length+1); + u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); + Z_USTRVAL_P(result)[length] = 0; + Z_USTRLEN_P(result) = length; + Z_TYPE_P(result) = IS_UNICODE; } else { - int length = op1->value.str.len + op2->value.str.len; + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); - result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[length] = 0; - result->value.str.len = length; - result->type = op1->type; + Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), length+1); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[length] = 0; + Z_STRLEN_P(result) = length; + Z_TYPE_P(result) = Z_TYPE_P(op1); } return SUCCESS; } @@ -1377,7 +1377,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) int use_copy1, use_copy2; zend_uchar result_type; - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zend_make_unicode_zval(op1, &op1_copy, &use_copy1); zend_make_unicode_zval(op2, &op2_copy, &use_copy2); result_type = IS_UNICODE; @@ -1403,19 +1403,19 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) add_string_to_string(result, op1, op2); } else { if (result_type == IS_UNICODE) { - result->value.ustr.len = op1->value.ustr.len + op2->value.ustr.len; - result->value.ustr.val = eumalloc(result->value.ustr.len + 1); - u_memcpy(result->value.ustr.val, op1->value.ustr.val, op1->value.ustr.len); - u_memcpy(result->value.ustr.val+op1->value.ustr.len, op2->value.ustr.val, op2->value.ustr.len); - result->value.ustr.val[result->value.ustr.len] = 0; - result->type = IS_UNICODE; + Z_USTRLEN_P(result) = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2); + Z_USTRVAL_P(result) = eumalloc(Z_USTRLEN_P(result) + 1); + u_memcpy(Z_USTRVAL_P(result), Z_USTRVAL_P(op1), Z_USTRLEN_P(op1)); + u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); + Z_USTRVAL_P(result)[Z_USTRLEN_P(result)] = 0; + Z_TYPE_P(result) = IS_UNICODE; } else { - result->value.str.len = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) emalloc(result->value.str.len + 1); - memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = result_type; + Z_STRLEN_P(result) = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + Z_STRVAL_P(result) = (char *) emalloc(Z_STRLEN_P(result) + 1); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_TYPE_P(result) = result_type; } } if (use_copy1) { @@ -1443,8 +1443,8 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D op2 = &op2_copy; } - result->value.lval = zend_binary_zval_strcmp(op1, op2); - result->type = IS_LONG; + Z_LVAL_P(result) = zend_binary_zval_strcmp(op1, op2); + Z_TYPE_P(result) = IS_LONG; if (use_copy1) { zval_dtor(op1); @@ -1459,8 +1459,6 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T { zval op1_copy, op2_copy; int use_copy1, use_copy2; - UErrorCode status = U_ZERO_ERROR; - UCollator *col; zend_make_unicode_zval(op1, &op1_copy, &use_copy1); zend_make_unicode_zval(op2, &op2_copy, &use_copy2); @@ -1472,8 +1470,8 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T op2 = &op2_copy; } - result->value.lval = ucol_strcoll(UG(default_collator), op1->value.ustr.val, op1->value.ustr.len, op2->value.ustr.val, op2->value.ustr.len); - result->type = IS_LONG; + Z_LVAL_P(result) = ucol_strcoll(UG(default_collator), Z_USTRVAL_P(op1), Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); + Z_TYPE_P(result) = IS_LONG; if (use_copy1) { zval_dtor(op1); @@ -1498,8 +1496,8 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_ convert_to_double(&op1_copy); convert_to_double(&op2_copy); - result->value.lval = ZEND_NORMALIZE_BOOL(op1_copy.value.dval-op2_copy.value.dval); - result->type = IS_LONG; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_DVAL(op1_copy)-Z_DVAL(op2_copy)); + Z_TYPE_P(result) = IS_LONG; return SUCCESS; } @@ -1526,8 +1524,8 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { zval op1_copy, op2_copy; zval *op1_free, *op2_free; - int op1_obj = op1->type == IS_OBJECT; - int op2_obj = op2->type == IS_OBJECT; + int op1_obj = Z_TYPE_P(op1) == IS_OBJECT; + int op2_obj = Z_TYPE_P(op2) == IS_OBJECT; if (op1_obj) { if (Z_OBJ_HT_P(op1)->get) { @@ -1563,44 +1561,44 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) op2_free = NULL; } - if ((op1->type == IS_NULL && op2->type == IS_STRING) - || (op2->type == IS_NULL && op1->type == IS_STRING)) { - if (op1->type == IS_NULL) { - result->type = IS_LONG; - result->value.lval = zend_binary_strcmp("", 0, op2->value.str.val, op2->value.str.len); + if ((Z_TYPE_P(op1) == IS_NULL && Z_TYPE_P(op2) == IS_STRING) + || (Z_TYPE_P(op2) == IS_NULL && Z_TYPE_P(op1) == IS_STRING)) { + if (Z_TYPE_P(op1) == IS_NULL) { + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRLEN_P(op2)); COMPARE_RETURN_AND_FREE(SUCCESS); } else { - result->type = IS_LONG; - result->value.lval = zend_binary_strcmp(op1->value.str.val, op1->value.str.len, "", 0); + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0); COMPARE_RETURN_AND_FREE(SUCCESS); } } - if ((op1->type == IS_UNICODE || op1->type == IS_STRING) && - (op2->type == IS_UNICODE || op2->type == IS_STRING)) { + if ((Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op1) == IS_STRING) && + (Z_TYPE_P(op2) == IS_UNICODE || Z_TYPE_P(op2) == IS_STRING)) { - if (op1->type == IS_UNICODE || op2->type == IS_UNICODE) { + if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE) { zendi_u_smart_strcmp(result, op1, op2); - } else if (op1->type == IS_STRING || op2->type == IS_STRING) { + } else if (Z_TYPE_P(op1) == IS_STRING || Z_TYPE_P(op2) == IS_STRING) { zendi_smart_strcmp(result, op1, op2); } else { - result->value.lval = zend_binary_zval_strcmp(op1, op2); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = zend_binary_zval_strcmp(op1, op2); + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op1->type == IS_BOOL || op2->type == IS_BOOL - || op1->type == IS_NULL || op2->type == IS_NULL) { + if (Z_TYPE_P(op1) == IS_BOOL || Z_TYPE_P(op2) == IS_BOOL + || Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op2) == IS_NULL) { zendi_convert_to_boolean(op1, op1_copy, result); zendi_convert_to_boolean(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = ZEND_NORMALIZE_BOOL(op1->value.lval-op2->value.lval); + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2)); COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op1->type==IS_OBJECT && op2->type==IS_OBJECT) { + if (Z_TYPE_P(op1)==IS_OBJECT && Z_TYPE_P(op2)==IS_OBJECT) { /* If the handlers array is not identical, fall through * and perform get() or cast() if implemented */ @@ -1613,41 +1611,41 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) zendi_convert_scalar_to_number(op1, op1_copy, result); zendi_convert_scalar_to_number(op2, op2_copy, result); - if (op1->type == IS_LONG && op2->type == IS_LONG) { - result->type = IS_LONG; - result->value.lval = op1->value.lval>op2->value.lval?1:(op1->value.lvalvalue.lval?-1:0); + if (Z_TYPE_P(op1) == IS_LONG && Z_TYPE_P(op2) == IS_LONG) { + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)type == IS_DOUBLE || op1->type == IS_LONG) - && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) { - result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; + if ((Z_TYPE_P(op1) == IS_DOUBLE || Z_TYPE_P(op1) == IS_LONG) + && (Z_TYPE_P(op2) == IS_DOUBLE || Z_TYPE_P(op2) == IS_LONG)) { + Z_DVAL_P(result) = (Z_TYPE_P(op1) == IS_LONG ? (double) Z_LVAL_P(op1) : Z_DVAL_P(op1)) - (Z_TYPE_P(op2) == IS_LONG ? (double) Z_LVAL_P(op2) : Z_DVAL_P(op2)); + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op1->type==IS_ARRAY && op2->type==IS_ARRAY) { + if (Z_TYPE_P(op1)==IS_ARRAY && Z_TYPE_P(op2)==IS_ARRAY) { zend_compare_arrays(result, op1, op2 TSRMLS_CC); COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op1->type==IS_ARRAY) { - result->value.lval = 1; - result->type = IS_LONG; + if (Z_TYPE_P(op1)==IS_ARRAY) { + Z_LVAL_P(result) = 1; + Z_TYPE_P(result) = IS_LONG; COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op2->type==IS_ARRAY) { - result->value.lval = -1; - result->type = IS_LONG; + if (Z_TYPE_P(op2)==IS_ARRAY) { + Z_LVAL_P(result) = -1; + Z_TYPE_P(result) = IS_LONG; COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op1->type==IS_OBJECT) { - result->value.lval = 1; - result->type = IS_LONG; + if (Z_TYPE_P(op1)==IS_OBJECT) { + Z_LVAL_P(result) = 1; + Z_TYPE_P(result) = IS_LONG; COMPARE_RETURN_AND_FREE(SUCCESS); } - if (op2->type==IS_OBJECT) { - result->value.lval = -1; - result->type = IS_LONG; + if (Z_TYPE_P(op2)==IS_OBJECT) { + Z_LVAL_P(result) = -1; + Z_TYPE_P(result) = IS_LONG; COMPARE_RETURN_AND_FREE(SUCCESS); } @@ -1669,50 +1667,50 @@ static int hash_zval_identical_function(const zval **z1, const zval **z2) if (is_identical_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { return 1; } - return !result.value.lval; + return !Z_LVAL(result); } ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - result->type = IS_BOOL; - if (op1->type != op2->type) { - result->value.lval = 0; + Z_TYPE_P(result) = IS_BOOL; + if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { + Z_LVAL_P(result) = 0; return SUCCESS; } - switch (op1->type) { + switch (Z_TYPE_P(op1)) { case IS_NULL: - result->value.lval = (op2->type==IS_NULL); + Z_LVAL_P(result) = (Z_TYPE_P(op2)==IS_NULL); break; case IS_BOOL: case IS_LONG: case IS_RESOURCE: - result->value.lval = (op1->value.lval == op2->value.lval); + Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); break; case IS_DOUBLE: - result->value.lval = (op1->value.dval == op2->value.dval); + Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); break; case IS_STRING: - if ((op1->value.str.len == op2->value.str.len) - && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) { - result->value.lval = 1; + if ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) + && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } break; case IS_UNICODE: - if ((op1->value.ustr.len == op2->value.ustr.len) - && (!memcmp(op1->value.ustr.val, op2->value.ustr.val, UBYTES(op1->value.ustr.len)))) { - result->value.lval = 1; + if ((Z_USTRLEN_P(op1) == Z_USTRLEN_P(op2)) + && (!memcmp(Z_USTRVAL_P(op1), Z_USTRVAL_P(op2), UBYTES(Z_USTRLEN_P(op1))))) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } break; case IS_ARRAY: - if (zend_hash_compare(op1->value.ht, op2->value.ht, (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) { - result->value.lval = 1; + if (zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } break; case IS_OBJECT: @@ -1722,12 +1720,12 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* comparison returns 0 in case of equality and * 1 in case of ineqaulity, we need to reverse it */ - result->value.lval = !result->value.lval; + Z_LVAL_P(result) = !Z_LVAL_P(result); } else { - result->value.lval = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); + Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); } } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } break; default: @@ -1740,11 +1738,11 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - result->type = IS_BOOL; + Z_TYPE_P(result) = IS_BOOL; if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - result->value.lval = !result->value.lval; + Z_LVAL_P(result) = !Z_LVAL_P(result); return SUCCESS; } @@ -1755,10 +1753,10 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) return FAILURE; } convert_to_boolean(result); - if (result->value.lval == 0) { - result->value.lval = 1; + if (Z_LVAL_P(result) == 0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } @@ -1770,10 +1768,10 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) return FAILURE; } convert_to_boolean(result); - if (result->value.lval) { - result->value.lval = 1; + if (Z_LVAL_P(result)) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } @@ -1784,21 +1782,21 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval < 0) { - result->value.lval = 1; + if (Z_TYPE_P(result) == IS_LONG) { + Z_TYPE_P(result) = IS_BOOL; + if (Z_LVAL_P(result) < 0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval < 0) { - result->value.lval = 1; + if (Z_TYPE_P(result) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_BOOL; + if (Z_DVAL_P(result) < 0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } @@ -1812,21 +1810,21 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - if (result->type == IS_LONG) { - result->type = IS_BOOL; - if (result->value.lval <= 0) { - result->value.lval = 1; + if (Z_TYPE_P(result) == IS_LONG) { + Z_TYPE_P(result) = IS_BOOL; + if (Z_LVAL_P(result) <= 0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } - if (result->type == IS_DOUBLE) { - result->type = IS_BOOL; - if (result->value.dval <= 0) { - result->value.lval = 1; + if (Z_TYPE_P(result) == IS_DOUBLE) { + Z_TYPE_P(result) = IS_BOOL; + if (Z_DVAL_P(result) <= 0) { + Z_LVAL_P(result) = 1; } else { - result->value.lval = 0; + Z_LVAL_P(result) = 0; } return SUCCESS; } @@ -1869,16 +1867,16 @@ ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class static void increment_string(zval *str) { int carry=0; - int pos=str->value.str.len-1; - char *s=str->value.str.val; + int pos=Z_STRLEN_P(str)-1; + char *s=Z_STRVAL_P(str); char *t; int last=0; /* Shut up the compiler warning */ int ch; - if (str->value.str.len == 0) { - STR_FREE(str->value.str.val); - str->value.str.val = estrndup("1", sizeof("1")-1); - str->value.str.len = 1; + if (Z_STRLEN_P(str) == 0) { + STR_FREE(Z_STRVAL_P(str)); + Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1); + Z_STRLEN_P(str) = 1; return; } @@ -1922,10 +1920,10 @@ static void increment_string(zval *str) } if (carry) { - t = (char *) emalloc(str->value.str.len+1+1); - memcpy(t+1, str->value.str.val, str->value.str.len); - str->value.str.len++; - t[str->value.str.len] = '\0'; + t = (char *) emalloc(Z_STRLEN_P(str)+1+1); + memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str)); + Z_STRLEN_P(str)++; + t[Z_STRLEN_P(str)] = '\0'; switch (last) { case NUMERIC: t[0] = '1'; @@ -1937,51 +1935,51 @@ static void increment_string(zval *str) t[0] = 'a'; break; } - STR_FREE(str->value.str.val); - str->value.str.val = t; + STR_FREE(Z_STRVAL_P(str)); + Z_STRVAL_P(str) = t; } } ZEND_API int increment_function(zval *op1) { - switch (op1->type) { + switch (Z_TYPE_P(op1)) { case IS_LONG: - if (op1->value.lval == LONG_MAX) { + if (Z_LVAL_P(op1) == LONG_MAX) { /* switch to double */ - double d = (double)op1->value.lval; + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d+1); } else { - op1->value.lval++; + Z_LVAL_P(op1)++; } break; case IS_DOUBLE: - op1->value.dval = op1->value.dval + 1; + Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; break; case IS_NULL: - op1->value.lval = 1; - op1->type = IS_LONG; + Z_LVAL_P(op1) = 1; + Z_TYPE_P(op1) = IS_LONG; break; case IS_STRING: { long lval; double dval; - char *strval = op1->value.str.val; + char *strval = Z_STRVAL_P(op1); - switch (is_numeric_string(strval, op1->value.str.len, &lval, &dval, 0)) { + switch (is_numeric_string(strval, Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: if (lval == LONG_MAX) { /* switch to double */ double d = (double)lval; ZVAL_DOUBLE(op1, d+1); } else { - op1->value.lval = lval+1; - op1->type = IS_LONG; + Z_LVAL_P(op1) = lval+1; + Z_TYPE_P(op1) = IS_LONG; } efree(strval); /* should never be empty_string */ break; case IS_DOUBLE: - op1->value.dval = dval+1; - op1->type = IS_DOUBLE; + Z_DVAL_P(op1) = dval+1; + Z_TYPE_P(op1) = IS_DOUBLE; efree(strval); /* should never be empty_string */ break; default: @@ -2006,40 +2004,40 @@ ZEND_API int decrement_function(zval *op1) long lval; double dval; - switch (op1->type) { + switch (Z_TYPE_P(op1)) { case IS_LONG: - if (op1->value.lval == LONG_MIN) { - double d = (double)op1->value.lval; + if (Z_LVAL_P(op1) == LONG_MIN) { + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d-1); } else { - op1->value.lval--; + Z_LVAL_P(op1)--; } break; case IS_DOUBLE: - op1->value.dval = op1->value.dval - 1; + Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; break; case IS_STRING: /* Like perl we only support string increment */ - if (op1->value.str.len == 0) { /* consider as 0 */ - STR_FREE(op1->value.str.val); - op1->value.lval = -1; - op1->type = IS_LONG; + if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ + STR_FREE(Z_STRVAL_P(op1)); + Z_LVAL_P(op1) = -1; + Z_TYPE_P(op1) = IS_LONG; break; } - switch (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: - STR_FREE(op1->value.str.val); + STR_FREE(Z_STRVAL_P(op1)); if (lval == LONG_MIN) { double d = (double)lval; ZVAL_DOUBLE(op1, d-1); } else { - op1->value.lval = lval-1; - op1->type = IS_LONG; + Z_LVAL_P(op1) = lval-1; + Z_TYPE_P(op1) = IS_LONG; } break; case IS_DOUBLE: - STR_FREE(op1->value.str.val); - op1->value.dval = dval - 1; - op1->type = IS_DOUBLE; + STR_FREE(Z_STRVAL_P(op1)); + Z_DVAL_P(op1) = dval - 1; + Z_TYPE_P(op1) = IS_DOUBLE; break; } break; @@ -2057,7 +2055,7 @@ ZEND_API int decrement_function(zval *op1) ZEND_API int zval_is_true(zval *op) { convert_to_boolean(op); - return (op->value.lval ? 1 : 0); + return (Z_LVAL_P(op) ? 1 : 0); } ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length) @@ -2275,31 +2273,31 @@ ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int32_t len1, UChar *s2, int32 ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) { - return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); + return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } ZEND_API int zend_u_binary_zval_strcmp(zval *s1, zval *s2) { - return zend_u_binary_strcmp(s1->value.ustr.val, s1->value.ustr.len, s2->value.ustr.val, s2->value.ustr.len); + return zend_u_binary_strcmp(Z_USTRVAL_P(s1), Z_USTRLEN_P(s1), Z_USTRVAL_P(s2), Z_USTRLEN_P(s2)); } ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) { - return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); + return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) { - return zend_binary_strcasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); + return zend_binary_strcasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) { - return zend_binary_strncasecmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); + return zend_binary_strncasecmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } @@ -2309,26 +2307,26 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) long lval1, lval2; double dval1, dval2; - if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1, 0)) && - (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2, 0))) { + if ((ret1=is_numeric_string(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0)) && + (ret2=is_numeric_string(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0))) { if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { if (ret1!=IS_DOUBLE) { - dval1 = zend_strtod(s1->value.str.val, NULL); + dval1 = zend_strtod(Z_STRVAL_P(s1), NULL); } else if (ret2!=IS_DOUBLE) { - dval2 = zend_strtod(s2->value.str.val, NULL); + dval2 = zend_strtod(Z_STRVAL_P(s2), NULL); } - result->value.dval = dval1 - dval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; + Z_DVAL_P(result) = dval1 - dval2; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } else { /* they both have to be long's */ - result->value.lval = lval1 - lval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = lval1 - lval2; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } } else { - result->value.lval = zend_binary_zval_strcmp(s1, s2); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = zend_binary_zval_strcmp(s1, s2); + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } return; } @@ -2342,7 +2340,7 @@ ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2) zval s1_copy, s2_copy; int use_copy1 = 0, use_copy2 = 0; - if (s1->type != IS_UNICODE || s2->type != IS_UNICODE) { + if (Z_TYPE_P(s1) != IS_UNICODE || Z_TYPE_P(s2) != IS_UNICODE) { zend_make_unicode_zval(s1, &s1_copy, &use_copy1); zend_make_unicode_zval(s2, &s2_copy, &use_copy2); if (use_copy1) { @@ -2353,26 +2351,26 @@ ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2) } } - if ((ret1=is_numeric_unicode(s1->value.ustr.val, s1->value.ustr.len, &lval1, &dval1, 0)) && - (ret2=is_numeric_unicode(s2->value.ustr.val, s2->value.ustr.len, &lval2, &dval2, 0))) { + if ((ret1=is_numeric_unicode(Z_USTRVAL_P(s1), Z_USTRLEN_P(s1), &lval1, &dval1, 0)) && + (ret2=is_numeric_unicode(Z_USTRVAL_P(s2), Z_USTRLEN_P(s2), &lval2, &dval2, 0))) { if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { if (ret1!=IS_DOUBLE) { - dval1 = zend_u_strtod(s1->value.ustr.val, NULL); + dval1 = zend_u_strtod(Z_USTRVAL_P(s1), NULL); } else if (ret2!=IS_DOUBLE) { - dval2 = zend_u_strtod(s2->value.ustr.val, NULL); + dval2 = zend_u_strtod(Z_USTRVAL_P(s2), NULL); } - result->value.dval = dval1 - dval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.dval); - result->type = IS_LONG; + Z_DVAL_P(result) = dval1 - dval2; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } else { /* they both have to be long's */ - result->value.lval = lval1 - lval2; - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = lval1 - lval2; + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } } else { - result->value.lval = zend_u_binary_zval_strcmp(s1, s2); - result->value.lval = ZEND_NORMALIZE_BOOL(result->value.lval); - result->type = IS_LONG; + Z_LVAL_P(result) = zend_u_binary_zval_strcmp(s1, s2); + Z_LVAL_P(result) = ZEND_NORMALIZE_BOOL(Z_LVAL_P(result)); + Z_TYPE_P(result) = IS_LONG; } if (use_copy1) { @@ -2392,7 +2390,7 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { return 1; } - return result.value.lval; + return Z_LVAL(result); } ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_DC) @@ -2404,71 +2402,71 @@ ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_ ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) { - result->type = IS_LONG; - result->value.lval = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); + Z_TYPE_P(result) = IS_LONG; + Z_LVAL_P(result) = zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC); } ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) { - zend_compare_symbol_tables(result, a1->value.ht, a2->value.ht TSRMLS_CC); + zend_compare_symbol_tables(result, Z_ARRVAL_P(a1), Z_ARRVAL_P(a2) TSRMLS_CC); } ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) { - result->type = IS_LONG; + Z_TYPE_P(result) = IS_LONG; if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) { - result->value.lval = 0; + Z_LVAL_P(result) = 0; return; } if (Z_OBJ_HT_P(o1)->compare_objects == NULL) { - result->value.lval = 1; + Z_LVAL_P(result) = 1; } else { - result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); + Z_LVAL_P(result) = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); } } ZEND_API void zend_locale_usprintf_double(zval *op ZEND_FILE_LINE_DC) { - double dval = op->value.dval; + double dval = Z_DVAL_P(op); UFILE *strf; int32_t capacity; TSRMLS_FETCH(); capacity = MAX_LENGTH_OF_DOUBLE + EG(precision) + 1; - op->value.ustr.val = eumalloc_rel(capacity); + Z_USTRVAL_P(op) = eumalloc_rel(capacity); /* UTODO uses default locale for now */ - strf = u_fstropen(op->value.ustr.val, capacity, NULL); - op->value.ustr.len = u_fprintf(strf, "%.*G", (int) EG(precision), dval); + strf = u_fstropen(Z_USTRVAL_P(op), capacity, NULL); + Z_USTRLEN_P(op) = u_fprintf(strf, "%.*G", (int) EG(precision), dval); u_fclose(strf); } ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) { - double dval = op->value.dval; + double dval = Z_DVAL_P(op); TSRMLS_FETCH(); - op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); - op->value.str.len = strlen(op->value.str.val); + Z_STRVAL_P(op) = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); + sprintf(Z_STRVAL_P(op), "%.*G", (int) EG(precision), dval); + Z_STRLEN_P(op) = strlen(Z_STRVAL_P(op)); } ZEND_API void zend_locale_usprintf_long(zval *op ZEND_FILE_LINE_DC) { - long lval = op->value.lval; + long lval = Z_LVAL_P(op); UFILE *strf; int32_t capacity; capacity = MAX_LENGTH_OF_LONG + 1; - op->value.ustr.val = eumalloc_rel(capacity); + Z_USTRVAL_P(op) = eumalloc_rel(capacity); /* UTODO uses default locale for now */ - strf = u_fstropen(op->value.ustr.val, capacity, NULL); - op->value.ustr.len = u_fprintf(strf, "%ld", lval); + strf = u_fstropen(Z_USTRVAL_P(op), capacity, NULL); + Z_USTRLEN_P(op) = u_fprintf(strf, "%ld", lval); u_fclose(strf); } diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 903bd9101c..699904092e 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -309,7 +309,7 @@ ZEND_API void zend_locale_usprintf_double(zval *op ZEND_FILE_LINE_DC); ZEND_API void zend_locale_usprintf_long(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() #define convert_to_ex_master(ppzv, lower_type, upper_type) \ - if ((*ppzv)->type!=IS_##upper_type) { \ + if (Z_TYPE_PP(ppzv)!=IS_##upper_type) { \ SEPARATE_ZVAL_IF_NOT_REF(ppzv); \ convert_to_##lower_type(*ppzv); \ } @@ -348,7 +348,7 @@ END_EXTERN_C() } while (0); \ #define convert_to_explicit_type_ex(ppzv, str_type) \ - if ((*ppzv)->type != str_type) { \ + if (Z_TYPE_PP(ppzv) != str_type) { \ SEPARATE_ZVAL_IF_NOT_REF(ppzv); \ convert_to_explicit_type(*ppzv, str_type); \ } @@ -364,7 +364,7 @@ END_EXTERN_C() #define convert_to_text_ex(ppzv) if (UG(unicode)) {convert_to_unicode_ex(ppzv);} else {convert_to_string_ex(ppzv);} #define convert_scalar_to_number_ex(ppzv) \ - if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) { \ + if (Z_TYPE_PP(ppzv)!=IS_LONG && Z_TYPE_PP(ppzv)!=IS_DOUBLE) { \ if (!(*ppzv)->is_ref) { \ SEPARATE_ZVAL(ppzv); \ } \ @@ -382,14 +382,14 @@ END_EXTERN_C() #define Z_USTRCPLEN(zval) (u_countChar32((zval).value.ustr.val, (zval).value.ustr.len)) #define Z_ARRVAL(zval) (zval).value.ht #define Z_OBJVAL(zval) (zval).value.obj -#define Z_OBJ_HANDLE(zval) (zval).value.obj.handle -#define Z_OBJ_HT(zval) (zval).value.obj.handlers +#define Z_OBJ_HANDLE(zval) Z_OBJVAL(zval).handle +#define Z_OBJ_HT(zval) Z_OBJVAL(zval).handlers #define Z_OBJCE(zval) zend_get_class_entry(&(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_RESVAL(zval) (zval).value.lval -#define Z_UNIVAL(zval) ((zval).type==IS_UNICODE?(char*)(zval).value.ustr.val:(zval).value.str.val) -#define Z_UNILEN(zval) ((zval).type==IS_UNICODE?(zval).value.ustr.len:(zval).value.str.len) +#define Z_UNIVAL(zval) (Z_TYPE(zval)==IS_UNICODE?(char*)Z_USTRVAL(zval):Z_STRVAL(zval)) +#define Z_UNILEN(zval) (Z_TYPE(zval)==IS_UNICODE?Z_USTRLEN(zval):Z_STRLEN(zval)) #define Z_LVAL_P(zval_p) Z_LVAL(*zval_p) #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 3a50af29c8..9fb71a13ab 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -89,7 +89,7 @@ * directly -- and assumed always to succeed. */ -#include +#include #include #include diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index f98993d493..d0622ff589 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -29,7 +29,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) { case IS_CONSTANT: { TSRMLS_FETCH(); @@ -37,20 +37,20 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); - STR_FREE_REL(zvalue->value.str.val); + STR_FREE_REL(Z_STRVAL_P(zvalue)); break; case IS_UNICODE: dtor_unicode: CHECK_ZVAL_UNICODE_REL(zvalue); - STR_FREE_REL(zvalue->value.ustr.val); + STR_FREE_REL(Z_USTRVAL_P(zvalue)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: { TSRMLS_FETCH(); - if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) { - zend_hash_destroy(zvalue->value.ht); - FREE_HASHTABLE(zvalue->value.ht); + if (Z_ARRVAL_P(zvalue) && (Z_ARRVAL_P(zvalue) != &EG(symbol_table))) { + zend_hash_destroy(Z_ARRVAL_P(zvalue)); + FREE_HASHTABLE(Z_ARRVAL_P(zvalue)); } } break; @@ -66,7 +66,7 @@ dtor_unicode: TSRMLS_FETCH(); /* destroy resource */ - zend_list_delete(zvalue->value.lval); + zend_list_delete(Z_LVAL_P(zvalue)); } break; case IS_LONG: @@ -82,7 +82,7 @@ dtor_unicode: ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) { case IS_CONSTANT: { TSRMLS_FETCH(); @@ -90,12 +90,12 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); - free(zvalue->value.str.val); + free(Z_STRVAL_P(zvalue)); break; case IS_UNICODE: dtor_unicode: CHECK_ZVAL_UNICODE_REL(zvalue); - free(zvalue->value.ustr.val); + free(Z_USTRVAL_P(zvalue)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: @@ -121,11 +121,11 @@ ZEND_API void zval_add_ref(zval **p) ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) { - switch (zvalue->type) { + switch (Z_TYPE_P(zvalue)) { case IS_RESOURCE: { TSRMLS_FETCH(); - zend_list_addref(zvalue->value.lval); + zend_list_addref(Z_LVAL_P(zvalue)); } break; case IS_BOOL: @@ -139,27 +139,27 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) } case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); - zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len); + Z_STRVAL_P(zvalue) = (char *) estrndup_rel(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue)); break; case IS_UNICODE: copy_unicode: CHECK_ZVAL_UNICODE_REL(zvalue); - zvalue->value.ustr.val = eustrndup_rel(zvalue->value.ustr.val, zvalue->value.ustr.len); + Z_USTRVAL_P(zvalue) = eustrndup_rel(Z_USTRVAL_P(zvalue), Z_USTRLEN_P(zvalue)); break; case IS_ARRAY: case IS_CONSTANT_ARRAY: { zval *tmp; - HashTable *original_ht = zvalue->value.ht; + HashTable *original_ht = Z_ARRVAL_P(zvalue); HashTable *tmp_ht = NULL; TSRMLS_FETCH(); - if (zvalue->value.ht == &EG(symbol_table)) { + if (Z_ARRVAL_P(zvalue) == &EG(symbol_table)) { return; /* do nothing */ } ALLOC_HASHTABLE_REL(tmp_ht); zend_u_hash_init(tmp_ht, 0, NULL, ZVAL_PTR_DTOR, 0, original_ht->unicode); zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); - zvalue->value.ht = tmp_ht; + Z_ARRVAL_P(zvalue) = tmp_ht; } break; case IS_OBJECT: diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index 8797eaf375..2cb30231c1 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -29,9 +29,9 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC); static inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) { - if (zvalue->type <= IS_BOOL) { - return; - } + if (Z_TYPE_P(zvalue) <= IS_BOOL) { + return; + } _zval_dtor_func(zvalue ZEND_FILE_LINE_CC); } @@ -39,9 +39,9 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC); static inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) { - if (zvalue->type <= IS_BOOL) { - return; - } + if (Z_TYPE_P(zvalue) <= IS_BOOL) { + return; + } _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_CC); } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f49bf2b6b4..e72b16c470 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -298,7 +298,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP2(); FREE_OP(free_op_data1); @@ -345,7 +345,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -412,7 +412,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); } else { zend_op *op_data = opline+1; @@ -548,7 +548,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR| make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); FREE_OP2(); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -583,7 +583,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR| if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -640,7 +640,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); FREE_OP2(); *retval = *EG(uninitialized_zval_ptr); @@ -673,7 +673,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -884,7 +884,6 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); zend_free_op free_op1; - zval z_copy; zval *z = GET_OP1_ZVAL_PTR(BP_VAR_R); UErrorCode status = U_ZERO_ERROR; @@ -897,8 +896,8 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) if (zend_set_converter_encoding(&script_enc_conv, EX(op_array)->script_encoding) == FAILURE) { zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_STRING; + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &Z_STRVAL(z_conv), &Z_STRLEN(z_conv), Z_STRVAL_P(z), Z_STRLEN_P(z), &status); + Z_TYPE(z_conv) = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -918,8 +917,8 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO); } @@ -933,7 +932,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_text(&tmp_varname); @@ -1176,7 +1175,7 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST| } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -1327,7 +1326,7 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, TMP, CONST) zend_free_op free_op1; zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (container->type != IS_ARRAY) { + if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -1336,7 +1335,7 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, TMP, CONST) zend_free_op free_op2; zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, dim, BP_VAR_R TSRMLS_CC); + EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); FREE_OP2(); } @@ -1372,7 +1371,7 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -1512,8 +1511,8 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY) int retval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); FREE_OP1(); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1530,8 +1529,8 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY) int retval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); FREE_OP1(); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1552,15 +1551,15 @@ ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY) zval *tmp = &EX_T(EX(opline)->result.u.var).tmp_var; if (EX(opline)->extended_value == IS_UNICODE) { - tmp->value.ustr.val = eumalloc(1); - tmp->value.ustr.val[0] = 0; - tmp->value.ustr.len = 0; - tmp->type = IS_UNICODE; + Z_USTRVAL_P(tmp) = eumalloc(1); + Z_USTRVAL_P(tmp)[0] = 0; + Z_USTRLEN_P(tmp) = 0; + Z_TYPE_P(tmp) = IS_UNICODE; } else { - tmp->value.str.val = emalloc(1); - tmp->value.str.val[0] = 0; - tmp->value.str.len = 0; - tmp->type = EX(opline)->extended_value; + Z_STRVAL_P(tmp) = emalloc(1); + Z_STRVAL_P(tmp)[0] = 0; + Z_STRLEN_P(tmp) = 0; + Z_TYPE_P(tmp) = EX(opline)->extended_value; } tmp->refcount = 1; tmp->is_ref = 0; @@ -1637,7 +1636,7 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) class_name = GET_OP2_ZVAL_PTR(BP_VAR_R); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1677,7 +1676,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -2072,7 +2071,7 @@ ZEND_VM_C_LABEL(return_by_value): zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); + Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { efree(class_name); @@ -2111,7 +2110,7 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) value = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -2280,7 +2279,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) { zend_op *opline = EX(opline); zval **param; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { char *space; @@ -2289,9 +2288,9 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); if(ptr && ptr->op_array) { - zend_error(E_WARNING, "Missing argument %ld for %v%s%v(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + zend_error(E_WARNING, "Missing argument %ld for %v%s%v(), called in %s on line %d and defined", Z_LVAL(opline->op1.u.constant), class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); } else { - zend_error(E_WARNING, "Missing argument %ld for %v%s%v()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + zend_error(E_WARNING, "Missing argument %ld for %v%s%v()", Z_LVAL(opline->op1.u.constant), class_name, space, get_active_function_name(TSRMLS_C)); } if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -2316,16 +2315,16 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) { zend_op *opline = EX(opline); zval **param, *assignment_value; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); zend_free_op free_res; if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (opline->op2.u.constant.type == IS_CONSTANT || opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval *default_value; ALLOC_ZVAL(default_value); *default_value = opline->op2.u.constant; - if (opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval_copy_ctor(default_value); } default_value->refcount=1; @@ -2361,8 +2360,8 @@ ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) zend_free_op free_op1; /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; FREE_OP1(); ZEND_VM_NEXT_OPCODE(); @@ -2502,24 +2501,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -2537,7 +2536,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, CONST|UNUSED, CONST) /* This seems to be a reminant of namespaces if (EG(scope)) { ce = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { zval_update_constant(value, (void *) 1 TSRMLS_CC); EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); @@ -2614,20 +2613,20 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|V } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -2637,7 +2636,7 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|V } FREE_OP2(); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { FREE_OP1_VAR_PTR(); @@ -2720,14 +2719,14 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && opline->op2.u.constant.value.lval == ZEND_EVAL) { - if (inc_filename->type != IS_UNICODE) { + if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_unicode(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } - } else if (inc_filename->type!=IS_STRING) { + } else if (Z_TYPE_P(inc_filename)!=IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); @@ -2736,30 +2735,30 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); + file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -2767,7 +2766,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -2809,8 +2808,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -2826,8 +2825,8 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } FREE_OP1(); @@ -2844,7 +2843,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) varname = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -2900,15 +2899,15 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -2919,7 +2918,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -3282,18 +3281,18 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) switch (key_type) { case HASH_KEY_IS_STRING: - key->value.str.val = str_key; - key->value.str.len = str_key_len-1; - key->type = IS_STRING; + Z_STRVAL_P(key) = str_key; + Z_STRLEN_P(key) = str_key_len-1; + Z_TYPE_P(key) = IS_STRING; break; case HASH_KEY_IS_UNICODE: - key->value.ustr.val = (UChar*)str_key; - key->value.ustr.len = str_key_len-1; - key->type = IS_UNICODE; + Z_USTRVAL_P(key) = (UChar*)str_key; + Z_USTRLEN_P(key) = str_key_len-1; + Z_TYPE_P(key) = IS_UNICODE; break; case HASH_KEY_IS_LONG: - key->value.lval = int_key; - key->type = IS_LONG; + Z_LVAL_P(key) = int_key; + Z_TYPE_P(key) = IS_LONG; break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -3312,7 +3311,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -3331,21 +3330,21 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -3371,21 +3370,21 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| zend_free_op free_op2; zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -3447,7 +3446,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| break; } FREE_OP2(); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (IS_OP2_TMP_FREE()) { MAKE_REAL_ZVAL_PTR(offset); } @@ -3461,30 +3460,30 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| } else { FREE_OP2(); } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -3496,14 +3495,14 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -3544,8 +3543,8 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = EG(error_reporting); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; /* shouldn't be necessary */ if (EX(old_error_reporting) == NULL) { EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; } @@ -3567,9 +3566,9 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) zend_op *opline = EX(opline); zval restored_error_reporting; - if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval; + if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.u.var).tmp_var) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); @@ -3644,10 +3643,10 @@ ZEND_VM_HANDLER(105, ZEND_TICKS, CONST, ANY) { zend_op *opline = EX(opline); - if (++EG(ticks_count)>=opline->op1.u.constant.value.lval) { + if (++EG(ticks_count)>=Z_LVAL(opline->op1.u.constant)) { EG(ticks_count)=0; if (zend_ticks_function) { - zend_ticks_function(opline->op1.u.constant.value.lval); + zend_ticks_function(Z_LVAL(opline->op1.u.constant)); } } ZEND_VM_NEXT_OPCODE(); @@ -3737,9 +3736,9 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } /* restore previous error_reporting value */ - if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval; + if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 8774695098..92a06c0a3c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -114,15 +114,15 @@ static int ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *tmp = &EX_T(EX(opline)->result.u.var).tmp_var; if (EX(opline)->extended_value == IS_UNICODE) { - tmp->value.ustr.val = eumalloc(1); - tmp->value.ustr.val[0] = 0; - tmp->value.ustr.len = 0; - tmp->type = IS_UNICODE; + Z_USTRVAL_P(tmp) = eumalloc(1); + Z_USTRVAL_P(tmp)[0] = 0; + Z_USTRLEN_P(tmp) = 0; + Z_TYPE_P(tmp) = IS_UNICODE; } else { - tmp->value.str.val = emalloc(1); - tmp->value.str.val[0] = 0; - tmp->value.str.len = 0; - tmp->type = EX(opline)->extended_value; + Z_STRVAL_P(tmp) = emalloc(1); + Z_STRVAL_P(tmp)[0] = 0; + Z_STRLEN_P(tmp) = 0; + Z_TYPE_P(tmp) = EX(opline)->extended_value; } tmp->refcount = 1; tmp->is_ref = 0; @@ -355,7 +355,7 @@ static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **param; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { char *space; @@ -364,9 +364,9 @@ static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); if(ptr && ptr->op_array) { - zend_error(E_WARNING, "Missing argument %ld for %v%s%v(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); + zend_error(E_WARNING, "Missing argument %ld for %v%s%v(), called in %s on line %d and defined", Z_LVAL(opline->op1.u.constant), class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); } else { - zend_error(E_WARNING, "Missing argument %ld for %v%s%v()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); + zend_error(E_WARNING, "Missing argument %ld for %v%s%v()", Z_LVAL(opline->op1.u.constant), class_name, space, get_active_function_name(TSRMLS_C)); } if (opline->result.op_type == IS_VAR) { PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -436,8 +436,8 @@ static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting); - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */ + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = EG(error_reporting); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; /* shouldn't be necessary */ if (EX(old_error_reporting) == NULL) { EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; } @@ -567,9 +567,9 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } /* restore previous error_reporting value */ - if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval; + if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); @@ -620,7 +620,7 @@ static int ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = &opline->op2.u.constant; - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -733,16 +733,16 @@ static int ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zval **param, *assignment_value; - zend_uint arg_num = opline->op1.u.constant.value.lval; + zend_uint arg_num = Z_LVAL(opline->op1.u.constant); zend_free_op free_res; if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) { - if (opline->op2.u.constant.type == IS_CONSTANT || opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval *default_value; ALLOC_ZVAL(default_value); *default_value = opline->op2.u.constant; - if (opline->op2.u.constant.type==IS_CONSTANT_ARRAY) { + if (Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { zval_copy_ctor(default_value); } default_value->refcount=1; @@ -806,7 +806,7 @@ static int ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -930,7 +930,7 @@ static int ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1054,7 +1054,7 @@ static int ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = NULL; - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1135,7 +1135,7 @@ static int ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) class_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - switch (class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_OBJECT: EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); break; @@ -1270,7 +1270,6 @@ static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval z_copy; zval *z = &opline->op1.u.constant; UErrorCode status = U_ZERO_ERROR; @@ -1283,8 +1282,8 @@ static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (zend_set_converter_encoding(&script_enc_conv, EX(op_array)->script_encoding) == FAILURE) { zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_STRING; + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &Z_STRVAL(z_conv), &Z_STRLEN(z_conv), Z_STRVAL_P(z), Z_STRLEN_P(z), &status); + Z_TYPE(z_conv) = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -1303,8 +1302,8 @@ static int ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -1318,7 +1317,7 @@ static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLE zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_text(&tmp_varname); @@ -1491,8 +1490,8 @@ static int ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1508,8 +1507,8 @@ static int ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -1591,7 +1590,7 @@ return_by_value: zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); + Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { efree(class_name); @@ -1630,7 +1629,7 @@ static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = &opline->op1.u.constant; - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -1676,8 +1675,8 @@ static int ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(&opline->op1.u.constant); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(&opline->op1.u.constant); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; ZEND_VM_NEXT_OPCODE(); } @@ -1713,24 +1712,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -1806,14 +1805,14 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && opline->op2.u.constant.value.lval == ZEND_EVAL) { - if (inc_filename->type != IS_UNICODE) { + if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_unicode(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } - } else if (inc_filename->type!=IS_STRING) { + } else if (Z_TYPE_P(inc_filename)!=IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); @@ -1822,30 +1821,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); + file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -1853,7 +1852,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -1895,8 +1894,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -1912,8 +1911,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -1930,7 +1929,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = &opline->op1.u.constant; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -2103,7 +2102,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -2122,21 +2121,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -2184,10 +2183,10 @@ static int ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - if (++EG(ticks_count)>=opline->op1.u.constant.value.lval) { + if (++EG(ticks_count)>=Z_LVAL(opline->op1.u.constant)) { EG(ticks_count)=0; if (zend_ticks_function) { - zend_ticks_function(opline->op1.u.constant.value.lval); + zend_ticks_function(Z_LVAL(opline->op1.u.constant)); } } ZEND_VM_NEXT_OPCODE(); @@ -2503,7 +2502,7 @@ static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS /* This seems to be a reminant of namespaces if (EG(scope)) { ce = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { zval_update_constant(value, (void *) 1 TSRMLS_CC); EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); @@ -2580,20 +2579,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -2603,7 +2602,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -2928,20 +2927,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -2951,7 +2950,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3276,20 +3275,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3299,7 +3298,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3358,20 +3357,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3381,7 +3380,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3705,20 +3704,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -3728,7 +3727,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -3769,7 +3768,6 @@ static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - zval z_copy; zval *z = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); UErrorCode status = U_ZERO_ERROR; @@ -3782,8 +3780,8 @@ static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (zend_set_converter_encoding(&script_enc_conv, EX(op_array)->script_encoding) == FAILURE) { zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_STRING; + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &Z_STRVAL(z_conv), &Z_STRLEN(z_conv), Z_STRVAL_P(z), Z_STRLEN_P(z), &status); + Z_TYPE(z_conv) = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -3803,8 +3801,8 @@ static int ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -3818,7 +3816,7 @@ static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_text(&tmp_varname); @@ -3995,8 +3993,8 @@ static int ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); zval_dtor(free_op1.var); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -4013,8 +4011,8 @@ static int ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); zval_dtor(free_op1.var); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -4085,7 +4083,7 @@ return_by_value: zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); + Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { efree(class_name); @@ -4124,7 +4122,7 @@ static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -4170,8 +4168,8 @@ static int ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); @@ -4214,24 +4212,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -4307,14 +4305,14 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && opline->op2.u.constant.value.lval == ZEND_EVAL) { - if (inc_filename->type != IS_UNICODE) { + if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_unicode(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } - } else if (inc_filename->type!=IS_STRING) { + } else if (Z_TYPE_P(inc_filename)!=IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); @@ -4323,30 +4321,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); + file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -4354,7 +4352,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -4396,8 +4394,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -4413,8 +4411,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } zval_dtor(free_op1.var); @@ -4431,7 +4429,7 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -4604,7 +4602,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -4623,21 +4621,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -4673,9 +4671,9 @@ static int ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_op *opline = EX(opline); zval restored_error_reporting; - if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) { - restored_error_reporting.type = IS_LONG; - restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval; + if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.u.var).tmp_var) != 0) { + Z_TYPE(restored_error_reporting) = IS_LONG; + Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); convert_to_string(&restored_error_reporting); zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); zendi_zval_dtor(restored_error_reporting); @@ -4992,7 +4990,7 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_free_op free_op1; zval *container = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (container->type != IS_ARRAY) { + if (Z_TYPE_P(container) != IS_ARRAY) { if (!RETURN_VALUE_UNUSED(&opline->result)) { EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr); PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); @@ -5001,7 +4999,7 @@ static int ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG zval *dim = &opline->op2.u.constant; - EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, dim, BP_VAR_R TSRMLS_CC); + EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC); SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result); } @@ -5056,7 +5054,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -5163,20 +5161,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -5186,7 +5184,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -5490,7 +5488,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -5599,20 +5597,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -5622,7 +5620,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -5926,7 +5924,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -6035,20 +6033,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6058,7 +6056,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6117,20 +6115,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6140,7 +6138,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6443,7 +6441,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -6550,20 +6548,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -6573,7 +6571,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -6776,7 +6774,6 @@ static int ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; - zval z_copy; zval *z = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); UErrorCode status = U_ZERO_ERROR; @@ -6789,8 +6786,8 @@ static int ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (zend_set_converter_encoding(&script_enc_conv, EX(op_array)->script_encoding) == FAILURE) { zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_STRING; + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &Z_STRVAL(z_conv), &Z_STRLEN(z_conv), Z_STRVAL_P(z), Z_STRLEN_P(z), &status); + Z_TYPE(z_conv) = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -6810,8 +6807,8 @@ static int ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -6825,7 +6822,7 @@ static int zend_fetch_var_address_helper_SPEC_VAR(int type, ZEND_OPCODE_HANDLER_ zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_text(&tmp_varname); @@ -7002,8 +6999,8 @@ static int ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -7020,8 +7017,8 @@ static int ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -7086,7 +7083,7 @@ return_by_value: zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); + Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { efree(class_name); @@ -7125,7 +7122,7 @@ static int ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -7268,8 +7265,8 @@ static int ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; ZEND_VM_NEXT_OPCODE(); @@ -7312,24 +7309,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -7405,14 +7402,14 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && opline->op2.u.constant.value.lval == ZEND_EVAL) { - if (inc_filename->type != IS_UNICODE) { + if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_unicode(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } - } else if (inc_filename->type!=IS_STRING) { + } else if (Z_TYPE_P(inc_filename)!=IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); @@ -7421,30 +7418,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); + file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -7452,7 +7449,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -7494,8 +7491,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -7511,8 +7508,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -7529,7 +7526,7 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -7820,18 +7817,18 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) switch (key_type) { case HASH_KEY_IS_STRING: - key->value.str.val = str_key; - key->value.str.len = str_key_len-1; - key->type = IS_STRING; + Z_STRVAL_P(key) = str_key; + Z_STRLEN_P(key) = str_key_len-1; + Z_TYPE_P(key) = IS_STRING; break; case HASH_KEY_IS_UNICODE: - key->value.ustr.val = (UChar*)str_key; - key->value.ustr.len = str_key_len-1; - key->type = IS_UNICODE; + Z_USTRVAL_P(key) = (UChar*)str_key; + Z_USTRLEN_P(key) = str_key_len-1; + Z_TYPE_P(key) = IS_UNICODE; break; case HASH_KEY_IS_LONG: - key->value.lval = int_key; - key->type = IS_LONG; + Z_LVAL_P(key) = int_key; + Z_TYPE_P(key) = IS_LONG; break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -7850,7 +7847,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -7869,21 +7866,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -8231,7 +8228,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -8278,7 +8275,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8345,7 +8342,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -8480,7 +8477,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -8515,7 +8512,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, ZE if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8572,7 +8569,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -8605,7 +8602,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_t incdec_op, Z zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -8776,7 +8773,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -8949,7 +8946,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -9003,7 +9000,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -9111,20 +9108,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -9134,7 +9131,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -9165,15 +9162,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -9184,7 +9181,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -9309,21 +9306,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -9385,7 +9382,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -9399,30 +9396,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -9434,14 +9431,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -9711,7 +9708,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -9758,7 +9755,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*binary_op)(zval * break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -9825,7 +9822,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_op)(zval *resu (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -9961,7 +9958,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -9996,7 +9993,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEND if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -10053,7 +10050,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -10086,7 +10083,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t incdec_op, ZEN zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -10257,7 +10254,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -10430,7 +10427,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -10485,7 +10482,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -10595,20 +10592,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -10618,7 +10615,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -10649,15 +10646,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -10668,7 +10665,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -10793,21 +10790,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -10869,7 +10866,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -10883,30 +10880,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } else { zval_dtor(free_op2.var); } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -10918,14 +10915,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -11195,7 +11192,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -11242,7 +11239,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*binary_op)(zval * break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11309,7 +11306,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_op)(zval *resu (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -11445,7 +11442,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -11480,7 +11477,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEND if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11537,7 +11534,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -11570,7 +11567,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t incdec_op, ZEN zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -11741,7 +11738,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -11914,7 +11911,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -12007,7 +12004,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -12117,20 +12114,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -12140,7 +12137,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -12171,15 +12168,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -12190,7 +12187,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -12315,21 +12312,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -12391,7 +12388,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -12405,30 +12402,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -12440,14 +12437,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -12483,7 +12480,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -12530,7 +12527,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -12597,7 +12594,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -12774,7 +12771,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -12837,20 +12834,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -12860,7 +12857,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_AR } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -13126,7 +13123,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -13173,7 +13170,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -13240,7 +13237,7 @@ static int zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -13375,7 +13372,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -13410,7 +13407,7 @@ static int zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -13467,7 +13464,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -13500,7 +13497,7 @@ static int zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -13671,7 +13668,7 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -13844,7 +13841,7 @@ static int ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -13934,7 +13931,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -14042,20 +14039,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -14065,7 +14062,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; @@ -14096,15 +14093,15 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -14115,7 +14112,7 @@ static int ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -14240,21 +14237,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -14316,7 +14313,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -14330,30 +14327,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -14365,14 +14362,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -14422,24 +14419,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -14482,7 +14479,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -14529,7 +14526,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int (*binary_op)(z break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14595,7 +14592,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*binary_op)(zval (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -14730,7 +14727,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -14765,7 +14762,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op, if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14822,7 +14819,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -14855,7 +14852,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incdec_t incdec_op zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -14923,7 +14920,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -15094,7 +15091,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -15136,7 +15133,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_A EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -15178,7 +15175,7 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG /* This seems to be a reminant of namespaces if (EG(scope)) { ce = EG(scope); - if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { zval_update_constant(value, (void *) 1 TSRMLS_CC); EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); @@ -15255,20 +15252,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -15278,7 +15275,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -15309,15 +15306,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -15328,7 +15325,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -15451,21 +15448,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -15527,7 +15524,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -15541,30 +15538,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -15576,14 +15573,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -15617,7 +15614,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -15664,7 +15661,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -15730,7 +15727,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -15866,7 +15863,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -15901,7 +15898,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, Z if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -15958,7 +15955,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -15991,7 +15988,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec_t incdec_op, zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -16059,7 +16056,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -16230,7 +16227,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -16273,7 +16270,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -16350,20 +16347,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -16373,7 +16370,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -16404,15 +16401,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -16423,7 +16420,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -16546,21 +16543,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -16622,7 +16619,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -16636,30 +16633,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } else { zval_dtor(free_op2.var); } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -16671,14 +16668,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -16712,7 +16709,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -16759,7 +16756,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zva break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -16825,7 +16822,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *r (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -16961,7 +16958,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -16996,7 +16993,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, Z if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17053,7 +17050,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -17086,7 +17083,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec_t incdec_op, zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17154,7 +17151,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -17325,7 +17322,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -17368,7 +17365,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -17445,20 +17442,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -17468,7 +17465,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -17499,15 +17496,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -17518,7 +17515,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -17641,21 +17638,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -17717,7 +17714,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -17731,30 +17728,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -17766,14 +17763,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -17807,7 +17804,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -17854,7 +17851,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)( break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -17920,7 +17917,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -18056,7 +18053,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -18119,20 +18116,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -18142,7 +18139,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -18174,7 +18171,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -18221,7 +18218,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -18287,7 +18284,7 @@ static int zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -18422,7 +18419,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -18457,7 +18454,7 @@ static int zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, ZE if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -18514,7 +18511,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -18547,7 +18544,7 @@ static int zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_t incdec_op, Z zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -18615,7 +18612,7 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -18786,7 +18783,7 @@ static int ZEND_ASSIGN_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -18828,7 +18825,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS EX(object) = _get_obj_zval_ptr_unused(TSRMLS_C); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -18904,20 +18901,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -18927,7 +18924,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -18958,15 +18955,15 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -18977,7 +18974,7 @@ static int ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -19100,21 +19097,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -19176,7 +19173,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -19190,30 +19187,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -19225,14 +19222,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -19433,7 +19430,6 @@ static int ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - zval z_copy; zval *z = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); UErrorCode status = U_ZERO_ERROR; @@ -19446,8 +19442,8 @@ static int ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (zend_set_converter_encoding(&script_enc_conv, EX(op_array)->script_encoding) == FAILURE) { zend_error(E_ERROR, "Unsupported encoding [%d]", EX(op_array)->script_encoding); } - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, z->value.str.val, z->value.str.len, &status); - z_conv.type = IS_STRING; + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), script_enc_conv, &Z_STRVAL(z_conv), &Z_STRLEN(z_conv), Z_STRVAL_P(z), Z_STRLEN_P(z), &status); + Z_TYPE(z_conv) = IS_STRING; if (U_SUCCESS(status)) { zend_print_variable(&z_conv); } else { @@ -19466,8 +19462,8 @@ static int ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); - EX_T(opline->result.u.var).tmp_var.value.lval = 1; - EX_T(opline->result.u.var).tmp_var.type = IS_LONG; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -19481,7 +19477,7 @@ static int zend_fetch_var_address_helper_SPEC_CV(int type, ZEND_OPCODE_HANDLER_A zval tmp_varname; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp_varname = *varname; zval_copy_ctor(&tmp_varname); convert_to_text(&tmp_varname); @@ -19654,8 +19650,8 @@ static int ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (!retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -19671,8 +19667,8 @@ static int ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int retval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.value.lval = retval; - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; if (retval) { #if DEBUG_ZEND>=2 printf("Conditional jmp to %d\n", opline->op2.u.opline_num); @@ -19737,7 +19733,7 @@ return_by_value: zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); } zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); - ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); + Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { efree(class_name); @@ -19776,7 +19772,7 @@ static int ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) value = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (value->type != IS_OBJECT) { + if (Z_TYPE_P(value) != IS_OBJECT) { zend_error_noreturn(E_ERROR, "Can only throw objects"); } /* Not sure if a complete copy is what we want here */ @@ -19918,8 +19914,8 @@ static int ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - EX_T(opline->result.u.var).tmp_var.value.lval = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC)); + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; ZEND_VM_NEXT_OPCODE(); } @@ -19955,24 +19951,24 @@ 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. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } 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 : EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); } } } EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.obj = clone_call(obj TSRMLS_CC); + Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); if (EG(exception)) { FREE_ZVAL(EX_T(opline->result.u.var).var.ptr); } else { - EX_T(opline->result.u.var).var.ptr->type = IS_OBJECT; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; EX_T(opline->result.u.var).var.ptr->refcount=1; EX_T(opline->result.u.var).var.ptr->is_ref=1; } @@ -20048,14 +20044,14 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval tmp_inc_filename; zend_bool failure_retval=0; - if (UG(unicode) && opline->op2.u.constant.value.lval == ZEND_EVAL) { - if (inc_filename->type != IS_UNICODE) { + if (UG(unicode) && Z_LVAL(opline->op2.u.constant) == ZEND_EVAL) { + if (Z_TYPE_P(inc_filename) != IS_UNICODE) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_unicode(&tmp_inc_filename); inc_filename = &tmp_inc_filename; } - } else if (inc_filename->type!=IS_STRING) { + } else if (Z_TYPE_P(inc_filename)!=IS_STRING) { tmp_inc_filename = *inc_filename; zval_copy_ctor(&tmp_inc_filename); convert_to_string(&tmp_inc_filename); @@ -20064,30 +20060,30 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) return_value_used = RETURN_VALUE_USED(opline); - switch (opline->op2.u.constant.value.lval) { + switch (Z_LVAL(opline->op2.u.constant)) { case ZEND_INCLUDE_ONCE: case ZEND_REQUIRE_ONCE: { int dummy = 1; zend_file_handle file_handle; - if (SUCCESS == zend_stream_open(inc_filename->value.str.val, &file_handle TSRMLS_CC)) { + if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) { if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(inc_filename->value.str.val, inc_filename->value.str.len); + file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename)); } if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL)==SUCCESS) { - new_op_array = zend_compile_file(&file_handle, (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); + new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); zend_destroy_file_handle(&file_handle TSRMLS_CC); } else { zend_file_handle_dtor(&file_handle); failure_retval=1; } } else { - if (opline->op2.u.constant.value.lval==ZEND_INCLUDE_ONCE) { - zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, inc_filename->value.str.val); + if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { + zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename)); } else { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, inc_filename->value.str.val); + zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename)); } } break; @@ -20095,7 +20091,7 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) break; case ZEND_INCLUDE: case ZEND_REQUIRE: - new_op_array = compile_filename(opline->op2.u.constant.value.lval, inc_filename TSRMLS_CC); + new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); break; case ZEND_EVAL: { char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); @@ -20137,8 +20133,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = 1; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -20154,8 +20150,8 @@ static int ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) if (return_value_used) { ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); - EX_T(opline->result.u.var).var.ptr->value.lval = failure_retval; - EX_T(opline->result.u.var).var.ptr->type = IS_BOOL; + Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; + Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; } } @@ -20172,7 +20168,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) varname = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -20345,7 +20341,7 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_bool isset = 1; HashTable *target_symbol_table; - if (varname->type != IS_STRING && varname->type != IS_UNICODE) { + if (Z_TYPE_P(varname) != IS_STRING && Z_TYPE_P(varname) != IS_UNICODE) { tmp = *varname; zval_copy_ctor(&tmp); convert_to_text(&tmp); @@ -20364,21 +20360,21 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: if (isset && Z_TYPE_PP(value) == IS_NULL) { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = isset; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; } break; case ZEND_ISEMPTY: if (!isset || !i_zend_is_true(*value)) { - EX_T(opline->result.u.var).tmp_var.value.lval = 1; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; } else { - EX_T(opline->result.u.var).tmp_var.value.lval = 0; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; } break; } @@ -20725,7 +20721,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -20772,7 +20768,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -20838,7 +20834,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary_op)(zval *res (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -20973,7 +20969,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -21008,7 +21004,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZEN if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -21065,7 +21061,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -21098,7 +21094,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t incdec_op, ZE zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -21269,7 +21265,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_ } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -21440,7 +21436,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -21494,7 +21490,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -21601,20 +21597,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -21624,7 +21620,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -21655,15 +21651,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -21674,7 +21670,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -21797,21 +21793,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z zval *offset = &opline->op2.u.constant; - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -21873,7 +21869,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -21887,30 +21883,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -21922,14 +21918,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -22197,7 +22193,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); zval_dtor(free_op2.var); FREE_OP(free_op_data1); @@ -22244,7 +22240,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -22310,7 +22306,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -22446,7 +22442,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -22481,7 +22477,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -22538,7 +22534,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); zval_dtor(free_op2.var); *retval = *EG(uninitialized_zval_ptr); @@ -22571,7 +22567,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -22742,7 +22738,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -22913,7 +22909,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -22968,7 +22964,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -23077,20 +23073,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -23100,7 +23096,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } zval_dtor(free_op2.var); } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -23131,15 +23127,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -23150,7 +23146,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -23273,21 +23269,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -23349,7 +23345,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN break; } zval_dtor(free_op2.var); - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (1) { MAKE_REAL_ZVAL_PTR(offset); } @@ -23363,30 +23359,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } else { zval_dtor(free_op2.var); } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -23398,14 +23394,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -23673,7 +23669,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; FREE_OP(free_op_data1); @@ -23720,7 +23716,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*binary_op)(zval *r break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -23786,7 +23782,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_op)(zval *resul (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -23922,7 +23918,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -23957,7 +23953,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND_ if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -24014,7 +24010,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; *retval = *EG(uninitialized_zval_ptr); @@ -24047,7 +24043,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t incdec_op, ZEND zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -24218,7 +24214,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -24389,7 +24385,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op2, free_op_data1; @@ -24481,7 +24477,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -24590,20 +24586,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -24613,7 +24609,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -24644,15 +24640,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -24663,7 +24659,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -24786,21 +24782,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN zend_free_op free_op2; zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -24862,7 +24858,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN break; } if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -24876,30 +24872,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } else { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -24911,14 +24907,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; } @@ -24952,7 +24948,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -24999,7 +24995,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -25065,7 +25061,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *re (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -25242,7 +25238,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -25305,20 +25301,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -25328,7 +25324,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -25594,7 +25590,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re make_real_object(object_ptr TSRMLS_CC); object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to assign property of non-object"); FREE_OP(free_op_data1); @@ -25641,7 +25637,7 @@ static int zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binary_op)(zval *re break; } if (z) { - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -25707,7 +25703,7 @@ static int zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op)(zval *result (*object_ptr)->refcount++; /* undo the effect of get_obj_zval_ptr_ptr() */ } - if ((*object_ptr)->type == IS_OBJECT) { + if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } else { zend_op *op_data = opline+1; @@ -25842,7 +25838,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); if (!RETURN_VALUE_UNUSED(&opline->result)) { @@ -25877,7 +25873,7 @@ static int zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_O if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -25934,7 +25930,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ object = *object_ptr; - if (object->type != IS_OBJECT) { + if (Z_TYPE_P(object) != IS_OBJECT) { zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); *retval = *EG(uninitialized_zval_ptr); @@ -25967,7 +25963,7 @@ static int zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t incdec_op, ZEND_ zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC); zval *z_copy; - if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) { + if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); if (z->refcount == 0) { @@ -26138,7 +26134,7 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CV(int type, ZEND_OPC } - if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { + if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval = EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); @@ -26309,7 +26305,7 @@ static int ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) object_ptr = NULL; } - if (object_ptr && (*object_ptr)->type == IS_OBJECT) { + if (object_ptr && Z_TYPE_PP(object_ptr) == IS_OBJECT) { zend_assign_to_object(&opline->result, object_ptr, &opline->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); } else { zend_free_op free_op_data1; @@ -26398,7 +26394,7 @@ static int ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) EX(object) = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC); - if (EX(object) && EX(object)->type == IS_OBJECT) { + if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { zend_error_noreturn(E_ERROR, "Object does not support method calls"); } @@ -26505,20 +26501,20 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } if (offset) { - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: case IS_UNICODE: - zend_u_symtable_update(array_ptr->value.ht, Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); + zend_u_symtable_update(Z_ARRVAL_P(array_ptr), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: - zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -26528,7 +26524,7 @@ static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); + zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { @@ -26559,15 +26555,15 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case IS_ARRAY: { HashTable *ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } zend_hash_index_del(ht, index); @@ -26578,7 +26574,7 @@ static int ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) int offset_len = Z_UNILEN_P(offset); int free_offset = 0; - if (UG(unicode) && ht == &EG(symbol_table) && offset->type == IS_UNICODE) { + if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; int32_t norm_len; @@ -26701,21 +26697,21 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); - if ((*container)->type == IS_ARRAY) { + if (Z_TYPE_PP(container) == IS_ARRAY) { HashTable *ht; int isset = 0; - ht = (*container)->value.ht; + ht = Z_ARRVAL_PP(container); - switch (offset->type) { + switch (Z_TYPE_P(offset)) { case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { - index = (long) offset->value.dval; + if (Z_TYPE_P(offset) == IS_DOUBLE) { + index = (long) Z_DVAL_P(offset); } else { - index = offset->value.lval; + index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { isset = 1; @@ -26777,7 +26773,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND break; } - } else if ((*container)->type == IS_OBJECT) { + } else if (Z_TYPE_PP(container) == IS_OBJECT) { if (0) { MAKE_REAL_ZVAL_PTR(offset); } @@ -26791,30 +26787,30 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } else { } - } else if (((*container)->type == IS_STRING || - (*container)->type == IS_UNICODE) && !prop_dim) { /* string offsets */ + } else if ((Z_TYPE_PP(container) == IS_STRING || + Z_TYPE_PP(container) == IS_UNICODE) && !prop_dim) { /* string offsets */ zval tmp; - if (offset->type != IS_LONG) { + if (Z_TYPE_P(offset) != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); offset = &tmp; } - if (offset->type == IS_LONG) { + if (Z_TYPE_P(offset) == IS_LONG) { switch (opline->extended_value) { case ZEND_ISSET: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container)) { + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container)) { result = 1; } break; case ZEND_ISEMPTY: - if (offset->value.lval >= 0 && - offset->value.lval < Z_UNILEN_PP(container) && + if (Z_LVAL_P(offset) >= 0 && + Z_LVAL_P(offset) < Z_UNILEN_PP(container) && ((Z_TYPE_PP(container) == IS_UNICODE)? - (Z_USTRVAL_PP(container)[offset->value.lval] != 0): - (Z_STRVAL_PP(container)[offset->value.lval] != '0'))) { + (Z_USTRVAL_PP(container)[Z_LVAL_P(offset)] != 0): + (Z_STRVAL_PP(container)[Z_LVAL_P(offset)] != '0'))) { result = 1; } break; @@ -26826,14 +26822,14 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } } - EX_T(opline->result.u.var).tmp_var.type = IS_BOOL; + Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; switch (opline->extended_value) { case ZEND_ISSET: - EX_T(opline->result.u.var).tmp_var.value.lval = result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; break; case ZEND_ISEMPTY: - EX_T(opline->result.u.var).tmp_var.value.lval = !result; + Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; break; }