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();
convert_to_string(expr_copy);
break;
}
- expr_copy->type = IS_STRING;
+ Z_TYPE_P(expr_copy) = IS_STRING;
*use_copy = 1;
}
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) {
}
break;
}
- expr_copy->type = IS_STRING;
+ Z_TYPE_P(expr_copy) = IS_STRING;
*use_copy = 1;
}
{
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;
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;
convert_to_unicode(expr_copy);
break;
}
- expr_copy->type = IS_UNICODE;
+ Z_TYPE_P(expr_copy) = IS_UNICODE;
*use_copy = 1;
}
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:
{
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:
{
/* 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);
# 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);
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);
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); \
#define ZEND_INTERNAL_ENCODING "UTF-16"
+#include "zend_operators.h"
#include "zend_variables.h"
#define ZEND_U_EQUAL(type, ustr, ulen, str, slen) \
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;
}
{
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;
}
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 {
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;
}
{
int retval;
char *lcname, *lmname, *mname, *colon;
- int clen, mlen;
+ unsigned int clen, mlen;
zend_function *fptr;
zend_class_entry **pce;
HashTable *ftable;
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;
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);
#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)
#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) \
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) \
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) \
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) \
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) \
#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) { \
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
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"
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");
*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);
}
}
/* }}} */
ZEND_NAMED_FUNCTION(zend_if_strlen)
{
zval **str;
-
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
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;
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;
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;
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();
}
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 */
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);
}
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) {
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;
break;
}
- switch ((*val)->type) {
+ switch (Z_TYPE_PP(val)) {
case IS_LONG:
case IS_DOUBLE:
case IS_STRING:
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 */
{
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);
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);
zend_class_entry *ce = NULL;
char *name;
zend_uint name_length;
-
+
if (!ZEND_NUM_ARGS()) {
ce = EG(scope);
if (ce && ce->parent) {
}
} 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;
}
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;
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);
}
}
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) {
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))
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);
}
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();
}
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);
RETURN_FALSE;
}
- switch((*object)->type) {
+ switch(Z_TYPE_PP(object)) {
case IS_STRING:
case IS_UNICODE:
if (!Z_UNILEN_PP(object)) {
}
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;
}
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));
}
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);
/* }}} */
-/* {{{ proto bool function_exists(string function_name)
+/* {{{ proto bool function_exists(string function_name)
Checks if the function exists */
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();
}
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);
/*
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);
}
/* }}} */
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:
}
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));
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;
}
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))) {
{
zend_uint mask = ZEND_ACC_INTERFACE;
zend_uint comply = 1;
-
+
if (ZEND_NUM_ARGS() != 0) {
ZEND_WRONG_PARAM_COUNT();
}
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;
add_next_index_unicodel(user_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1);
}
}
-
+
return 0;
}
{
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;
}
/* {{{ 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 *));
}
/* }}} */
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) {
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);
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);
}
}
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 &&
} 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;
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;
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;
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;
}
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;
} 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);
}
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;
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;
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;
}
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.
*/
add_next_index_zval(return_value, stack_frame);
- include_filename = filename;
+ include_filename = filename;
ptr = skip->prev_execute_data;
}
if (ZEND_NUM_ARGS()) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
zend_fetch_debug_backtrace(return_value, 1, 1 TSRMLS_CC);
}
/* }}} */
RETURN_FALSE;
}
efree(lcname);
-
+
if (!(func = module->functions)) {
RETURN_FALSE;
}
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;
}
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;
}
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)) &&
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;
}
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;
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));
}
}
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;
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;
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));
}
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;
}
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));
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) {
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;
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)
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) {
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);
}
}
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;
}
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) {
*property = value->u.constant;
} else {
INIT_PZVAL(property);
- property->type = IS_NULL;
+ Z_TYPE_P(property) = IS_NULL;
}
if (CG(doc_comment)) {
}
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));
}
*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) {
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 */
} else {
*result = *constant_name;
}
- result->u.constant.type = IS_CONSTANT;
+ Z_TYPE(result->u.constant) = IS_CONSTANT;
break;
case ZEND_RT:
{
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);
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);
}
}
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;
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);
zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC);
zend_do_normalization(variable, variable TSRMLS_CC);
- for (i=1; i<num_references->u.constant.value.lval; i++) {
+ for (i=1; i<Z_LVAL(num_references->u.constant); i++) {
fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC);
zend_do_normalization(variable, result TSRMLS_CC);
}
} 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");
}
/*
* 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);
}
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;
}
}
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;
}
}
}
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)
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;
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:
retval = T_ECHO;
break;
case T_END_HEREDOC:
- efree(zendlval->u.constant.value.str.val);
+ efree(Z_STRVAL(zendlval->u.constant));
break;
}
{
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);
}
}
{
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;
{
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;
{
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;
}
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);
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;
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));
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)
Exception constructor */
ZEND_METHOD(exception, __construct)
{
- char *message = NULL;
+ void *message = NULL;
long code = 0;
zval *object;
int argc = ZEND_NUM_ARGS(), message_len;
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;
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;
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);
{
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");
}
#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;
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; \
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;
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);
}
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)) {
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) {
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);
}
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; i<T->str_offset.offset; i++) {
- T->str_offset.str->value.str.val[i] = ' ';
+ for (i=Z_STRLEN_P(T->str_offset.str); i<T->str_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);
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) {
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;
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; i<T->str_offset.offset; i++) {
- T->str_offset.str->value.ustr.val[i] = 0x20; /* ' ' */
+ for (i=Z_USTRLEN_P(T->str_offset.str); i<T->str_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);
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) {
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--;
}
*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);
}
}
*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);
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) {
}
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) {
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:
}
}
- switch (container->type) {
+ switch (Z_TYPE_P(container)) {
zval **retval;
case IS_ARRAY:
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;
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);
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);
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");
}
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:
}
}
- 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);
#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;
{
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)) {
/* 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);
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);
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)) {
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;
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;
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;
}
}
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;
}
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)) {
*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;
}
}
- 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));
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;
zend_printf("<code>");
zend_printf("<span style=\"color: %s\">\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:
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;
}
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:
} 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("</span>\n");
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:
/* lack of break; is intentional */
case T_COMMENT:
case T_DOC_COMMENT:
- token.type = 0;
+ Z_TYPE(token) = 0;
continue;
case EOF:
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:
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:
break;
}
}
- prev_space = token.type = 0;
+ prev_space = Z_TYPE(token) = 0;
}
}
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; i<LANG_SCNG(yy_leng); i++) {
emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
in_string = !in_string;
/* break missing intentionally */
default:
- if (token.type==0) {
+ if (Z_TYPE(token)==0) {
/* keyword */
switch (token_type) {
case ',':
}
break;
}
- if (token.type == IS_STRING) {
+ if (Z_TYPE(token) == IS_STRING) {
switch (token_type) {
case T_OPEN_TAG:
case T_CLOSE_TAG:
case T_WHITESPACE:
break;
default:
- efree(token.value.str.val);
+ efree(Z_STRVAL(token));
break;
}
}
- token.type = 0;
+ Z_TYPE(token) = 0;
}
}
}
if ((zend_get_configuration_directive(p->name, 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;
}
}
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;
}
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)
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;
}
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);
}
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();
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'
;
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(&$$); }
;
}
<INITIAL>[ ]*("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;
}
<INITIAL>[ ]*("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;
}
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;
}
/* 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;
}
}
<INITIAL>"}" {
- ini_lval->value.lval = (long) yytext[0];
+ Z_LVAL_P(ini_lval) = (long) yytext[0];
return yytext[0];
}
}
}
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 */
}
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:
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;
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);
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;
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;
}
| 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 |
/* $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.
- *
+ *
*/
| 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)); }
| 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 */
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); }
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
;
-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:
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:
| 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; }
;
| 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); }
| 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); }
| 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); }
| 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); }
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 ')'
;
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; }
;
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; }
;
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; }
| 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; }
;
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:
| 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); }
;
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); }
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;
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;
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;
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);
}
/* 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);
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)
{
}
/* 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 (s<end) {
if (*s==0x5C /*'\\'*/) {
s++;
switch(c) {
case 0x6E: /*'n'*/
*t++ = (UChar) 0x0A; /*'\n'*/
- zendlval->value.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;
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);
&& (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;
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 {
}
/* 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 (s<end) {
if (*s==0x5C /*'\\'*/) {
s++;
case 0x5C: /*'\\'*/
case 0x27: /*'\''*/
*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;
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;
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;
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 (s<end) {
if (*s=='\\') {
s++;
switch(*s) {
case 'n':
*t++ = '\n';
- zendlval->value.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 */
char octal_buf[4] = { 0, 0, 0, 0 };
octal_buf[0] = *s;
- zendlval->value.str.len--;
+ Z_STRLEN_P(zendlval)--;
if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
octal_buf[1] = *(++s);
- zendlval->value.str.len--;
+ Z_STRLEN_P(zendlval)--;
if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
octal_buf[2] = *(++s);
- zendlval->value.str.len--;
+ Z_STRLEN_P(zendlval)--;
}
}
*t++ = (char) strtol(octal_buf, NULL, 8);
} else if (*s=='x' && (s+1)<end && ZEND_IS_HEX(*(s+1))) {
char hex_buf[3] = { 0, 0, 0};
- zendlval->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)<end && ZEND_IS_HEX(*(s+1))) {
hex_buf[1] = *(++s);
- zendlval->value.str.len--;
+ Z_STRLEN_P(zendlval)--;
}
*t++ = (char) strtol(hex_buf, NULL, 16);
} else {
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 (s<end) {
if (*s=='\\') {
s++;
case '\\':
case '\'':
*t++ = *s;
- zendlval->value.str.len--;
+ Z_STRLEN_P(zendlval)--;
break;
default:
*t++ = '\\';
<ST_IN_SCRIPTING>{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;
}
}
<ST_IN_SCRIPTING>{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;
}
}
<ST_IN_SCRIPTING>{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;
}
} 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);
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;
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;
}
<ST_IN_SCRIPTING>"__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;
}
}
<INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" {
- 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;
HANDLE_NEWLINES(yytext, yyleng);
return T_INLINE_HTML;
}
<INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" {
HANDLE_NEWLINES(yytext, yyleng);
if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */
- 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;
}
}
<INITIAL>"<%="|"<?=" {
if ((yytext[1]=='%' && CG(asp_tags)) || (yytext[1]=='?' && CG(short_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_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;
}
}
<INITIAL>"<%" {
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;
}
}
<INITIAL>"<?php"([ \t]|{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;
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
<ST_IN_SCRIPTING>{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;
}
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;
}
}
<ST_ONE_LINE_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;
<ST_ONE_LINE_COMMENT>"?>"|"%>" {
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;
}
<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){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 */
}
<ST_IN_SCRIPTING>"%>"{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);
}
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;
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
- zendlval->value.lval = (long) yytext[0];
+ Z_LVAL_P(zendlval) = (long) yytext[0];
if (yyleng == 2) {
yyless(1);
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ENCAPSED_TOKENS} {
- zendlval->value.lval = (long) yytext[0];
+ Z_LVAL_P(zendlval) = (long) yytext[0];
return yytext[0];
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
- 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;
<ST_DOUBLE_QUOTES>"\\\"" {
- zendlval->value.lval = (long) '"';
+ Z_LVAL_P(zendlval) = (long) '"';
return T_CHARACTER;
}
<ST_BACKQUOTE>"\\`" {
- zendlval->value.lval = (long) '`';
+ Z_LVAL_P(zendlval) = (long) '`';
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.lval = strtol(yytext+1, NULL, 8);
+ Z_LVAL_P(zendlval) = strtol(yytext+1, NULL, 8);
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\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;
}
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);
/* 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);
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{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)) {
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;
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;
}
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);
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);
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);
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);
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);
/* 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);
}
} 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)) {
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);
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);
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;
}
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.
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++;
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);
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;
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);
{
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);
}
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); \
} \
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; \
#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)); \
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); \
}
#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)); \
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); \
}
"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 { \
{
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:
{
convert_object_to_type(op, IS_LONG, convert_to_long);
- if (op->type == IS_LONG) {
+ if (Z_TYPE_P(op) == IS_LONG) {
return;
}
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;
}
{
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:
{
convert_object_to_type(op, IS_DOUBLE, convert_to_double);
- if (op->type == IS_DOUBLE) {
+ if (Z_TYPE_P(op) == IS_DOUBLE) {
return;
}
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();
}
zval_dtor(op);
- op->type = IS_NULL;
+ Z_TYPE_P(op) = IS_NULL;
}
{
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:
{
convert_object_to_type(op, IS_BOOL, convert_to_boolean);
- if (op->type == IS_BOOL) {
+ if (Z_TYPE_P(op) == IS_BOOL) {
return;
}
}
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;
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:
ZVAL_BOOL(op, 0);
break;
}
- op->type = IS_UNICODE;
+ Z_TYPE_P(op) = IS_UNICODE;
}
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;
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:
ZVAL_BOOL(op, 0);
break;
}
- op->type = IS_STRING;
+ Z_TYPE_P(op) = IS_STRING;
}
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:
{
{
TSRMLS_FETCH();
- switch (op->type) {
+ switch (Z_TYPE_P(op)) {
case IS_ARRAY:
return;
break;
} 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);
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;
}
{
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)) {
*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");
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");
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");
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");
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;
}
{
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;
}
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;
}
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;
}
{
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 {
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;
}
{
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 {
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;
}
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;
}
{
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 {
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;
}
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;
}
{
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;
}
{
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;
}
/* 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;
}
/* 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;
}
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;
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) {
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);
{
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);
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);
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;
}
{
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) {
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
*/
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.lval<op2->value.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)<Z_LVAL_P(op2)?-1:0);
COMPARE_RETURN_AND_FREE(SUCCESS);
}
- if ((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);
}
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:
/* 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:
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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';
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:
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;
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)
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));
}
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;
}
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) {
}
}
- 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) {
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)
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);
}
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); \
}
} 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); \
}
#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); \
} \
#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)
* directly -- and assumed always to succeed.
*/
-#include <zend_strtod.h>
+#include <zend.h>
#include <unicode/utypes.h>
#include <unicode/ustdio.h>
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();
}
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;
TSRMLS_FETCH();
/* destroy resource */
- zend_list_delete(zvalue->value.lval);
+ zend_list_delete(Z_LVAL_P(zvalue));
}
break;
case IS_LONG:
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();
}
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:
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:
}
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:
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);
}
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);
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
{
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;
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 {
{
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);
}
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);
}
- 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);
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);
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();
}
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;
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);
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);
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;
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;
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");
}
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);
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 */
{
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;
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);
{
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;
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();
/* 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;
}
/* 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);
}
}
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");
}
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();
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);
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;
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);
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;
}
}
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();
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);
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);
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;
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()
}
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);
}
}
- 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;
}
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;
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);
}
} 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;
}
}
- 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;
}
{
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;
}
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);
{
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();
}
/* 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);
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;
{
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;
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);
{
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;
}
}
/* 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);
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;
{
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;
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;
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;
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;
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;
{
zend_op *opline = EX(opline);
- zval z_copy;
zval *z = &opline->op1.u.constant;
UErrorCode status = U_ZERO_ERROR;
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 {
{
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);
}
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);
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);
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);
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);
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 */
/* 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();
}
/* 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;
}
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);
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;
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);
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;
}
}
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;
}
}
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);
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);
}
}
- 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;
}
{
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();
/* 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);
}
}
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");
}
} 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 (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");
}
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 (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");
}
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 (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");
}
} 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 (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");
}
} 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) {
{
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;
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 {
{
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);
}
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);
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);
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);
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);
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 */
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();
/* 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;
}
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);
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;
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);
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;
}
}
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);
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);
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);
}
}
- 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;
}
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);
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);
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);
}
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");
}
}
}
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");
}
} 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) {
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");
}
}
}
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");
}
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) {
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");
}
}
}
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");
}
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 (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");
}
} 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) {
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");
}
}
}
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");
}
} 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) {
{
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;
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 {
{
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);
}
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);
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);
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);
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);
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 */
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();
/* 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;
}
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);
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;
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);
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;
}
}
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);};
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);
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()
}
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);
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
} 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);};
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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);};
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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);};
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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;
}
}
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");
}
} 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);};
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
} 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);};
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}
/* 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
/* 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);
}
}
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");
}
} 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) {
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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) {
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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) {
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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;
}
}
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");
}
} 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) {
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
} 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) {
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}
{
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;
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 {
{
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);
}
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);
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);
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);
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);
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 */
/* 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();
}
/* 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;
}
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);
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;
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);
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;
}
}
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;
}
}
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);
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);
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
} 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) {
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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) {
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
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) {
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);
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;
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;
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);
}
} 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;
}
}
- 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;
}
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);
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) {
(*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;
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;
}
}
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");
}
} 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) {
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);
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) {
(*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;
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)) {
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) {
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);
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) {
}
- 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);
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;
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");
}
}
}
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");
}
} 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) {
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);
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;
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;
break;
}
- } else if ((*container)->type == IS_OBJECT) {
+ } else if (Z_TYPE_PP(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
} 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;
}
}
- 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;
}