diff --git a/Zend/zend.c b/Zend/zend.c index c7564daa479..2df674a8d58 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -236,14 +236,14 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop again: switch (Z_TYPE_P(expr)) { case IS_NULL: - Z_STR_P(expr_copy) = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(expr_copy); break; case IS_BOOL: if (Z_LVAL_P(expr)) { // TODO: ??? use interned string - Z_STR_P(expr_copy) = STR_INIT("1", 1, 0); + ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0)); } else { - Z_STR_P(expr_copy) = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(expr_copy); } break; case IS_RESOURCE: { @@ -251,13 +251,13 @@ again: int len; len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(expr)); - Z_STR_P(expr_copy) = STR_INIT(buf, len, 0); + ZVAL_NEW_STR(expr_copy, STR_INIT(buf, len, 0)); } break; case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); // TODO: ??? use interned string - Z_STR_P(expr_copy) = STR_INIT("Array", sizeof("Array") - 1, 0); + ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0)); break; case IS_OBJECT: { @@ -293,7 +293,7 @@ again: zval_ptr_dtor(z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name->val); - Z_STR_P(expr_copy) = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(expr_copy); } break; case IS_DOUBLE: @@ -314,7 +314,6 @@ again: convert_to_string(expr_copy); break; } - Z_TYPE_P(expr_copy) = IS_STRING; *use_copy = 1; } /* }}} */ @@ -1165,7 +1164,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ #endif va_copy(usr_copy, args); len = zend_vspprintf(&str, 0, format, usr_copy); - ZVAL_STR(¶ms[1], STR_INIT(str, len, 0)); + ZVAL_NEW_STR(¶ms[1], STR_INIT(str, len, 0)); efree(str); #ifdef va_copy va_end(usr_copy); diff --git a/Zend/zend.h b/Zend/zend.h index cae486a324e..d8c14f0a076 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -653,7 +653,7 @@ END_EXTERN_C() zval *_z1 = (z); \ zval *_z2 = (v); \ (_z1)->value = (_z2)->value; \ - Z_TYPE_P(_z1) = Z_TYPE_P(_z2); \ + Z_TYPE_INFO_P(_z1) = Z_TYPE_INFO_P(_z2); \ } while (0) #define ZVAL_COPY(z, v) \ @@ -707,7 +707,6 @@ END_EXTERN_C() ZEND_ASSERT(Z_ISREF_P(_z)); \ ref = Z_REF_P(_z); \ ZVAL_COPY_VALUE(_z, &ref->val); \ - GC_REMOVE_FROM_BUFFER(ref); \ efree(ref); \ } while (0) @@ -719,55 +718,55 @@ END_EXTERN_C() Z_UNSET_ISREF_P(z); \ } while (0) -// TODO: support objects and resources in more optimal way ??? -#define SEPARATE_ZVAL(zv) do { \ - zval *_zv = (zv); \ - if (Z_REFCOUNTED_P(_zv)) { \ - if (Z_REFCOUNT_P(_zv) > 1) { \ - if (Z_ISREF_P(_zv)) { \ - Z_DELREF_P(_zv); \ - ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \ - } else if (Z_TYPE_P(_zv) != IS_OBJECT &&\ - Z_TYPE_P(_zv) != IS_RESOURCE) { \ - Z_DELREF_P(_zv); \ - zval_copy_ctor(_zv); \ - } \ - } \ - } \ +#define SEPARATE_ZVAL(zv) do { \ + zval *_zv = (zv); \ + if (Z_REFCOUNTED_P(_zv)) { \ + if (Z_REFCOUNT_P(_zv) > 1) { \ + if (Z_ISREF_P(_zv)) { \ + Z_DELREF_P(_zv); \ + ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \ + } else if (Z_TYPE_FLAGS_P(_zv) & IS_TYPE_COPYABLE) { \ + Z_DELREF_P(_zv); \ + zval_copy_ctor_func(_zv); \ + } \ + } \ + } \ } while (0) -#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \ - zval *__zv = (zv); \ - if (!Z_ISREF_P(__zv)) { \ - SEPARATE_ZVAL(__zv); \ - } \ +#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \ + zval *_zv = (zv); \ + if (!Z_ISREF_P(_zv) && \ + (Z_TYPE_FLAGS_P(_zv) & IS_TYPE_COPYABLE) && \ + Z_REFCOUNT_P(_zv) > 1) { \ + Z_DELREF_P(_zv); \ + zval_copy_ctor_func(_zv); \ + } \ } while (0) -#define SEPARATE_ZVAL_IF_REF(zv) do { \ - zval *__zv = (zv); \ - if (Z_ISREF_P(__zv)) { \ - if (Z_REFCOUNT_P(__zv) == 1) { \ - ZVAL_UNREF(__zv); \ - } else { \ - Z_DELREF_P(__zv); \ - ZVAL_DUP(__zv, Z_REFVAL_P(__zv)); \ - } \ - } \ +#define SEPARATE_ZVAL_IF_REF(zv) do { \ + zval *__zv = (zv); \ + if (Z_ISREF_P(__zv)) { \ + if (Z_REFCOUNT_P(__zv) == 1) { \ + ZVAL_UNREF(__zv); \ + } else { \ + Z_DELREF_P(__zv); \ + ZVAL_DUP(__zv, Z_REFVAL_P(__zv)); \ + } \ + } \ } while (0) -#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) do { \ - zval *__zv = (zv); \ - if (!Z_ISREF_P(__zv)) { \ - if (!Z_REFCOUNTED_P(__zv) || \ - Z_REFCOUNT_P(__zv) == 1) { \ - ZVAL_NEW_REF(__zv, __zv); \ - } else { \ - zval ref; \ - ZVAL_COPY_VALUE(&ref, __zv); \ - SEPARATE_ZVAL(&ref); \ - ZVAL_NEW_REF(__zv, &ref); \ - } \ - } \ +#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) do { \ + zval *__zv = (zv); \ + if (!Z_ISREF_P(__zv)) { \ + if (!(Z_TYPE_FLAGS_P(__zv) & IS_TYPE_COPYABLE) || \ + Z_REFCOUNT_P(__zv) == 1) { \ + ZVAL_NEW_REF(__zv, __zv); \ + } else { \ + Z_DELREF_P(__zv); \ + ZVAL_NEW_REF(__zv, __zv); \ + zval_copy_ctor_func(Z_REFVAL_P(__zv)); \ + } \ + } \ } while (0) #define COPY_PZVAL_TO_ZVAL(zv, pzv) \ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index d0cd63edcfc..4c100a55d4c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -285,7 +285,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR Z_ADDREF_P(z); if(Z_TYPE_P(z) != IS_OBJECT) { zval_dtor(arg); - Z_TYPE_P(arg) = IS_NULL; + ZVAL_NULL(arg); zend_make_printable_zval(z, arg, &use_copy); if (!use_copy) { ZVAL_ZVAL(arg, z, 1, 1); @@ -325,7 +325,7 @@ static int parse_arg_object_to_str(zval *arg, zend_string **str, int type TSRMLS Z_ADDREF_P(z); if(Z_TYPE_P(z) != IS_OBJECT) { zval_dtor(arg); - Z_TYPE_P(arg) = IS_NULL; + ZVAL_NULL(arg); zend_make_printable_zval(z, arg, &use_copy); if (!use_copy) { ZVAL_ZVAL(arg, z, 1, 1); @@ -1112,7 +1112,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */ { ZVAL_DEREF(pp); - if (IS_CONSTANT_TYPE(Z_TYPE_P(pp))) { + if (Z_TYPE_FLAGS_P(pp) & IS_TYPE_CONSTANT) { zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); if ((*scope)->parent) { @@ -3670,7 +3670,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name { zval property; - ZVAL_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); } /* }}} */ @@ -3679,7 +3679,7 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *nam { zval property; - ZVAL_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); } /* }}} */ @@ -3731,7 +3731,7 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha { zval constant; - ZVAL_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC); } /* }}} */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0668d230d8c..a8bb4f3ff04 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -548,7 +548,7 @@ END_EXTERN_C() #define CHECK_NULL_PATH(p, l) (strlen(p) != l) #define ZVAL_STRINGL(z, s, l) do { \ - ZVAL_STR(z, STR_INIT(s, l, 0)); \ + ZVAL_NEW_STR(z, STR_INIT(s, l, 0)); \ } while (0) #define ZVAL_STRING(z, s) do { \ @@ -557,11 +557,11 @@ END_EXTERN_C() } while (0) #define ZVAL_EMPTY_STRING(z) do { \ - ZVAL_STR(z, STR_EMPTY_ALLOC()); \ + ZVAL_INT_STR(z, STR_EMPTY_ALLOC()); \ } while (0) #define ZVAL_PSTRINGL(z, s, l) do { \ - ZVAL_STR(z, STR_INIT(s, l, 1)); \ + ZVAL_NEW_STR(z, STR_INIT(s, l, 1)); \ } while (0) #define ZVAL_PSTRING(z, s) do { \ @@ -601,6 +601,8 @@ END_EXTERN_C() #define RETVAL_LONG(l) ZVAL_LONG(return_value, l) #define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d) #define RETVAL_STR(s) ZVAL_STR(return_value, s) +#define RETVAL_INT_STR(s) ZVAL_INT_STR(return_value, s) +#define RETVAL_NEW_STR(s) ZVAL_NEW_STR(return_value, s) #define RETVAL_STRING(s) ZVAL_STRING(return_value, s) #define RETVAL_STRINGL(s, l) ZVAL_STRINGL(return_value, s, l) #define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value) @@ -614,6 +616,8 @@ END_EXTERN_C() #define RETURN_LONG(l) { RETVAL_LONG(l); return; } #define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; } #define RETURN_STR(s) { RETVAL_STR(s); return; } +#define RETURN_INT_STR(s) { RETVAL_INT_STR(s); return; } +#define RETURN_NEW_STR(s) { RETVAL_NEW_STR(s); return; } #define RETURN_STRING(s) { RETVAL_STRING(s); return; } #define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; } #define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; } diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index e9c61005937..0c004dcbe31 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -136,8 +136,8 @@ inline static void * __zend_realloc(void *p, size_t len) #define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size))) #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s)) -#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC()) -#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC()) +//???#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC()) +//???#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC()) ZEND_API int zend_set_memory_limit(size_t memory_limit TSRMLS_DC); diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index d6cb253b56a..d144a1e6d3f 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -67,7 +67,7 @@ ZEND_API int zend_ast_is_ct_constant(zend_ast *ast) int i; if (ast->kind == ZEND_CONST) { - return !IS_CONSTANT_TYPE(Z_TYPE(ast->u.val)); + return !(Z_TYPE_FLAGS(ast->u.val) & IS_TYPE_CONSTANT); } else { for (i = 0; i < ast->children; i++) { if ((&ast->u.child)[i]) { @@ -223,7 +223,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s break; case ZEND_CONST: ZVAL_DUP(result, &ast->u.val); - if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) { + if (Z_TYPE_FLAGS_P(result) & IS_TYPE_CONSTANT) { zval_update_constant_ex(result, (void *) 1, scope TSRMLS_CC); } break; diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 3777b35e5c8..48007ba9c8f 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -937,7 +937,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value /* this is necessary to make it able to work with default array * properties, returned to user */ - if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) { + if (Z_TYPE_FLAGS(prop_copy) & IS_TYPE_CONSTANT) { zval_update_constant(&prop_copy, 0 TSRMLS_CC); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1ab74aba004..a132fc4a150 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -165,7 +165,7 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i } /* NULL, name length, filename length, last accepting char position length */ - ZVAL_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0)); + ZVAL_NEW_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0)); /* must be binary safe */ Z_STRVAL_P(result)[0] = '\0'; @@ -347,6 +347,9 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { STR_HASH_VAL(Z_STR_P(zv)); Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv) TSRMLS_CC); + if (IS_INTERNED(Z_STR_P(zv))) { + Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } } ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv); //??? Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2); @@ -402,7 +405,7 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0); zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - ZVAL_STR(&c, lc_name); + ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); return ret; @@ -428,7 +431,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0); zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - ZVAL_STR(&c, lc_name); + ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)); @@ -438,7 +441,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); lc_name = STR_ALLOC(lc_len, 0); zend_str_tolower_copy(lc_name->val, ns_separator, lc_len); - ZVAL_STR(&c, lc_name); + ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); } @@ -468,7 +471,7 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0); zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); } - ZVAL_STR(&c, lc_name); + ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); GET_CACHE_SLOT(ret); @@ -514,13 +517,13 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq /* lowercased namespace name & original constant name */ tmp_name = STR_INIT(name, name_len, 0); zend_str_tolower(tmp_name->val, ns_len); - ZVAL_STR(&c, tmp_name); + ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); /* lowercased namespace name & lowercased constant name */ tmp_name = STR_ALLOC(name_len, 0); zend_str_tolower_copy(tmp_name->val, name, name_len); - ZVAL_STR(&c, tmp_name); + ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); } @@ -535,13 +538,13 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq /* original constant name */ tmp_name = STR_INIT(name, name_len, 0); - ZVAL_STR(&c, tmp_name); + ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); /* lowercased constant name */ tmp_name = STR_ALLOC(name_len, 0); zend_str_tolower_copy(tmp_name->val, name, name_len); - ZVAL_STR(&c, tmp_name); + ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); return ret; @@ -1936,6 +1939,9 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ zend_resolve_class_name(class_type TSRMLS_CC); } Z_STR(class_type->u.constant) = zend_new_interned_string(Z_STR(class_type->u.constant) TSRMLS_CC); + if (IS_INTERNED(Z_STR(class_type->u.constant))) { + Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } //???: for now we have to copy it :( #if 1 cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant)); @@ -2165,6 +2171,7 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { tmp = *element_name; Z_STR(tmp.u.constant) = STR_ALLOC(sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN(CG(current_namespace)), 0); + Z_TYPE_FLAGS(tmp.u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace))); memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace))]), "\\", sizeof("\\")-1); memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1); @@ -2250,6 +2257,7 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ Z_STR(class_name->u.constant) = STR_REALLOC( Z_STR(class_name->u.constant), Z_STRLEN(class_name->u.constant) - 1, 0); + Z_TYPE_FLAGS(class_name->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); @@ -2400,7 +2408,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 opline->op1.opline_num = dest->opline_num; zval_dtor(label); - Z_TYPE_P(label) = IS_NULL; + ZVAL_NULL(label); /* Check that we are not moving into loop or switch */ current = opline->extended_value; @@ -2475,6 +2483,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int old_len = Z_STRLEN(result->u.constant); length = sizeof("::")-1 + old_len + Z_STRLEN(name->u.constant); Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0); + Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; memcpy(&Z_STRVAL(result->u.constant)[old_len], "::", sizeof("::")-1); memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); STR_RELEASE(Z_STR(name->u.constant)); @@ -2482,6 +2491,7 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c int old_len = Z_STRLEN(result->u.constant); length = sizeof("\\")-1 + old_len + Z_STRLEN(name->u.constant); Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0); + Z_TYPE_FLAGS(result->u.constant) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; memcpy(&Z_STRVAL(result->u.constant)[old_len], "\\", sizeof("\\")-1); memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); STR_RELEASE(Z_STR(name->u.constant)); @@ -5441,6 +5451,9 @@ void zend_do_declare_property(znode *var_name, const znode *value, zend_uint acc } Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC); + if (IS_INTERNED(Z_STR(var_name->u.constant))) { + Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC); //??? efree(Z_STRVAL(var_name->u.constant)); STR_RELEASE(Z_STR(var_name->u.constant)); @@ -5463,6 +5476,9 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D ZVAL_COPY_VALUE(&property, &value->u.constant); Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC); + if (IS_INTERNED(Z_STR(var_name->u.constant))) { + Z_TYPE_FLAGS(var_name->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } if (zend_hash_add(&CG(active_class_entry)->constants_table, Z_STR(var_name->u.constant), &property) == NULL) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant)); } @@ -5656,7 +5672,7 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal if (all_internal_constants_substitution && (c->flags & CONST_PERSISTENT) && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION) && - !IS_CONSTANT_TYPE(Z_TYPE(c->value))) { + !(Z_TYPE_FLAGS(c->value) & IS_TYPE_CONSTANT)) { return c; } return NULL; @@ -5700,7 +5716,12 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con } zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); *result = *constant_container; - Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type; +//??? + Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX; + if (IS_INTERNED(Z_STR(result->u.constant))) { + Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } + Z_CONST_FLAGS(result->u.constant) = fetch_type; break; case ZEND_RT: if (constant_container->op_type == IS_CONST && @@ -5750,7 +5771,12 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con } *result = *constant_name; - Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type; +//??? + Z_TYPE_INFO(result->u.constant) = IS_CONSTANT_EX; + if (IS_INTERNED(Z_STR(result->u.constant))) { + Z_TYPE_FLAGS(result->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } + Z_CONST_FLAGS(result->u.constant) = fetch_type; break; case ZEND_RT: compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); @@ -5897,11 +5923,11 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode ZVAL_COPY_VALUE(&element, &expr->u.constant); if (offset) { - switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE(offset->u.constant)) { case IS_CONSTANT: //??? /* Ugly hack to denote that this value has a constant index */ Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT; - if (Z_TYPE(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) { + if (Z_CONST_FLAGS(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) { Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT_UNQUALIFIED; } //??? Z_TYPE(element) |= IS_CONSTANT_INDEX; @@ -6092,6 +6118,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen ZVAL_COPY_VALUE(&tmp, &static_assignment->u.constant); } else { ZVAL_NULL(&tmp); + Z_CONST_FLAGS(tmp) = 0; } if (!CG(active_op_array)->static_variables) { if (CG(active_op_array)->scope) { @@ -6150,7 +6177,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) value.op_type = IS_CONST; ZVAL_NULL(&value.u.constant); - Z_TYPE(value.u.constant) |= is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR; + Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR; //??? Z_SET_REFCOUNT_P(&value.u.constant, 1); //??? Z_UNSET_ISREF_P(&value.u.constant); @@ -6540,7 +6567,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ convert_to_long(&val->u.constant); CG(declarables).ticks = val->u.constant; } else if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRLEN(var->u.constant), "encoding", sizeof("encoding")-1)) { - if ((Z_TYPE(val->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + if (Z_TYPE(val->u.constant) == IS_CONSTANT) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use constants as encoding"); } @@ -6618,8 +6645,7 @@ void zend_do_exit(znode *result, const znode *message TSRMLS_DC) /* {{{ */ SET_UNUSED(opline->op2); result->op_type = IS_CONST; - Z_TYPE(result->u.constant) = IS_BOOL; - Z_LVAL(result->u.constant) = 1; + ZVAL_BOOL(&result->u.constant, 1); } /* }}} */ @@ -6887,7 +6913,8 @@ int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */ } again: - Z_TYPE(zendlval->u.constant) = IS_LONG; +//??? + Z_TYPE_INFO(zendlval->u.constant) = IS_LONG; retval = lex_scan(&zendlval->u.constant TSRMLS_CC); switch (retval) { case T_COMMENT: @@ -7333,7 +7360,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ znode tmp; tmp.op_type = IS_CONST; - ZVAL_STR(&tmp.u.constant, STR_ALLOC(Z_STRLEN(CG(current_namespace)), 0)); + ZVAL_NEW_STR(&tmp.u.constant, STR_ALLOC(Z_STRLEN(CG(current_namespace)), 0)); zend_str_tolower_copy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace))); zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC); *name = tmp; diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 03246e3cc61..c807b0a0449 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -206,7 +206,7 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch zend_constant c; //??? ZVAL_STRINGL(&c.value, strval, strlen, 0); - ZVAL_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT)); + ZVAL_NEW_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT)); c.flags = flags; c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index e661a64976a..c59dd9d9dd2 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -553,7 +553,7 @@ ZEND_METHOD(exception, getTraceAsString) str->val[str->len] = '\0'; - RETURN_STR(str); + RETURN_NEW_STR(str); } /* }}} */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a68716f8749..b0799ef1c3f 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -738,10 +738,12 @@ static inline int zend_assign_to_string_offset(zval *str_offset, zval *value, in if (offset >= Z_STRLEN_P(str)) { int old_len = Z_STRLEN_P(str); Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), offset + 1, 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len); Z_STRVAL_P(str)[offset+1] = 0; } else if (IS_INTERNED(Z_STR_P(str))) { Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; } if (Z_TYPE_P(value) != IS_STRING) { @@ -1223,7 +1225,6 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva case IS_STRING: { zval tmp; - zend_string *str; if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { switch(Z_TYPE_P(dim)) { @@ -1257,17 +1258,16 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); } - str = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(result); } else { zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[Z_LVAL_P(dim)]; if (CG(one_char_string)[c]) { - str = CG(one_char_string)[c]; + ZVAL_INT_STR(result, CG(one_char_string)[c]); } else { - str = STR_INIT(Z_STRVAL_P(container) + Z_LVAL_P(dim), 1, 0); + ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(container) + Z_LVAL_P(dim), 1, 0)); } } - ZVAL_STR(result, str); return; } break; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 6f1fc978938..6170607a4f7 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -72,11 +72,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC) { -//??? IS_CONSTANT_TYPE_MASK used only for some rare cases - zend_uchar type = Z_TYPE_P(zval_ptr) & IS_CONSTANT_TYPE_MASK; - - if (IS_REFCOUNTED(type) && - (type != IS_STRING || !IS_INTERNED(Z_STR_P(zval_ptr)))) { + if (Z_REFCOUNTED_P(zval_ptr)) { if (!Z_DELREF_P(zval_ptr)) { ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval)); _zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_CC); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 77ac0dc2cb0..a56b32a6f42 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -479,7 +479,7 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */ #define IS_VISITED_CONSTANT 0x080 //??? IS_CONSTANT_INDEX #define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) #define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT) -#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT +#define MARK_CONSTANT_VISITED(p) Z_TYPE_INFO_P(p) |= IS_VISITED_CONSTANT static void zval_deep_copy(zval *p) { @@ -500,7 +500,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope if (IS_CONSTANT_VISITED(p)) { zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p)); - } else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + } else if (Z_TYPE_P(p) == IS_CONSTANT) { int refcount; //??? zend_uchar is_ref; @@ -508,10 +508,10 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope MARK_CONSTANT_VISITED(p); - refcount = Z_REFCOUNT_P(p); + refcount = Z_REFCOUNTED_P(p) ? Z_REFCOUNT_P(p) : 1; //??? is_ref = Z_ISREF_P(p); - if (!zend_get_constant_ex(Z_STRVAL_P(p), Z_STRLEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { + if (!zend_get_constant_ex(Z_STRVAL_P(p), Z_STRLEN_P(p), &const_value, scope, Z_CONST_FLAGS_P(p) TSRMLS_CC)) { char *actual = Z_STRVAL_P(p); if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) { @@ -527,17 +527,19 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope //??? Z_STRVAL_P(p) = colon + 1; Z_STR_P(p) = STR_INIT(colon + 1, len, 0); } + Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; } else { zend_string *save = Z_STR_P(p); char *slash; int actual_len = Z_STRLEN_P(p); - if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { + if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { actual = slash + 1; actual_len -= (actual - Z_STRVAL_P(p)); if (inline_change) { zend_string *s = STR_INIT(actual, actual_len, 0); //??? STR_RELEASE(Z_STR_P(p)); Z_STR_P(p) = s; + Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; } } if (actual[0] == '\\') { @@ -549,7 +551,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope } --actual_len; } - if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) { + if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) { if (save->val[0] == '\\') { zend_error(E_ERROR, "Undefined constant '%s'", save->val + 1); } else { @@ -561,11 +563,14 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope save = NULL; } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - Z_TYPE_P(p) = IS_STRING; if (!inline_change) { ZVAL_STRINGL(p, actual, actual_len); - } else if (save && save->val != actual) { - STR_RELEASE(save); + } else { + Z_TYPE_INFO_P(p) = IS_INTERNED(Z_STR_P(p)) ? + IS_INTERNED_STRING_EX : IS_STRING_EX; + if (save && save->val != actual) { + STR_RELEASE(save); + } } } } else { @@ -585,7 +590,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope SEPARATE_ZVAL_IF_NOT_REF(p); - Z_TYPE_P(p) = IS_ARRAY; + Z_TYPE_INFO_P(p) = IS_ARRAY_EX; if (!inline_change) { HashTable *ht = Z_ARRVAL_P(p); ZVAL_NEW_ARR(p); @@ -1147,7 +1152,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s int retval; if (retval_ptr) { - ZVAL_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1)); + ZVAL_NEW_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1)); memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len); Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 5fbc3e58c3a..1b3e347ed0b 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -136,17 +136,9 @@ ZEND_API void gc_init(TSRMLS_D) ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC) { - if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) && - GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK && - GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) { - /* The given zval is a garbage that is going to be deleted by - * currently running GC */ - return; - } - GC_BENCH_INC(zval_possible_root); - if (GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK) { + if (EXPECTED(GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK)) { GC_SET_PURPLE(GC_INFO(ref)); if (!GC_ADDRESS(GC_INFO(ref))) { @@ -193,7 +185,7 @@ ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC) { gc_root_buffer *root; - if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) && + if (UNEXPECTED(/*GC_ADDRESS(GC_INFO(ref)) &&*/ GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK && GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) { /* The given zval is a garbage that is going to be deleted by @@ -675,16 +667,6 @@ ZEND_API int gc_collect_cycles(TSRMLS_D) zend_hash_destroy(&arr->ht); GC_REMOVE_FROM_BUFFER(arr); efree(arr); - } else if (GC_TYPE(p) == IS_REFERENCE) { - zend_reference *ref = (zend_reference*)p; - - GC_TYPE(ref) = IS_NULL; - if (EXPECTED(EG(objects_store).object_buckets != NULL) || - Z_TYPE(ref->val) != IS_OBJECT) { - zval_dtor(&ref->val); - } - GC_REMOVE_FROM_BUFFER(ref); - efree(ref); } current = GC_G(next_to_free); } diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index a7e8b64b25b..fcf9159b2eb 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -138,9 +138,9 @@ END_EXTERN_C() static zend_always_inline void gc_check_possible_root(zval *z TSRMLS_DC) { - if (Z_TYPE_P(z) == IS_OBJECT || Z_TYPE_P(z) == IS_ARRAY || - (Z_ISREF_P(z) && - (Z_TYPE_P(Z_REFVAL_P(z)) == IS_ARRAY || Z_TYPE_P(Z_REFVAL_P(z)) == IS_OBJECT))) { + ZVAL_DEREF(z); + if ((Z_TYPE_FLAGS_P(z) & IS_TYPE_COLLECTABLE) && + UNEXPECTED(!Z_GC_INFO_P(z))) { gc_possible_root(Z_COUNTED_P(z) TSRMLS_CC); } } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 0eb1f49ef93..21ff29c2be7 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1437,7 +1437,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, idx = pos ? (*pos) : ht->nInternalPointer; if (idx == INVALID_IDX) { - Z_TYPE_P(key) = IS_NULL; + ZVAL_NULL(key); } else { p = ht->arData + idx; if (p->key) { diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index e9bebf189f4..b65b16a93c8 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -102,7 +102,7 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2) int op1_len = Z_STRLEN_P(op1); int length = op1_len + Z_STRLEN_P(op2); - ZVAL_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1)); + ZVAL_NEW_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1)); memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2)); Z_STRVAL_P(result)[length] = 0; } diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index d956243963d..311788fbbfb 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -134,7 +134,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') #define zend_ini_copy_value(retval, str, len) \ - ZVAL_STR(retval, STR_INIT(str, len, 1)) + ZVAL_NEW_STR(retval, STR_INIT(str, len, 1)) #define RETURN_TOKEN(type, str, len) { \ diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index eb31a98d39d..379d86965d5 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -132,7 +132,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') #define zend_ini_copy_value(retval, str, len) \ - ZVAL_STR(retval, STR_INIT(str, len, 1)) + ZVAL_NEW_STR(retval, STR_INIT(str, len, 1)) #define RETURN_TOKEN(type, str, len) { \ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index a649c7be59a..c50593692ba 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -568,8 +568,8 @@ parameter: optional_class_type: /* empty */ { $$.op_type = IS_UNUSED; } - | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_ARRAY; } - | T_CALLABLE { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_CALLABLE; } + | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_ARRAY; } + | T_CALLABLE { $$.op_type = IS_CONST; Z_TYPE_INFO($$.u.constant)=IS_CALLABLE; } | fully_qualified_class_name { $$ = $1; } ; @@ -607,9 +607,9 @@ global_var: static_var_list: static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); } - | static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); } + | static_var_list ',' T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($5.u.constant) = 0; zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); } | T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); } - | T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); } + | T_VARIABLE '=' static_scalar { Z_CONST_FLAGS($3.u.constant) = 0; zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); } ; @@ -734,7 +734,7 @@ echo_expr_list: for_expr: - /* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_LVAL($$.u.constant) = 1; } + /* empty */ { $$.op_type = IS_CONST; ZVAL_BOOL(&$$.u.constant, 1); } | non_empty_for_expr { $$ = $1; } ; @@ -906,13 +906,13 @@ class_name: T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1);} | namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; } + | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; } ; fully_qualified_class_name: namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; } + | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; } ; @@ -981,8 +981,8 @@ static_class_constant: static_scalar: /* compile-time evaluated scalars */ static_scalar_value { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } - | '[' static_array_pair_list ']' { $$ = $2; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } + | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE_INFO($$.u.constant) = IS_CONSTANT_ARRAY_EX; } + | '[' static_array_pair_list ']' { $$ = $2; Z_TYPE_INFO($$.u.constant) = IS_CONSTANT_ARRAY_EX; } ; static_scalar_value: @@ -990,7 +990,7 @@ static_scalar_value: | static_class_name_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); } - | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); } + | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); } | static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); } | T_CLASS_C { $$.u.ast = zend_ast_create_constant(&$1.u.constant); } | static_operation { $$ = $1; } @@ -1037,7 +1037,7 @@ scalar: | class_constant { $$ = $1; } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_NEW_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } | '"' encaps_list '"' { $$ = $2; } | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; } diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 22474d171b6..0d091ca2e6e 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -658,6 +658,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ old_len = Z_STRLEN_P(str); Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1); SCNG(yy_in) = NULL; @@ -1001,7 +1002,7 @@ restart: yymore_restart: -#line 1005 "Zend/zend_language_scanner.c" +#line 1006 "Zend/zend_language_scanner.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1100,7 +1101,7 @@ yyc_INITIAL: yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1767 "Zend/zend_language_scanner.l" +#line 1764 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1152,14 +1153,14 @@ inline_html: if (readsize < yyleng) { yyless(readsize); } - Z_TYPE_P(zendlval) = IS_STRING; + Z_TYPE_INFO_P(zendlval) = IS_STRING_EX; } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } HANDLE_NEWLINES(yytext, yyleng); return T_INLINE_HTML; } -#line 1163 "Zend/zend_language_scanner.c" +#line 1164 "Zend/zend_language_scanner.c" yy4: YYDEBUG(4, *YYCURSOR); yych = *++YYCURSOR; @@ -1177,36 +1178,36 @@ yy5: yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1756 "Zend/zend_language_scanner.l" +#line 1753 "Zend/zend_language_scanner.l" { if (CG(short_tags)) { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way, no copying intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way, no copying intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { goto inline_char_handler; } } -#line 1192 "Zend/zend_language_scanner.c" +#line 1193 "Zend/zend_language_scanner.c" yy7: YYDEBUG(7, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1735 "Zend/zend_language_scanner.l" +#line 1732 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { goto inline_char_handler; } } -#line 1210 "Zend/zend_language_scanner.c" +#line 1211 "Zend/zend_language_scanner.c" yy9: YYDEBUG(9, *YYCURSOR); yych = *++YYCURSOR; @@ -1392,7 +1393,7 @@ yy35: ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1698 "Zend/zend_language_scanner.l" +#line 1695 "Zend/zend_language_scanner.l" { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1)); @@ -1404,11 +1405,11 @@ yy35: HANDLE_NEWLINES(yytext, yyleng); //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1412 "Zend/zend_language_scanner.c" +#line 1413 "Zend/zend_language_scanner.c" yy39: YYDEBUG(39, *YYCURSOR); yych = *++YYCURSOR; @@ -1435,31 +1436,31 @@ yy43: ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1715 "Zend/zend_language_scanner.l" +#line 1712 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { goto inline_char_handler; } } -#line 1450 "Zend/zend_language_scanner.c" +#line 1451 "Zend/zend_language_scanner.c" yy45: YYDEBUG(45, *YYCURSOR); ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1727 "Zend/zend_language_scanner.l" +#line 1724 "Zend/zend_language_scanner.l" { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } -#line 1463 "Zend/zend_language_scanner.c" +#line 1464 "Zend/zend_language_scanner.c" yy47: YYDEBUG(47, *YYCURSOR); yych = *++YYCURSOR; @@ -1486,15 +1487,15 @@ yy50: yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1747 "Zend/zend_language_scanner.l" +#line 1744 "Zend/zend_language_scanner.l" { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way, no copying intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way, no copying intentional */ HANDLE_NEWLINE(yytext[yyleng-1]); BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } -#line 1498 "Zend/zend_language_scanner.c" +#line 1499 "Zend/zend_language_scanner.c" yy52: YYDEBUG(52, *YYCURSOR); ++YYCURSOR; @@ -1565,7 +1566,7 @@ yyc_ST_BACKQUOTE: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2208 "Zend/zend_language_scanner.l" +#line 2205 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -1606,7 +1607,7 @@ yy56: zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1610 "Zend/zend_language_scanner.c" +#line 1611 "Zend/zend_language_scanner.c" yy57: YYDEBUG(57, *YYCURSOR); yych = *++YYCURSOR; @@ -1617,12 +1618,12 @@ yy58: ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2152 "Zend/zend_language_scanner.l" +#line 2149 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '`'; } -#line 1626 "Zend/zend_language_scanner.c" +#line 1627 "Zend/zend_language_scanner.c" yy60: YYDEBUG(60, *YYCURSOR); yych = *++YYCURSOR; @@ -1632,14 +1633,14 @@ yy61: ++YYCURSOR; YYDEBUG(62, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2139 "Zend/zend_language_scanner.l" +#line 2136 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1643 "Zend/zend_language_scanner.c" +#line 1644 "Zend/zend_language_scanner.c" yy63: YYDEBUG(63, *YYCURSOR); yyaccept = 0; @@ -1655,23 +1656,23 @@ yy63: yy65: YYDEBUG(65, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1846 "Zend/zend_language_scanner.l" +#line 1843 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1664 "Zend/zend_language_scanner.c" +#line 1665 "Zend/zend_language_scanner.c" yy66: YYDEBUG(66, *YYCURSOR); ++YYCURSOR; YYDEBUG(67, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1461 "Zend/zend_language_scanner.l" +#line 1462 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1675 "Zend/zend_language_scanner.c" +#line 1676 "Zend/zend_language_scanner.c" yy68: YYDEBUG(68, *YYCURSOR); yych = *++YYCURSOR; @@ -1685,14 +1686,14 @@ yy70: ++YYCURSOR; YYDEBUG(71, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1839 "Zend/zend_language_scanner.l" +#line 1836 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1696 "Zend/zend_language_scanner.c" +#line 1697 "Zend/zend_language_scanner.c" yy72: YYDEBUG(72, *YYCURSOR); yych = *++YYCURSOR; @@ -1710,14 +1711,14 @@ yy73: ++YYCURSOR; YYDEBUG(74, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1830 "Zend/zend_language_scanner.l" +#line 1827 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1721 "Zend/zend_language_scanner.c" +#line 1722 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_DOUBLE_QUOTES: @@ -1785,7 +1786,7 @@ yy77: yy78: YYDEBUG(78, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2158 "Zend/zend_language_scanner.l" +#line 2155 "Zend/zend_language_scanner.l" { if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) { YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1; @@ -1834,7 +1835,7 @@ double_quotes_scan_done: zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 1838 "Zend/zend_language_scanner.c" +#line 1839 "Zend/zend_language_scanner.c" yy79: YYDEBUG(79, *YYCURSOR); yych = *++YYCURSOR; @@ -1845,12 +1846,12 @@ yy80: ++YYCURSOR; YYDEBUG(81, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2147 "Zend/zend_language_scanner.l" +#line 2144 "Zend/zend_language_scanner.l" { BEGIN(ST_IN_SCRIPTING); return '"'; } -#line 1854 "Zend/zend_language_scanner.c" +#line 1855 "Zend/zend_language_scanner.c" yy82: YYDEBUG(82, *YYCURSOR); yych = *++YYCURSOR; @@ -1860,14 +1861,14 @@ yy83: ++YYCURSOR; YYDEBUG(84, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2139 "Zend/zend_language_scanner.l" +#line 2136 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 1871 "Zend/zend_language_scanner.c" +#line 1872 "Zend/zend_language_scanner.c" yy85: YYDEBUG(85, *YYCURSOR); yyaccept = 0; @@ -1883,23 +1884,23 @@ yy85: yy87: YYDEBUG(87, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1846 "Zend/zend_language_scanner.l" +#line 1843 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1892 "Zend/zend_language_scanner.c" +#line 1893 "Zend/zend_language_scanner.c" yy88: YYDEBUG(88, *YYCURSOR); ++YYCURSOR; YYDEBUG(89, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1461 "Zend/zend_language_scanner.l" +#line 1462 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 1903 "Zend/zend_language_scanner.c" +#line 1904 "Zend/zend_language_scanner.c" yy90: YYDEBUG(90, *YYCURSOR); yych = *++YYCURSOR; @@ -1913,14 +1914,14 @@ yy92: ++YYCURSOR; YYDEBUG(93, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1839 "Zend/zend_language_scanner.l" +#line 1836 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1924 "Zend/zend_language_scanner.c" +#line 1925 "Zend/zend_language_scanner.c" yy94: YYDEBUG(94, *YYCURSOR); yych = *++YYCURSOR; @@ -1938,14 +1939,14 @@ yy95: ++YYCURSOR; YYDEBUG(96, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1830 "Zend/zend_language_scanner.l" +#line 1827 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 1949 "Zend/zend_language_scanner.c" +#line 1950 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_END_HEREDOC: @@ -1956,7 +1957,7 @@ yyc_ST_END_HEREDOC: ++YYCURSOR; YYDEBUG(100, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2125 "Zend/zend_language_scanner.l" +#line 2122 "Zend/zend_language_scanner.l" { zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack)); @@ -1969,7 +1970,7 @@ yyc_ST_END_HEREDOC: BEGIN(ST_IN_SCRIPTING); return T_END_HEREDOC; } -#line 1973 "Zend/zend_language_scanner.c" +#line 1974 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_HEREDOC: { @@ -2031,7 +2032,7 @@ yy103: yy104: YYDEBUG(104, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2250 "Zend/zend_language_scanner.l" +#line 2247 "Zend/zend_language_scanner.l" { int newline = 0; @@ -2104,7 +2105,7 @@ heredoc_scan_done: zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC); return T_ENCAPSED_AND_WHITESPACE; } -#line 2108 "Zend/zend_language_scanner.c" +#line 2109 "Zend/zend_language_scanner.c" yy105: YYDEBUG(105, *YYCURSOR); yych = *++YYCURSOR; @@ -2119,14 +2120,14 @@ yy107: ++YYCURSOR; YYDEBUG(108, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2139 "Zend/zend_language_scanner.l" +#line 2136 "Zend/zend_language_scanner.l" { Z_LVAL_P(zendlval) = (long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; } -#line 2130 "Zend/zend_language_scanner.c" +#line 2131 "Zend/zend_language_scanner.c" yy109: YYDEBUG(109, *YYCURSOR); yyaccept = 0; @@ -2142,23 +2143,23 @@ yy109: yy111: YYDEBUG(111, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1846 "Zend/zend_language_scanner.l" +#line 1843 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 2151 "Zend/zend_language_scanner.c" +#line 2152 "Zend/zend_language_scanner.c" yy112: YYDEBUG(112, *YYCURSOR); ++YYCURSOR; YYDEBUG(113, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1461 "Zend/zend_language_scanner.l" +#line 1462 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC); return T_DOLLAR_OPEN_CURLY_BRACES; } -#line 2162 "Zend/zend_language_scanner.c" +#line 2163 "Zend/zend_language_scanner.c" yy114: YYDEBUG(114, *YYCURSOR); yych = *++YYCURSOR; @@ -2172,14 +2173,14 @@ yy116: ++YYCURSOR; YYDEBUG(117, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1839 "Zend/zend_language_scanner.l" +#line 1836 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); yy_push_state(ST_VAR_OFFSET TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 2183 "Zend/zend_language_scanner.c" +#line 2184 "Zend/zend_language_scanner.c" yy118: YYDEBUG(118, *YYCURSOR); yych = *++YYCURSOR; @@ -2197,14 +2198,14 @@ yy119: ++YYCURSOR; YYDEBUG(120, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1830 "Zend/zend_language_scanner.l" +#line 1827 "Zend/zend_language_scanner.l" { yyless(yyleng - 3); yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 2208 "Zend/zend_language_scanner.c" +#line 2209 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_IN_SCRIPTING: @@ -2387,12 +2388,12 @@ yy123: yy124: YYDEBUG(124, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1868 "Zend/zend_language_scanner.l" +#line 1865 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); return T_STRING; } -#line 2396 "Zend/zend_language_scanner.c" +#line 2397 "Zend/zend_language_scanner.c" yy125: YYDEBUG(125, *YYCURSOR); yych = *++YYCURSOR; @@ -2624,11 +2625,11 @@ yy138: yy139: YYDEBUG(139, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1450 "Zend/zend_language_scanner.l" +#line 1451 "Zend/zend_language_scanner.l" { return yytext[0]; } -#line 2632 "Zend/zend_language_scanner.c" +#line 2633 "Zend/zend_language_scanner.c" yy140: YYDEBUG(140, *YYCURSOR); ++YYCURSOR; @@ -2637,14 +2638,14 @@ yy140: yy141: YYDEBUG(141, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1179 "Zend/zend_language_scanner.l" +#line 1180 "Zend/zend_language_scanner.l" { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 2648 "Zend/zend_language_scanner.c" +#line 2649 "Zend/zend_language_scanner.c" yy142: YYDEBUG(142, *YYCURSOR); yych = *++YYCURSOR; @@ -2655,11 +2656,11 @@ yy143: ++YYCURSOR; YYDEBUG(144, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1206 "Zend/zend_language_scanner.l" +#line 1207 "Zend/zend_language_scanner.l" { return T_NS_SEPARATOR; } -#line 2663 "Zend/zend_language_scanner.c" +#line 2664 "Zend/zend_language_scanner.c" yy145: YYDEBUG(145, *YYCURSOR); yyaccept = 1; @@ -2892,18 +2893,18 @@ yy168: ++YYCURSOR; YYDEBUG(169, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1455 "Zend/zend_language_scanner.l" +#line 1456 "Zend/zend_language_scanner.l" { yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return '{'; } -#line 2901 "Zend/zend_language_scanner.c" +#line 2902 "Zend/zend_language_scanner.c" yy170: YYDEBUG(170, *YYCURSOR); ++YYCURSOR; YYDEBUG(171, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1467 "Zend/zend_language_scanner.l" +#line 1468 "Zend/zend_language_scanner.l" { RESET_DOC_COMMENT(); if (!zend_stack_is_empty(&SCNG(state_stack))) { @@ -2911,7 +2912,7 @@ yy170: } return '}'; } -#line 2915 "Zend/zend_language_scanner.c" +#line 2916 "Zend/zend_language_scanner.c" yy172: YYDEBUG(172, *YYCURSOR); yyaccept = 2; @@ -2942,25 +2943,22 @@ yy173: #line 1516 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); + ZVAL_LONG(zendlval, strtol(yytext, NULL, 0)); } else { errno = 0; - Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); + ZVAL_LONG(zendlval, strtol(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ - Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL); + ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); } else { - Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); + ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL)); } - Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } } - - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } -#line 2964 "Zend/zend_language_scanner.c" +#line 2962 "Zend/zend_language_scanner.c" yy174: YYDEBUG(174, *YYCURSOR); yyaccept = 2; @@ -2988,7 +2986,7 @@ yy176: yy177: YYDEBUG(177, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1874 "Zend/zend_language_scanner.l" +#line 1871 "Zend/zend_language_scanner.l" { while (YYCURSOR < YYLIMIT) { switch (*YYCURSOR++) { @@ -3022,14 +3020,14 @@ yy177: return T_COMMENT; } -#line 3026 "Zend/zend_language_scanner.c" +#line 3024 "Zend/zend_language_scanner.c" yy178: YYDEBUG(178, *YYCURSOR); ++YYCURSOR; yy179: YYDEBUG(179, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1962 "Zend/zend_language_scanner.l" +#line 1959 "Zend/zend_language_scanner.l" { register char *s, *t; char *end; @@ -3095,14 +3093,14 @@ yy179: } return T_CONSTANT_ENCAPSED_STRING; } -#line 3099 "Zend/zend_language_scanner.c" +#line 3097 "Zend/zend_language_scanner.c" yy180: YYDEBUG(180, *YYCURSOR); ++YYCURSOR; yy181: YYDEBUG(181, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2029 "Zend/zend_language_scanner.l" +#line 2026 "Zend/zend_language_scanner.l" { int bprefix = (yytext[0] != '"') ? 1 : 0; @@ -3143,24 +3141,24 @@ yy181: BEGIN(ST_DOUBLE_QUOTES); return '"'; } -#line 3147 "Zend/zend_language_scanner.c" +#line 3145 "Zend/zend_language_scanner.c" yy182: YYDEBUG(182, *YYCURSOR); ++YYCURSOR; YYDEBUG(183, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2119 "Zend/zend_language_scanner.l" +#line 2116 "Zend/zend_language_scanner.l" { BEGIN(ST_BACKQUOTE); return '`'; } -#line 3158 "Zend/zend_language_scanner.c" +#line 3156 "Zend/zend_language_scanner.c" yy184: YYDEBUG(184, *YYCURSOR); ++YYCURSOR; YYDEBUG(185, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2381 "Zend/zend_language_scanner.l" +#line 2378 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -3169,7 +3167,7 @@ yy184: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 3173 "Zend/zend_language_scanner.c" +#line 3171 "Zend/zend_language_scanner.c" yy186: YYDEBUG(186, *YYCURSOR); ++YYCURSOR; @@ -3196,12 +3194,12 @@ yy188: yy190: YYDEBUG(190, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1575 "Zend/zend_language_scanner.l" +#line 1571 "Zend/zend_language_scanner.l" { ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL)); return T_DNUMBER; } -#line 3205 "Zend/zend_language_scanner.c" +#line 3203 "Zend/zend_language_scanner.c" yy191: YYDEBUG(191, *YYCURSOR); yyaccept = 2; @@ -3293,7 +3291,7 @@ yy200: } YYDEBUG(202, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1492 "Zend/zend_language_scanner.l" +#line 1493 "Zend/zend_language_scanner.l" { char *bin = yytext + 2; /* Skip "0b" */ int len = yyleng - 2; @@ -3306,18 +3304,17 @@ yy200: if (len < SIZEOF_LONG * 8) { if (len == 0) { - Z_LVAL_P(zendlval) = 0; + ZVAL_LONG(zendlval, 0); } else { - Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); + ZVAL_LONG(zendlval, strtol(bin, NULL, 2)); } - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); return T_DNUMBER; } } -#line 3321 "Zend/zend_language_scanner.c" +#line 3318 "Zend/zend_language_scanner.c" yy203: YYDEBUG(203, *YYCURSOR); ++YYCURSOR; @@ -3329,7 +3326,7 @@ yy203: } YYDEBUG(205, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1537 "Zend/zend_language_scanner.l" +#line 1534 "Zend/zend_language_scanner.l" { char *hex = yytext + 2; /* Skip "0x" */ int len = yyleng - 2; @@ -3342,18 +3339,17 @@ yy203: if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { if (len == 0) { - Z_LVAL_P(zendlval) = 0; + ZVAL_LONG(zendlval, 0); } else { - Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); + ZVAL_LONG(zendlval, strtol(hex, NULL, 16)); } - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); return T_DNUMBER; } } -#line 3357 "Zend/zend_language_scanner.c" +#line 3353 "Zend/zend_language_scanner.c" yy206: YYDEBUG(206, *YYCURSOR); ++YYCURSOR; @@ -3362,14 +3358,14 @@ yy206: yy207: YYDEBUG(207, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1941 "Zend/zend_language_scanner.l" +#line 1938 "Zend/zend_language_scanner.l" { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } -#line 3373 "Zend/zend_language_scanner.c" +#line 3369 "Zend/zend_language_scanner.c" yy208: YYDEBUG(208, *YYCURSOR); yych = *++YYCURSOR; @@ -3403,12 +3399,12 @@ yy210: yy212: YYDEBUG(212, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1846 "Zend/zend_language_scanner.l" +#line 1843 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 3412 "Zend/zend_language_scanner.c" +#line 3408 "Zend/zend_language_scanner.c" yy213: YYDEBUG(213, *YYCURSOR); yych = *++YYCURSOR; @@ -3422,11 +3418,11 @@ yy214: } YYDEBUG(215, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1438 "Zend/zend_language_scanner.l" +#line 1439 "Zend/zend_language_scanner.l" { return T_LOGICAL_XOR; } -#line 3430 "Zend/zend_language_scanner.c" +#line 3426 "Zend/zend_language_scanner.c" yy216: YYDEBUG(216, *YYCURSOR); ++YYCURSOR; @@ -3435,61 +3431,61 @@ yy216: } YYDEBUG(217, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1430 "Zend/zend_language_scanner.l" +#line 1431 "Zend/zend_language_scanner.l" { return T_LOGICAL_OR; } -#line 3443 "Zend/zend_language_scanner.c" +#line 3439 "Zend/zend_language_scanner.c" yy218: YYDEBUG(218, *YYCURSOR); ++YYCURSOR; YYDEBUG(219, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1418 "Zend/zend_language_scanner.l" +#line 1419 "Zend/zend_language_scanner.l" { return T_XOR_EQUAL; } -#line 3453 "Zend/zend_language_scanner.c" +#line 3449 "Zend/zend_language_scanner.c" yy220: YYDEBUG(220, *YYCURSOR); ++YYCURSOR; YYDEBUG(221, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1422 "Zend/zend_language_scanner.l" +#line 1423 "Zend/zend_language_scanner.l" { return T_BOOLEAN_OR; } -#line 3463 "Zend/zend_language_scanner.c" +#line 3459 "Zend/zend_language_scanner.c" yy222: YYDEBUG(222, *YYCURSOR); ++YYCURSOR; YYDEBUG(223, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1414 "Zend/zend_language_scanner.l" +#line 1415 "Zend/zend_language_scanner.l" { return T_OR_EQUAL; } -#line 3473 "Zend/zend_language_scanner.c" +#line 3469 "Zend/zend_language_scanner.c" yy224: YYDEBUG(224, *YYCURSOR); ++YYCURSOR; YYDEBUG(225, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1426 "Zend/zend_language_scanner.l" +#line 1427 "Zend/zend_language_scanner.l" { return T_BOOLEAN_AND; } -#line 3483 "Zend/zend_language_scanner.c" +#line 3479 "Zend/zend_language_scanner.c" yy226: YYDEBUG(226, *YYCURSOR); ++YYCURSOR; YYDEBUG(227, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1410 "Zend/zend_language_scanner.l" +#line 1411 "Zend/zend_language_scanner.l" { return T_AND_EQUAL; } -#line 3493 "Zend/zend_language_scanner.c" +#line 3489 "Zend/zend_language_scanner.c" yy228: YYDEBUG(228, *YYCURSOR); ++YYCURSOR; @@ -3498,29 +3494,29 @@ yy228: yy229: YYDEBUG(229, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1949 "Zend/zend_language_scanner.l" +#line 1946 "Zend/zend_language_scanner.l" { if (CG(asp_tags)) { BEGIN(INITIAL); //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } else { yyless(1); return yytext[0]; } } -#line 3514 "Zend/zend_language_scanner.c" +#line 3510 "Zend/zend_language_scanner.c" yy230: YYDEBUG(230, *YYCURSOR); ++YYCURSOR; YYDEBUG(231, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1398 "Zend/zend_language_scanner.l" +#line 1399 "Zend/zend_language_scanner.l" { return T_MOD_EQUAL; } -#line 3524 "Zend/zend_language_scanner.c" +#line 3520 "Zend/zend_language_scanner.c" yy232: YYDEBUG(232, *YYCURSOR); yych = *++YYCURSOR; @@ -3538,7 +3534,7 @@ yy234: yy235: YYDEBUG(235, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1908 "Zend/zend_language_scanner.l" +#line 1905 "Zend/zend_language_scanner.l" { int doc_com; @@ -3571,7 +3567,7 @@ yy235: return T_COMMENT; } -#line 3575 "Zend/zend_language_scanner.c" +#line 3571 "Zend/zend_language_scanner.c" yy236: YYDEBUG(236, *YYCURSOR); yych = *++YYCURSOR; @@ -3581,11 +3577,11 @@ yy237: ++YYCURSOR; YYDEBUG(238, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1390 "Zend/zend_language_scanner.l" +#line 1391 "Zend/zend_language_scanner.l" { return T_DIV_EQUAL; } -#line 3589 "Zend/zend_language_scanner.c" +#line 3585 "Zend/zend_language_scanner.c" yy239: YYDEBUG(239, *YYCURSOR); yych = *++YYCURSOR; @@ -3608,42 +3604,42 @@ yy242: ++YYCURSOR; YYDEBUG(243, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1386 "Zend/zend_language_scanner.l" +#line 1387 "Zend/zend_language_scanner.l" { return T_MUL_EQUAL; } -#line 3616 "Zend/zend_language_scanner.c" +#line 3612 "Zend/zend_language_scanner.c" yy244: YYDEBUG(244, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy248; YYDEBUG(245, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1446 "Zend/zend_language_scanner.l" +#line 1447 "Zend/zend_language_scanner.l" { return T_SR; } -#line 3627 "Zend/zend_language_scanner.c" +#line 3623 "Zend/zend_language_scanner.c" yy246: YYDEBUG(246, *YYCURSOR); ++YYCURSOR; YYDEBUG(247, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1374 "Zend/zend_language_scanner.l" +#line 1375 "Zend/zend_language_scanner.l" { return T_IS_GREATER_OR_EQUAL; } -#line 3637 "Zend/zend_language_scanner.c" +#line 3633 "Zend/zend_language_scanner.c" yy248: YYDEBUG(248, *YYCURSOR); ++YYCURSOR; YYDEBUG(249, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1406 "Zend/zend_language_scanner.l" +#line 1407 "Zend/zend_language_scanner.l" { return T_SR_EQUAL; } -#line 3647 "Zend/zend_language_scanner.c" +#line 3643 "Zend/zend_language_scanner.c" yy250: YYDEBUG(250, *YYCURSOR); yyaccept = 5; @@ -3654,11 +3650,11 @@ yy250: yy251: YYDEBUG(251, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1442 "Zend/zend_language_scanner.l" +#line 1443 "Zend/zend_language_scanner.l" { return T_SL; } -#line 3662 "Zend/zend_language_scanner.c" +#line 3658 "Zend/zend_language_scanner.c" yy252: YYDEBUG(252, *YYCURSOR); yych = *++YYCURSOR; @@ -3670,22 +3666,22 @@ yy253: ++YYCURSOR; YYDEBUG(254, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1370 "Zend/zend_language_scanner.l" +#line 1371 "Zend/zend_language_scanner.l" { return T_IS_SMALLER_OR_EQUAL; } -#line 3678 "Zend/zend_language_scanner.c" +#line 3674 "Zend/zend_language_scanner.c" yy255: YYDEBUG(255, *YYCURSOR); ++YYCURSOR; yy256: YYDEBUG(256, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1366 "Zend/zend_language_scanner.l" +#line 1367 "Zend/zend_language_scanner.l" { return T_IS_NOT_EQUAL; } -#line 3689 "Zend/zend_language_scanner.c" +#line 3685 "Zend/zend_language_scanner.c" yy257: YYDEBUG(257, *YYCURSOR); yych = *++YYCURSOR; @@ -3736,11 +3732,11 @@ yy264: ++YYCURSOR; YYDEBUG(265, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1402 "Zend/zend_language_scanner.l" +#line 1403 "Zend/zend_language_scanner.l" { return T_SL_EQUAL; } -#line 3744 "Zend/zend_language_scanner.c" +#line 3740 "Zend/zend_language_scanner.c" yy266: YYDEBUG(266, *YYCURSOR); ++YYCURSOR; @@ -3845,7 +3841,7 @@ yy275: yy276: YYDEBUG(276, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2071 "Zend/zend_language_scanner.l" +#line 2068 "Zend/zend_language_scanner.l" { char *s; int bprefix = (yytext[0] != '<') ? 1 : 0; @@ -3892,7 +3888,7 @@ yy276: return T_START_HEREDOC; } -#line 3896 "Zend/zend_language_scanner.c" +#line 3892 "Zend/zend_language_scanner.c" yy277: YYDEBUG(277, *YYCURSOR); yych = *++YYCURSOR; @@ -3932,31 +3928,31 @@ yy280: ++YYCURSOR; YYDEBUG(282, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1358 "Zend/zend_language_scanner.l" +#line 1359 "Zend/zend_language_scanner.l" { return T_IS_NOT_IDENTICAL; } -#line 3940 "Zend/zend_language_scanner.c" +#line 3936 "Zend/zend_language_scanner.c" yy283: YYDEBUG(283, *YYCURSOR); ++YYCURSOR; YYDEBUG(284, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1378 "Zend/zend_language_scanner.l" +#line 1379 "Zend/zend_language_scanner.l" { return T_PLUS_EQUAL; } -#line 3950 "Zend/zend_language_scanner.c" +#line 3946 "Zend/zend_language_scanner.c" yy285: YYDEBUG(285, *YYCURSOR); ++YYCURSOR; YYDEBUG(286, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1346 "Zend/zend_language_scanner.l" +#line 1347 "Zend/zend_language_scanner.l" { return T_INC; } -#line 3960 "Zend/zend_language_scanner.c" +#line 3956 "Zend/zend_language_scanner.c" yy287: YYDEBUG(287, *YYCURSOR); yych = *++YYCURSOR; @@ -3975,42 +3971,42 @@ yy289: } YYDEBUG(290, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1334 "Zend/zend_language_scanner.l" +#line 1335 "Zend/zend_language_scanner.l" { return T_LIST; } -#line 3983 "Zend/zend_language_scanner.c" +#line 3979 "Zend/zend_language_scanner.c" yy291: YYDEBUG(291, *YYCURSOR); ++YYCURSOR; if ((yych = *YYCURSOR) == '=') goto yy295; YYDEBUG(292, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1362 "Zend/zend_language_scanner.l" +#line 1363 "Zend/zend_language_scanner.l" { return T_IS_EQUAL; } -#line 3994 "Zend/zend_language_scanner.c" +#line 3990 "Zend/zend_language_scanner.c" yy293: YYDEBUG(293, *YYCURSOR); ++YYCURSOR; YYDEBUG(294, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1330 "Zend/zend_language_scanner.l" +#line 1331 "Zend/zend_language_scanner.l" { return T_DOUBLE_ARROW; } -#line 4004 "Zend/zend_language_scanner.c" +#line 4000 "Zend/zend_language_scanner.c" yy295: YYDEBUG(295, *YYCURSOR); ++YYCURSOR; YYDEBUG(296, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1354 "Zend/zend_language_scanner.l" +#line 1355 "Zend/zend_language_scanner.l" { return T_IS_IDENTICAL; } -#line 4014 "Zend/zend_language_scanner.c" +#line 4010 "Zend/zend_language_scanner.c" yy297: YYDEBUG(297, *YYCURSOR); yych = *++YYCURSOR; @@ -4140,7 +4136,7 @@ yy313: } YYDEBUG(316, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1689 "Zend/zend_language_scanner.l" +#line 1686 "Zend/zend_language_scanner.l" { if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { ZVAL_DUP(zendlval, &CG(current_namespace)); @@ -4149,7 +4145,7 @@ yy313: } return T_NS_C; } -#line 4153 "Zend/zend_language_scanner.c" +#line 4149 "Zend/zend_language_scanner.c" yy317: YYDEBUG(317, *YYCURSOR); yych = *++YYCURSOR; @@ -4169,7 +4165,7 @@ yy318: } YYDEBUG(321, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1664 "Zend/zend_language_scanner.l" +#line 1661 "Zend/zend_language_scanner.l" { zend_string *filename = zend_get_compiled_filename(TSRMLS_C); zend_string *dirname; @@ -4194,7 +4190,7 @@ yy318: ZVAL_STR(zendlval, dirname); return T_DIR; } -#line 4198 "Zend/zend_language_scanner.c" +#line 4194 "Zend/zend_language_scanner.c" yy322: YYDEBUG(322, *YYCURSOR); yych = *++YYCURSOR; @@ -4219,12 +4215,12 @@ yy324: } YYDEBUG(327, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1649 "Zend/zend_language_scanner.l" +#line 1645 "Zend/zend_language_scanner.l" { ZVAL_LONG(zendlval, CG(zend_lineno)); return T_LINE; } -#line 4228 "Zend/zend_language_scanner.c" +#line 4224 "Zend/zend_language_scanner.c" yy328: YYDEBUG(328, *YYCURSOR); yych = *++YYCURSOR; @@ -4259,7 +4255,7 @@ yy332: } YYDEBUG(335, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1617 "Zend/zend_language_scanner.l" +#line 1613 "Zend/zend_language_scanner.l" { if (CG(active_class_entry)) { int len = 0; @@ -4271,7 +4267,7 @@ yy332: len += sizeof("::")-1; len += CG(active_op_array)->function_name->len; } - ZVAL_STR(zendlval, STR_ALLOC(len, 0)); + ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0)); len = 0; if (CG(active_class_entry)->name) { memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len); @@ -4291,7 +4287,7 @@ yy332: } return T_METHOD_C; } -#line 4295 "Zend/zend_language_scanner.c" +#line 4291 "Zend/zend_language_scanner.c" yy336: YYDEBUG(336, *YYCURSOR); yych = *++YYCURSOR; @@ -4342,7 +4338,7 @@ yy343: } YYDEBUG(346, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1607 "Zend/zend_language_scanner.l" +#line 1603 "Zend/zend_language_scanner.l" { zend_op_array *op_array = CG(active_op_array); if (op_array && op_array->function_name) { @@ -4352,7 +4348,7 @@ yy343: } return T_FUNC_C; } -#line 4356 "Zend/zend_language_scanner.c" +#line 4352 "Zend/zend_language_scanner.c" yy347: YYDEBUG(347, *YYCURSOR); yych = *++YYCURSOR; @@ -4372,17 +4368,18 @@ yy348: } YYDEBUG(351, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1654 "Zend/zend_language_scanner.l" +#line 1650 "Zend/zend_language_scanner.l" { zend_string *filename = zend_get_compiled_filename(TSRMLS_C); if (!filename) { - filename = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(zendlval); + } else { + ZVAL_STR(zendlval, STR_COPY(filename)); } - ZVAL_STR(zendlval, STR_COPY(filename)); return T_FILE; } -#line 4386 "Zend/zend_language_scanner.c" +#line 4383 "Zend/zend_language_scanner.c" yy352: YYDEBUG(352, *YYCURSOR); yych = *++YYCURSOR; @@ -4412,7 +4409,7 @@ yy355: } YYDEBUG(358, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1597 "Zend/zend_language_scanner.l" +#line 1593 "Zend/zend_language_scanner.l" { zend_class_entry *ce = CG(active_class_entry); if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { @@ -4422,7 +4419,7 @@ yy355: } return T_TRAIT_C; } -#line 4426 "Zend/zend_language_scanner.c" +#line 4423 "Zend/zend_language_scanner.c" yy359: YYDEBUG(359, *YYCURSOR); yych = *++YYCURSOR; @@ -4452,14 +4449,14 @@ yy362: } YYDEBUG(365, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1580 "Zend/zend_language_scanner.l" +#line 1576 "Zend/zend_language_scanner.l" { zend_class_entry *ce = CG(active_class_entry); if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { /* We create a special __CLASS__ constant that is going to be resolved at run-time */ ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1); - Z_TYPE_P(zendlval) = IS_CONSTANT; + Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; } else { if (ce && ce->name) { ZVAL_STR(zendlval, STR_COPY(ce->name)); @@ -4469,7 +4466,7 @@ yy362: } return T_CLASS_C; } -#line 4473 "Zend/zend_language_scanner.c" +#line 4470 "Zend/zend_language_scanner.c" yy366: YYDEBUG(366, *YYCURSOR); yych = *++YYCURSOR; @@ -4531,11 +4528,11 @@ yy377: } YYDEBUG(378, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1298 "Zend/zend_language_scanner.l" +#line 1299 "Zend/zend_language_scanner.l" { return T_HALT_COMPILER; } -#line 4539 "Zend/zend_language_scanner.c" +#line 4536 "Zend/zend_language_scanner.c" yy379: YYDEBUG(379, *YYCURSOR); yych = *++YYCURSOR; @@ -4555,11 +4552,11 @@ yy381: } YYDEBUG(382, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1278 "Zend/zend_language_scanner.l" +#line 1279 "Zend/zend_language_scanner.l" { return T_USE; } -#line 4563 "Zend/zend_language_scanner.c" +#line 4560 "Zend/zend_language_scanner.c" yy383: YYDEBUG(383, *YYCURSOR); yych = *++YYCURSOR; @@ -4578,11 +4575,11 @@ yy385: } YYDEBUG(386, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1326 "Zend/zend_language_scanner.l" +#line 1327 "Zend/zend_language_scanner.l" { return T_UNSET; } -#line 4586 "Zend/zend_language_scanner.c" +#line 4583 "Zend/zend_language_scanner.c" yy387: YYDEBUG(387, *YYCURSOR); ++YYCURSOR; @@ -4754,11 +4751,11 @@ yy402: ++YYCURSOR; YYDEBUG(404, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1226 "Zend/zend_language_scanner.l" +#line 1227 "Zend/zend_language_scanner.l" { return T_INT_CAST; } -#line 4762 "Zend/zend_language_scanner.c" +#line 4759 "Zend/zend_language_scanner.c" yy405: YYDEBUG(405, *YYCURSOR); yych = *++YYCURSOR; @@ -4802,11 +4799,11 @@ yy410: ++YYCURSOR; YYDEBUG(413, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1230 "Zend/zend_language_scanner.l" +#line 1231 "Zend/zend_language_scanner.l" { return T_DOUBLE_CAST; } -#line 4810 "Zend/zend_language_scanner.c" +#line 4807 "Zend/zend_language_scanner.c" yy414: YYDEBUG(414, *YYCURSOR); yych = *++YYCURSOR; @@ -4876,11 +4873,11 @@ yy424: ++YYCURSOR; YYDEBUG(427, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1234 "Zend/zend_language_scanner.l" +#line 1235 "Zend/zend_language_scanner.l" { return T_STRING_CAST; } -#line 4884 "Zend/zend_language_scanner.c" +#line 4881 "Zend/zend_language_scanner.c" yy428: YYDEBUG(428, *YYCURSOR); yych = *++YYCURSOR; @@ -4913,11 +4910,11 @@ yy431: ++YYCURSOR; YYDEBUG(434, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1238 "Zend/zend_language_scanner.l" +#line 1239 "Zend/zend_language_scanner.l" { return T_ARRAY_CAST; } -#line 4921 "Zend/zend_language_scanner.c" +#line 4918 "Zend/zend_language_scanner.c" yy435: YYDEBUG(435, *YYCURSOR); yych = *++YYCURSOR; @@ -4955,11 +4952,11 @@ yy439: ++YYCURSOR; YYDEBUG(442, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1242 "Zend/zend_language_scanner.l" +#line 1243 "Zend/zend_language_scanner.l" { return T_OBJECT_CAST; } -#line 4963 "Zend/zend_language_scanner.c" +#line 4960 "Zend/zend_language_scanner.c" yy443: YYDEBUG(443, *YYCURSOR); yych = *++YYCURSOR; @@ -5000,11 +4997,11 @@ yy448: ++YYCURSOR; YYDEBUG(450, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1246 "Zend/zend_language_scanner.l" +#line 1247 "Zend/zend_language_scanner.l" { return T_BOOL_CAST; } -#line 5008 "Zend/zend_language_scanner.c" +#line 5005 "Zend/zend_language_scanner.c" yy451: YYDEBUG(451, *YYCURSOR); yych = *++YYCURSOR; @@ -5064,11 +5061,11 @@ yy459: ++YYCURSOR; YYDEBUG(462, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1250 "Zend/zend_language_scanner.l" +#line 1251 "Zend/zend_language_scanner.l" { return T_UNSET_CAST; } -#line 5072 "Zend/zend_language_scanner.c" +#line 5069 "Zend/zend_language_scanner.c" yy463: YYDEBUG(463, *YYCURSOR); yych = *++YYCURSOR; @@ -5082,11 +5079,11 @@ yy464: } YYDEBUG(465, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1222 "Zend/zend_language_scanner.l" +#line 1223 "Zend/zend_language_scanner.l" { return T_VAR; } -#line 5090 "Zend/zend_language_scanner.c" +#line 5087 "Zend/zend_language_scanner.c" yy466: YYDEBUG(466, *YYCURSOR); yych = *++YYCURSOR; @@ -5106,11 +5103,11 @@ yy468: } YYDEBUG(469, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1214 "Zend/zend_language_scanner.l" +#line 1215 "Zend/zend_language_scanner.l" { return T_NEW; } -#line 5114 "Zend/zend_language_scanner.c" +#line 5111 "Zend/zend_language_scanner.c" yy470: YYDEBUG(470, *YYCURSOR); yych = *++YYCURSOR; @@ -5149,11 +5146,11 @@ yy476: } YYDEBUG(477, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1274 "Zend/zend_language_scanner.l" +#line 1275 "Zend/zend_language_scanner.l" { return T_NAMESPACE; } -#line 5157 "Zend/zend_language_scanner.c" +#line 5154 "Zend/zend_language_scanner.c" yy478: YYDEBUG(478, *YYCURSOR); yyaccept = 3; @@ -5175,11 +5172,11 @@ yy480: ++YYCURSOR; YYDEBUG(481, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1394 "Zend/zend_language_scanner.l" +#line 1395 "Zend/zend_language_scanner.l" { return T_CONCAT_EQUAL; } -#line 5183 "Zend/zend_language_scanner.c" +#line 5180 "Zend/zend_language_scanner.c" yy482: YYDEBUG(482, *YYCURSOR); yych = *++YYCURSOR; @@ -5188,21 +5185,21 @@ yy482: ++YYCURSOR; YYDEBUG(484, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1210 "Zend/zend_language_scanner.l" +#line 1211 "Zend/zend_language_scanner.l" { return T_ELLIPSIS; } -#line 5196 "Zend/zend_language_scanner.c" +#line 5193 "Zend/zend_language_scanner.c" yy485: YYDEBUG(485, *YYCURSOR); ++YYCURSOR; YYDEBUG(486, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1202 "Zend/zend_language_scanner.l" +#line 1203 "Zend/zend_language_scanner.l" { return T_PAAMAYIM_NEKUDOTAYIM; } -#line 5206 "Zend/zend_language_scanner.c" +#line 5203 "Zend/zend_language_scanner.c" yy487: YYDEBUG(487, *YYCURSOR); ++YYCURSOR; @@ -5224,32 +5221,32 @@ yy489: ++YYCURSOR; YYDEBUG(490, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1382 "Zend/zend_language_scanner.l" +#line 1383 "Zend/zend_language_scanner.l" { return T_MINUS_EQUAL; } -#line 5232 "Zend/zend_language_scanner.c" +#line 5229 "Zend/zend_language_scanner.c" yy491: YYDEBUG(491, *YYCURSOR); ++YYCURSOR; YYDEBUG(492, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1350 "Zend/zend_language_scanner.l" +#line 1351 "Zend/zend_language_scanner.l" { return T_DEC; } -#line 5242 "Zend/zend_language_scanner.c" +#line 5239 "Zend/zend_language_scanner.c" yy493: YYDEBUG(493, *YYCURSOR); ++YYCURSOR; YYDEBUG(494, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1174 "Zend/zend_language_scanner.l" +#line 1175 "Zend/zend_language_scanner.l" { yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC); return T_OBJECT_OPERATOR; } -#line 5253 "Zend/zend_language_scanner.c" +#line 5250 "Zend/zend_language_scanner.c" yy495: YYDEBUG(495, *YYCURSOR); yych = *++YYCURSOR; @@ -5294,11 +5291,11 @@ yy500: } YYDEBUG(501, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1322 "Zend/zend_language_scanner.l" +#line 1323 "Zend/zend_language_scanner.l" { return T_PUBLIC; } -#line 5302 "Zend/zend_language_scanner.c" +#line 5299 "Zend/zend_language_scanner.c" yy502: YYDEBUG(502, *YYCURSOR); yych = *++YYCURSOR; @@ -5353,11 +5350,11 @@ yy509: } YYDEBUG(510, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1318 "Zend/zend_language_scanner.l" +#line 1319 "Zend/zend_language_scanner.l" { return T_PROTECTED; } -#line 5361 "Zend/zend_language_scanner.c" +#line 5358 "Zend/zend_language_scanner.c" yy511: YYDEBUG(511, *YYCURSOR); yych = *++YYCURSOR; @@ -5387,11 +5384,11 @@ yy515: } YYDEBUG(516, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1314 "Zend/zend_language_scanner.l" +#line 1315 "Zend/zend_language_scanner.l" { return T_PRIVATE; } -#line 5395 "Zend/zend_language_scanner.c" +#line 5392 "Zend/zend_language_scanner.c" yy517: YYDEBUG(517, *YYCURSOR); ++YYCURSOR; @@ -5400,11 +5397,11 @@ yy517: } YYDEBUG(518, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1150 "Zend/zend_language_scanner.l" +#line 1151 "Zend/zend_language_scanner.l" { return T_PRINT; } -#line 5408 "Zend/zend_language_scanner.c" +#line 5405 "Zend/zend_language_scanner.c" yy519: YYDEBUG(519, *YYCURSOR); yych = *++YYCURSOR; @@ -5429,11 +5426,11 @@ yy522: } YYDEBUG(523, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1142 "Zend/zend_language_scanner.l" +#line 1143 "Zend/zend_language_scanner.l" { return T_GOTO; } -#line 5437 "Zend/zend_language_scanner.c" +#line 5434 "Zend/zend_language_scanner.c" yy524: YYDEBUG(524, *YYCURSOR); yych = *++YYCURSOR; @@ -5457,11 +5454,11 @@ yy527: } YYDEBUG(528, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1286 "Zend/zend_language_scanner.l" +#line 1287 "Zend/zend_language_scanner.l" { return T_GLOBAL; } -#line 5465 "Zend/zend_language_scanner.c" +#line 5462 "Zend/zend_language_scanner.c" yy529: YYDEBUG(529, *YYCURSOR); yych = *++YYCURSOR; @@ -5498,11 +5495,11 @@ yy535: } YYDEBUG(536, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1134 "Zend/zend_language_scanner.l" +#line 1135 "Zend/zend_language_scanner.l" { return T_BREAK; } -#line 5506 "Zend/zend_language_scanner.c" +#line 5503 "Zend/zend_language_scanner.c" yy537: YYDEBUG(537, *YYCURSOR); yych = *++YYCURSOR; @@ -5542,11 +5539,11 @@ yy543: } YYDEBUG(544, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1118 "Zend/zend_language_scanner.l" +#line 1119 "Zend/zend_language_scanner.l" { return T_SWITCH; } -#line 5550 "Zend/zend_language_scanner.c" +#line 5547 "Zend/zend_language_scanner.c" yy545: YYDEBUG(545, *YYCURSOR); yych = *++YYCURSOR; @@ -5570,11 +5567,11 @@ yy548: } YYDEBUG(549, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1302 "Zend/zend_language_scanner.l" +#line 1303 "Zend/zend_language_scanner.l" { return T_STATIC; } -#line 5578 "Zend/zend_language_scanner.c" +#line 5575 "Zend/zend_language_scanner.c" yy550: YYDEBUG(550, *YYCURSOR); yych = *++YYCURSOR; @@ -5601,11 +5598,11 @@ yy553: } YYDEBUG(554, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1114 "Zend/zend_language_scanner.l" +#line 1115 "Zend/zend_language_scanner.l" { return T_AS; } -#line 5609 "Zend/zend_language_scanner.c" +#line 5606 "Zend/zend_language_scanner.c" yy555: YYDEBUG(555, *YYCURSOR); yych = *++YYCURSOR; @@ -5624,11 +5621,11 @@ yy557: } YYDEBUG(558, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1338 "Zend/zend_language_scanner.l" +#line 1339 "Zend/zend_language_scanner.l" { return T_ARRAY; } -#line 5632 "Zend/zend_language_scanner.c" +#line 5629 "Zend/zend_language_scanner.c" yy559: YYDEBUG(559, *YYCURSOR); ++YYCURSOR; @@ -5637,11 +5634,11 @@ yy559: } YYDEBUG(560, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1434 "Zend/zend_language_scanner.l" +#line 1435 "Zend/zend_language_scanner.l" { return T_LOGICAL_AND; } -#line 5645 "Zend/zend_language_scanner.c" +#line 5642 "Zend/zend_language_scanner.c" yy561: YYDEBUG(561, *YYCURSOR); yych = *++YYCURSOR; @@ -5675,11 +5672,11 @@ yy566: } YYDEBUG(567, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1306 "Zend/zend_language_scanner.l" +#line 1307 "Zend/zend_language_scanner.l" { return T_ABSTRACT; } -#line 5683 "Zend/zend_language_scanner.c" +#line 5680 "Zend/zend_language_scanner.c" yy568: YYDEBUG(568, *YYCURSOR); yych = *++YYCURSOR; @@ -5703,11 +5700,11 @@ yy571: } YYDEBUG(572, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1074 "Zend/zend_language_scanner.l" +#line 1075 "Zend/zend_language_scanner.l" { return T_WHILE; } -#line 5711 "Zend/zend_language_scanner.c" +#line 5708 "Zend/zend_language_scanner.c" yy573: YYDEBUG(573, *YYCURSOR); ++YYCURSOR; @@ -5716,11 +5713,11 @@ yy573: } YYDEBUG(574, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1058 "Zend/zend_language_scanner.l" +#line 1059 "Zend/zend_language_scanner.l" { return T_IF; } -#line 5724 "Zend/zend_language_scanner.c" +#line 5721 "Zend/zend_language_scanner.c" yy575: YYDEBUG(575, *YYCURSOR); yych = *++YYCURSOR; @@ -5772,11 +5769,11 @@ yy580: } YYDEBUG(581, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1290 "Zend/zend_language_scanner.l" +#line 1291 "Zend/zend_language_scanner.l" { return T_ISSET; } -#line 5780 "Zend/zend_language_scanner.c" +#line 5777 "Zend/zend_language_scanner.c" yy582: YYDEBUG(582, *YYCURSOR); yych = *++YYCURSOR; @@ -5830,11 +5827,11 @@ yy588: yy589: YYDEBUG(589, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1258 "Zend/zend_language_scanner.l" +#line 1259 "Zend/zend_language_scanner.l" { return T_INCLUDE; } -#line 5838 "Zend/zend_language_scanner.c" +#line 5835 "Zend/zend_language_scanner.c" yy590: YYDEBUG(590, *YYCURSOR); yych = *++YYCURSOR; @@ -5863,11 +5860,11 @@ yy594: } YYDEBUG(595, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1262 "Zend/zend_language_scanner.l" +#line 1263 "Zend/zend_language_scanner.l" { return T_INCLUDE_ONCE; } -#line 5871 "Zend/zend_language_scanner.c" +#line 5868 "Zend/zend_language_scanner.c" yy596: YYDEBUG(596, *YYCURSOR); yych = *++YYCURSOR; @@ -5901,11 +5898,11 @@ yy601: } YYDEBUG(602, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1158 "Zend/zend_language_scanner.l" +#line 1159 "Zend/zend_language_scanner.l" { return T_INTERFACE; } -#line 5909 "Zend/zend_language_scanner.c" +#line 5906 "Zend/zend_language_scanner.c" yy603: YYDEBUG(603, *YYCURSOR); yych = *++YYCURSOR; @@ -5955,11 +5952,11 @@ yy609: } YYDEBUG(610, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1282 "Zend/zend_language_scanner.l" +#line 1283 "Zend/zend_language_scanner.l" { return T_INSTEADOF; } -#line 5963 "Zend/zend_language_scanner.c" +#line 5960 "Zend/zend_language_scanner.c" yy611: YYDEBUG(611, *YYCURSOR); yych = *++YYCURSOR; @@ -5988,11 +5985,11 @@ yy615: } YYDEBUG(616, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1110 "Zend/zend_language_scanner.l" +#line 1111 "Zend/zend_language_scanner.l" { return T_INSTANCEOF; } -#line 5996 "Zend/zend_language_scanner.c" +#line 5993 "Zend/zend_language_scanner.c" yy617: YYDEBUG(617, *YYCURSOR); yych = *++YYCURSOR; @@ -6036,11 +6033,11 @@ yy624: } YYDEBUG(625, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1170 "Zend/zend_language_scanner.l" +#line 1171 "Zend/zend_language_scanner.l" { return T_IMPLEMENTS; } -#line 6044 "Zend/zend_language_scanner.c" +#line 6041 "Zend/zend_language_scanner.c" yy626: YYDEBUG(626, *YYCURSOR); yych = *++YYCURSOR; @@ -6068,11 +6065,11 @@ yy627: } YYDEBUG(629, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1042 "Zend/zend_language_scanner.l" +#line 1043 "Zend/zend_language_scanner.l" { return T_TRY; } -#line 6076 "Zend/zend_language_scanner.c" +#line 6073 "Zend/zend_language_scanner.c" yy630: YYDEBUG(630, *YYCURSOR); yych = *++YYCURSOR; @@ -6091,11 +6088,11 @@ yy632: } YYDEBUG(633, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1162 "Zend/zend_language_scanner.l" +#line 1163 "Zend/zend_language_scanner.l" { return T_TRAIT; } -#line 6099 "Zend/zend_language_scanner.c" +#line 6096 "Zend/zend_language_scanner.c" yy634: YYDEBUG(634, *YYCURSOR); yych = *++YYCURSOR; @@ -6114,11 +6111,11 @@ yy636: } YYDEBUG(637, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1054 "Zend/zend_language_scanner.l" +#line 1055 "Zend/zend_language_scanner.l" { return T_THROW; } -#line 6122 "Zend/zend_language_scanner.c" +#line 6119 "Zend/zend_language_scanner.c" yy638: YYDEBUG(638, *YYCURSOR); yych = *++YYCURSOR; @@ -6142,11 +6139,11 @@ yy641: } YYDEBUG(642, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1038 "Zend/zend_language_scanner.l" +#line 1039 "Zend/zend_language_scanner.l" { return T_YIELD; } -#line 6150 "Zend/zend_language_scanner.c" +#line 6147 "Zend/zend_language_scanner.c" yy643: YYDEBUG(643, *YYCURSOR); yych = *++YYCURSOR; @@ -6207,11 +6204,11 @@ yy649: yy650: YYDEBUG(650, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1266 "Zend/zend_language_scanner.l" +#line 1267 "Zend/zend_language_scanner.l" { return T_REQUIRE; } -#line 6215 "Zend/zend_language_scanner.c" +#line 6212 "Zend/zend_language_scanner.c" yy651: YYDEBUG(651, *YYCURSOR); yych = *++YYCURSOR; @@ -6240,11 +6237,11 @@ yy655: } YYDEBUG(656, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1270 "Zend/zend_language_scanner.l" +#line 1271 "Zend/zend_language_scanner.l" { return T_REQUIRE_ONCE; } -#line 6248 "Zend/zend_language_scanner.c" +#line 6245 "Zend/zend_language_scanner.c" yy657: YYDEBUG(657, *YYCURSOR); yych = *++YYCURSOR; @@ -6263,11 +6260,11 @@ yy659: } YYDEBUG(660, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1034 "Zend/zend_language_scanner.l" +#line 1035 "Zend/zend_language_scanner.l" { return T_RETURN; } -#line 6271 "Zend/zend_language_scanner.c" +#line 6268 "Zend/zend_language_scanner.c" yy661: YYDEBUG(661, *YYCURSOR); yych = *++YYCURSOR; @@ -6357,11 +6354,11 @@ yy670: } YYDEBUG(671, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1138 "Zend/zend_language_scanner.l" +#line 1139 "Zend/zend_language_scanner.l" { return T_CONTINUE; } -#line 6365 "Zend/zend_language_scanner.c" +#line 6362 "Zend/zend_language_scanner.c" yy672: YYDEBUG(672, *YYCURSOR); ++YYCURSOR; @@ -6370,11 +6367,11 @@ yy672: } YYDEBUG(673, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1030 "Zend/zend_language_scanner.l" +#line 1031 "Zend/zend_language_scanner.l" { return T_CONST; } -#line 6378 "Zend/zend_language_scanner.c" +#line 6375 "Zend/zend_language_scanner.c" yy674: YYDEBUG(674, *YYCURSOR); yych = *++YYCURSOR; @@ -6399,11 +6396,11 @@ yy677: } YYDEBUG(678, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1218 "Zend/zend_language_scanner.l" +#line 1219 "Zend/zend_language_scanner.l" { return T_CLONE; } -#line 6407 "Zend/zend_language_scanner.c" +#line 6404 "Zend/zend_language_scanner.c" yy679: YYDEBUG(679, *YYCURSOR); yych = *++YYCURSOR; @@ -6417,11 +6414,11 @@ yy680: } YYDEBUG(681, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1154 "Zend/zend_language_scanner.l" +#line 1155 "Zend/zend_language_scanner.l" { return T_CLASS; } -#line 6425 "Zend/zend_language_scanner.c" +#line 6422 "Zend/zend_language_scanner.c" yy682: YYDEBUG(682, *YYCURSOR); yych = *++YYCURSOR; @@ -6467,11 +6464,11 @@ yy689: } YYDEBUG(690, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1342 "Zend/zend_language_scanner.l" +#line 1343 "Zend/zend_language_scanner.l" { return T_CALLABLE; } -#line 6475 "Zend/zend_language_scanner.c" +#line 6472 "Zend/zend_language_scanner.c" yy691: YYDEBUG(691, *YYCURSOR); ++YYCURSOR; @@ -6480,11 +6477,11 @@ yy691: } YYDEBUG(692, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1126 "Zend/zend_language_scanner.l" +#line 1127 "Zend/zend_language_scanner.l" { return T_CASE; } -#line 6488 "Zend/zend_language_scanner.c" +#line 6485 "Zend/zend_language_scanner.c" yy693: YYDEBUG(693, *YYCURSOR); yych = *++YYCURSOR; @@ -6498,11 +6495,11 @@ yy694: } YYDEBUG(695, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1046 "Zend/zend_language_scanner.l" +#line 1047 "Zend/zend_language_scanner.l" { return T_CATCH; } -#line 6506 "Zend/zend_language_scanner.c" +#line 6503 "Zend/zend_language_scanner.c" yy696: YYDEBUG(696, *YYCURSOR); yych = *++YYCURSOR; @@ -6553,11 +6550,11 @@ yy704: } YYDEBUG(705, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1026 "Zend/zend_language_scanner.l" +#line 1027 "Zend/zend_language_scanner.l" { return T_FUNCTION; } -#line 6561 "Zend/zend_language_scanner.c" +#line 6558 "Zend/zend_language_scanner.c" yy706: YYDEBUG(706, *YYCURSOR); ++YYCURSOR; @@ -6581,11 +6578,11 @@ yy706: yy707: YYDEBUG(707, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1086 "Zend/zend_language_scanner.l" +#line 1087 "Zend/zend_language_scanner.l" { return T_FOR; } -#line 6589 "Zend/zend_language_scanner.c" +#line 6586 "Zend/zend_language_scanner.c" yy708: YYDEBUG(708, *YYCURSOR); yych = *++YYCURSOR; @@ -6609,11 +6606,11 @@ yy711: } YYDEBUG(712, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1094 "Zend/zend_language_scanner.l" +#line 1095 "Zend/zend_language_scanner.l" { return T_FOREACH; } -#line 6617 "Zend/zend_language_scanner.c" +#line 6614 "Zend/zend_language_scanner.c" yy713: YYDEBUG(713, *YYCURSOR); yych = *++YYCURSOR; @@ -6647,11 +6644,11 @@ yy715: yy716: YYDEBUG(716, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1310 "Zend/zend_language_scanner.l" +#line 1311 "Zend/zend_language_scanner.l" { return T_FINAL; } -#line 6655 "Zend/zend_language_scanner.c" +#line 6652 "Zend/zend_language_scanner.c" yy717: YYDEBUG(717, *YYCURSOR); yych = *++YYCURSOR; @@ -6665,11 +6662,11 @@ yy718: } YYDEBUG(719, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1050 "Zend/zend_language_scanner.l" +#line 1051 "Zend/zend_language_scanner.l" { return T_FINALLY; } -#line 6673 "Zend/zend_language_scanner.c" +#line 6670 "Zend/zend_language_scanner.c" yy720: YYDEBUG(720, *YYCURSOR); yych = *++YYCURSOR; @@ -6700,11 +6697,11 @@ yy722: } YYDEBUG(723, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1082 "Zend/zend_language_scanner.l" +#line 1083 "Zend/zend_language_scanner.l" { return T_DO; } -#line 6708 "Zend/zend_language_scanner.c" +#line 6705 "Zend/zend_language_scanner.c" yy724: YYDEBUG(724, *YYCURSOR); ++YYCURSOR; @@ -6713,11 +6710,11 @@ yy724: } YYDEBUG(725, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1022 "Zend/zend_language_scanner.l" +#line 1023 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6721 "Zend/zend_language_scanner.c" +#line 6718 "Zend/zend_language_scanner.c" yy726: YYDEBUG(726, *YYCURSOR); yych = *++YYCURSOR; @@ -6752,11 +6749,11 @@ yy731: } YYDEBUG(732, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1130 "Zend/zend_language_scanner.l" +#line 1131 "Zend/zend_language_scanner.l" { return T_DEFAULT; } -#line 6760 "Zend/zend_language_scanner.c" +#line 6757 "Zend/zend_language_scanner.c" yy733: YYDEBUG(733, *YYCURSOR); yych = *++YYCURSOR; @@ -6780,11 +6777,11 @@ yy736: } YYDEBUG(737, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1102 "Zend/zend_language_scanner.l" +#line 1103 "Zend/zend_language_scanner.l" { return T_DECLARE; } -#line 6788 "Zend/zend_language_scanner.c" +#line 6785 "Zend/zend_language_scanner.c" yy738: YYDEBUG(738, *YYCURSOR); yych = *++YYCURSOR; @@ -6864,11 +6861,11 @@ yy749: } YYDEBUG(750, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1166 "Zend/zend_language_scanner.l" +#line 1167 "Zend/zend_language_scanner.l" { return T_EXTENDS; } -#line 6872 "Zend/zend_language_scanner.c" +#line 6869 "Zend/zend_language_scanner.c" yy751: YYDEBUG(751, *YYCURSOR); ++YYCURSOR; @@ -6877,11 +6874,11 @@ yy751: } YYDEBUG(752, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1018 "Zend/zend_language_scanner.l" +#line 1019 "Zend/zend_language_scanner.l" { return T_EXIT; } -#line 6885 "Zend/zend_language_scanner.c" +#line 6882 "Zend/zend_language_scanner.c" yy753: YYDEBUG(753, *YYCURSOR); yych = *++YYCURSOR; @@ -6895,11 +6892,11 @@ yy754: } YYDEBUG(755, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1254 "Zend/zend_language_scanner.l" +#line 1255 "Zend/zend_language_scanner.l" { return T_EVAL; } -#line 6903 "Zend/zend_language_scanner.c" +#line 6900 "Zend/zend_language_scanner.c" yy756: YYDEBUG(756, *YYCURSOR); yych = *++YYCURSOR; @@ -6969,11 +6966,11 @@ yy765: } YYDEBUG(766, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1078 "Zend/zend_language_scanner.l" +#line 1079 "Zend/zend_language_scanner.l" { return T_ENDWHILE; } -#line 6977 "Zend/zend_language_scanner.c" +#line 6974 "Zend/zend_language_scanner.c" yy767: YYDEBUG(767, *YYCURSOR); yych = *++YYCURSOR; @@ -7002,11 +6999,11 @@ yy771: } YYDEBUG(772, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1122 "Zend/zend_language_scanner.l" +#line 1123 "Zend/zend_language_scanner.l" { return T_ENDSWITCH; } -#line 7010 "Zend/zend_language_scanner.c" +#line 7007 "Zend/zend_language_scanner.c" yy773: YYDEBUG(773, *YYCURSOR); ++YYCURSOR; @@ -7015,11 +7012,11 @@ yy773: } YYDEBUG(774, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1066 "Zend/zend_language_scanner.l" +#line 1067 "Zend/zend_language_scanner.l" { return T_ENDIF; } -#line 7023 "Zend/zend_language_scanner.c" +#line 7020 "Zend/zend_language_scanner.c" yy775: YYDEBUG(775, *YYCURSOR); yych = *++YYCURSOR; @@ -7048,11 +7045,11 @@ yy776: yy777: YYDEBUG(777, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1090 "Zend/zend_language_scanner.l" +#line 1091 "Zend/zend_language_scanner.l" { return T_ENDFOR; } -#line 7056 "Zend/zend_language_scanner.c" +#line 7053 "Zend/zend_language_scanner.c" yy778: YYDEBUG(778, *YYCURSOR); yych = *++YYCURSOR; @@ -7076,11 +7073,11 @@ yy781: } YYDEBUG(782, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1098 "Zend/zend_language_scanner.l" +#line 1099 "Zend/zend_language_scanner.l" { return T_ENDFOREACH; } -#line 7084 "Zend/zend_language_scanner.c" +#line 7081 "Zend/zend_language_scanner.c" yy783: YYDEBUG(783, *YYCURSOR); yych = *++YYCURSOR; @@ -7114,11 +7111,11 @@ yy788: } YYDEBUG(789, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1106 "Zend/zend_language_scanner.l" +#line 1107 "Zend/zend_language_scanner.l" { return T_ENDDECLARE; } -#line 7122 "Zend/zend_language_scanner.c" +#line 7119 "Zend/zend_language_scanner.c" yy790: YYDEBUG(790, *YYCURSOR); yych = *++YYCURSOR; @@ -7137,11 +7134,11 @@ yy792: } YYDEBUG(793, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1294 "Zend/zend_language_scanner.l" +#line 1295 "Zend/zend_language_scanner.l" { return T_EMPTY; } -#line 7145 "Zend/zend_language_scanner.c" +#line 7142 "Zend/zend_language_scanner.c" yy794: YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; @@ -7170,11 +7167,11 @@ yy795: yy796: YYDEBUG(796, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1070 "Zend/zend_language_scanner.l" +#line 1071 "Zend/zend_language_scanner.l" { return T_ELSE; } -#line 7178 "Zend/zend_language_scanner.c" +#line 7175 "Zend/zend_language_scanner.c" yy797: YYDEBUG(797, *YYCURSOR); yych = *++YYCURSOR; @@ -7188,11 +7185,11 @@ yy798: } YYDEBUG(799, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1062 "Zend/zend_language_scanner.l" +#line 1063 "Zend/zend_language_scanner.l" { return T_ELSEIF; } -#line 7196 "Zend/zend_language_scanner.c" +#line 7193 "Zend/zend_language_scanner.c" yy800: YYDEBUG(800, *YYCURSOR); yych = *++YYCURSOR; @@ -7206,11 +7203,11 @@ yy801: } YYDEBUG(802, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1146 "Zend/zend_language_scanner.l" +#line 1147 "Zend/zend_language_scanner.l" { return T_ECHO; } -#line 7214 "Zend/zend_language_scanner.c" +#line 7211 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_LOOKING_FOR_PROPERTY: @@ -7283,14 +7280,14 @@ yy805: yy806: YYDEBUG(806, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1179 "Zend/zend_language_scanner.l" +#line 1180 "Zend/zend_language_scanner.l" { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } -#line 7294 "Zend/zend_language_scanner.c" +#line 7291 "Zend/zend_language_scanner.c" yy807: YYDEBUG(807, *YYCURSOR); ++YYCURSOR; @@ -7298,13 +7295,13 @@ yy807: yy808: YYDEBUG(808, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1196 "Zend/zend_language_scanner.l" +#line 1197 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); goto restart; } -#line 7308 "Zend/zend_language_scanner.c" +#line 7305 "Zend/zend_language_scanner.c" yy809: YYDEBUG(809, *YYCURSOR); ++YYCURSOR; @@ -7313,13 +7310,13 @@ yy809: yy810: YYDEBUG(810, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1190 "Zend/zend_language_scanner.l" +#line 1191 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); zend_copy_value(zendlval, yytext, yyleng); return T_STRING; } -#line 7323 "Zend/zend_language_scanner.c" +#line 7320 "Zend/zend_language_scanner.c" yy811: YYDEBUG(811, *YYCURSOR); yych = *++YYCURSOR; @@ -7340,11 +7337,11 @@ yy814: ++YYCURSOR; YYDEBUG(815, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1186 "Zend/zend_language_scanner.l" +#line 1187 "Zend/zend_language_scanner.l" { return T_OBJECT_OPERATOR; } -#line 7348 "Zend/zend_language_scanner.c" +#line 7345 "Zend/zend_language_scanner.c" yy816: YYDEBUG(816, *YYCURSOR); ++YYCURSOR; @@ -7429,14 +7426,14 @@ yy820: yy821: YYDEBUG(821, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1485 "Zend/zend_language_scanner.l" +#line 1486 "Zend/zend_language_scanner.l" { yyless(0); yy_pop_state(TSRMLS_C); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); goto restart; } -#line 7440 "Zend/zend_language_scanner.c" +#line 7437 "Zend/zend_language_scanner.c" yy822: YYDEBUG(822, *YYCURSOR); yych = *++YYCURSOR; @@ -7461,7 +7458,7 @@ yy826: ++YYCURSOR; YYDEBUG(827, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1476 "Zend/zend_language_scanner.l" +#line 1477 "Zend/zend_language_scanner.l" { yyless(yyleng - 1); zend_copy_value(zendlval, yytext, yyleng); @@ -7469,7 +7466,7 @@ yy826: yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); return T_STRING_VARNAME; } -#line 7473 "Zend/zend_language_scanner.c" +#line 7470 "Zend/zend_language_scanner.c" } /* *********************************** */ yyc_ST_NOWDOC: @@ -7480,7 +7477,7 @@ yyc_ST_NOWDOC: ++YYCURSOR; YYDEBUG(831, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2324 "Zend/zend_language_scanner.l" +#line 2321 "Zend/zend_language_scanner.l" { int newline = 0; @@ -7536,7 +7533,7 @@ nowdoc_scan_done: HANDLE_NEWLINES(yytext, yyleng - newline); return T_ENCAPSED_AND_WHITESPACE; } -#line 7540 "Zend/zend_language_scanner.c" +#line 7537 "Zend/zend_language_scanner.c" /* *********************************** */ yyc_ST_VAR_OFFSET: { @@ -7643,7 +7640,7 @@ yy834: yy835: YYDEBUG(835, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1561 "Zend/zend_language_scanner.l" +#line 1557 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { ZVAL_LONG(zendlval, strtol(yytext, NULL, 10)); @@ -7652,7 +7649,7 @@ yy835: } return T_NUM_STRING; } -#line 7656 "Zend/zend_language_scanner.c" +#line 7653 "Zend/zend_language_scanner.c" yy836: YYDEBUG(836, *YYCURSOR); yych = *++YYCURSOR; @@ -7672,23 +7669,23 @@ yy837: yy838: YYDEBUG(838, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1856 "Zend/zend_language_scanner.l" +#line 1853 "Zend/zend_language_scanner.l" { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -#line 7681 "Zend/zend_language_scanner.c" +#line 7678 "Zend/zend_language_scanner.c" yy839: YYDEBUG(839, *YYCURSOR); ++YYCURSOR; YYDEBUG(840, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1851 "Zend/zend_language_scanner.l" +#line 1848 "Zend/zend_language_scanner.l" { yy_pop_state(TSRMLS_C); return ']'; } -#line 7692 "Zend/zend_language_scanner.c" +#line 7689 "Zend/zend_language_scanner.c" yy841: YYDEBUG(841, *YYCURSOR); yych = *++YYCURSOR; @@ -7698,14 +7695,14 @@ yy842: ++YYCURSOR; YYDEBUG(843, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1861 "Zend/zend_language_scanner.l" +#line 1858 "Zend/zend_language_scanner.l" { /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); return T_ENCAPSED_AND_WHITESPACE; } -#line 7709 "Zend/zend_language_scanner.c" +#line 7706 "Zend/zend_language_scanner.c" yy844: YYDEBUG(844, *YYCURSOR); ++YYCURSOR; @@ -7714,18 +7711,18 @@ yy844: yy845: YYDEBUG(845, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1868 "Zend/zend_language_scanner.l" +#line 1865 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, yytext, yyleng); return T_STRING; } -#line 7723 "Zend/zend_language_scanner.c" +#line 7720 "Zend/zend_language_scanner.c" yy846: YYDEBUG(846, *YYCURSOR); ++YYCURSOR; YYDEBUG(847, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2381 "Zend/zend_language_scanner.l" +#line 2378 "Zend/zend_language_scanner.l" { if (YYCURSOR > YYLIMIT) { return 0; @@ -7734,7 +7731,7 @@ yy846: zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE); goto restart; } -#line 7738 "Zend/zend_language_scanner.c" +#line 7735 "Zend/zend_language_scanner.c" yy848: YYDEBUG(848, *YYCURSOR); ++YYCURSOR; @@ -7770,12 +7767,12 @@ yy850: yy852: YYDEBUG(852, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1846 "Zend/zend_language_scanner.l" +#line 1843 "Zend/zend_language_scanner.l" { zend_copy_value(zendlval, (yytext+1), (yyleng-1)); return T_VARIABLE; } -#line 7779 "Zend/zend_language_scanner.c" +#line 7776 "Zend/zend_language_scanner.c" yy853: YYDEBUG(853, *YYCURSOR); ++YYCURSOR; @@ -7815,12 +7812,12 @@ yy858: yy860: YYDEBUG(860, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1570 "Zend/zend_language_scanner.l" +#line 1566 "Zend/zend_language_scanner.l" { /* Offset must be treated as a string */ ZVAL_STRINGL(zendlval, yytext, yyleng); return T_NUM_STRING; } -#line 7824 "Zend/zend_language_scanner.c" +#line 7821 "Zend/zend_language_scanner.c" yy861: YYDEBUG(861, *YYCURSOR); ++YYCURSOR; @@ -7843,6 +7840,6 @@ yy863: goto yy860; } } -#line 2390 "Zend/zend_language_scanner.l" +#line 2387 "Zend/zend_language_scanner.l" } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index b34ce73ff2c..2ad186dd16b 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -656,6 +656,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ old_len = Z_STRLEN_P(str); Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1); SCNG(yy_in) = NULL; @@ -1178,7 +1179,7 @@ NEWLINE ("\r"|"\n"|"\r\n") {WHITESPACE}+ { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ HANDLE_NEWLINES(yytext, yyleng); return T_WHITESPACE; } @@ -1501,11 +1502,10 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_LONG * 8) { if (len == 0) { - Z_LVAL_P(zendlval) = 0; + ZVAL_LONG(zendlval, 0); } else { - Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); + ZVAL_LONG(zendlval, strtol(bin, NULL, 2)); } - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); @@ -1515,22 +1515,19 @@ NEWLINE ("\r"|"\n"|"\r\n") {LNUM} { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); + ZVAL_LONG(zendlval, strtol(yytext, NULL, 0)); } else { errno = 0; - Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0); + ZVAL_LONG(zendlval, strtol(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ - Z_DVAL_P(zendlval) = zend_oct_strtod(yytext, NULL); + ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); } else { - Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); + ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL)); } - Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } } - - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } @@ -1546,11 +1543,10 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_LONG * 2 || (len == SIZEOF_LONG * 2 && *hex <= '7')) { if (len == 0) { - Z_LVAL_P(zendlval) = 0; + ZVAL_LONG(zendlval, 0); } else { - Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); + ZVAL_LONG(zendlval, strtol(hex, NULL, 16)); } - Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); @@ -1583,7 +1579,7 @@ NEWLINE ("\r"|"\n"|"\r\n") /* We create a special __CLASS__ constant that is going to be resolved at run-time */ ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1); - Z_TYPE_P(zendlval) = IS_CONSTANT; + Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; } else { if (ce && ce->name) { ZVAL_STR(zendlval, STR_COPY(ce->name)); @@ -1625,7 +1621,7 @@ NEWLINE ("\r"|"\n"|"\r\n") len += sizeof("::")-1; len += CG(active_op_array)->function_name->len; } - ZVAL_STR(zendlval, STR_ALLOC(len, 0)); + ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0)); len = 0; if (CG(active_class_entry)->name) { memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len); @@ -1655,9 +1651,10 @@ NEWLINE ("\r"|"\n"|"\r\n") zend_string *filename = zend_get_compiled_filename(TSRMLS_C); if (!filename) { - filename = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(zendlval); + } else { + ZVAL_STR(zendlval, STR_COPY(filename)); } - ZVAL_STR(zendlval, STR_COPY(filename)); return T_FILE; } @@ -1706,7 +1703,7 @@ NEWLINE ("\r"|"\n"|"\r\n") HANDLE_NEWLINES(yytext, yyleng); //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } @@ -1715,7 +1712,7 @@ NEWLINE ("\r"|"\n"|"\r\n") "<%=" { if (CG(asp_tags)) { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { @@ -1726,7 +1723,7 @@ NEWLINE ("\r"|"\n"|"\r\n") ""<%" { if (CG(asp_tags)) { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { @@ -1746,7 +1743,7 @@ NEWLINE ("\r"|"\n"|"\r\n") ""("?>"|""){NEWLINE}? { //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ BEGIN(INITIAL); return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } @@ -1950,7 +1947,7 @@ inline_html: if (CG(asp_tags)) { BEGIN(INITIAL); //??? ZVAL_STRINGL(zendlval, yytext, yyleng); - ZVAL_STR(zendlval, STR_EMPTY_ALLOC()); /* tricky way to no copying - intentional */ + ZVAL_EMPTY_STRING(zendlval); /* tricky way to no copying - intentional */ return T_CLOSE_TAG; /* implicit ';' at php-end tag */ } else { yyless(1); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f2082b4ba02..93d7652436d 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -198,14 +198,14 @@ try_again: zend_string *str; str = Z_STR_P(op); - if ((Z_TYPE_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { + if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { ZVAL_LONG(op, 0); } STR_RELEASE(str); break; } case IS_BOOL: - Z_TYPE_P(op) = IS_LONG; + Z_TYPE_INFO_P(op) = IS_LONG; break; case IS_RESOURCE: { @@ -234,7 +234,7 @@ try_again: switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ + if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ ZVAL_LONG(&(holder), 0); \ } \ (op) = &(holder); \ @@ -272,23 +272,23 @@ try_again: } else if (Z_TYPE_P(op) != IS_LONG) { \ switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - Z_LVAL(holder) = 0; \ + ZVAL_LONG(&holder, 0); \ break; \ case IS_DOUBLE: \ - Z_LVAL(holder) = zend_dval_to_lval(Z_DVAL_P(op)); \ + ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\ break; \ case IS_STRING: \ - Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \ + ZVAL_LONG(&holder, strtol(Z_STRVAL_P(op), NULL, 10));\ break; \ case IS_ARRAY: \ - Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ + ZVAL_LONG(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ ZVAL_DUP(&(holder), (op)); \ convert_to_long_base(&(holder), 10); \ break; \ case IS_BOOL: \ - Z_LVAL(holder) = Z_LVAL_P(op); \ + ZVAL_LONG(&(holder), Z_LVAL_P(op)); \ break; \ case IS_RESOURCE: \ /* ??? delete old resource ??? */ \ @@ -296,10 +296,9 @@ try_again: break; \ default: \ zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - Z_LVAL(holder) = 0; \ + ZVAL_LONG(&holder, 0); \ break; \ } \ - Z_TYPE(holder) = IS_LONG; \ (op) = &(holder); \ } @@ -312,37 +311,36 @@ try_again: } else if (Z_TYPE_P(op) != IS_BOOL) { \ switch (Z_TYPE_P(op)) { \ case IS_NULL: \ - Z_LVAL(holder) = 0; \ + ZVAL_BOOL(&holder, 0); \ break; \ case IS_RESOURCE: \ - Z_LVAL(holder) = (Z_RES_HANDLE_P(op) ? 1 : 0); \ + ZVAL_BOOL(&holder, Z_RES_HANDLE_P(op) ? 1 : 0); \ break; \ case IS_LONG: \ - Z_LVAL(holder) = (Z_LVAL_P(op) ? 1 : 0); \ + ZVAL_BOOL(&holder, Z_LVAL_P(op) ? 1 : 0); \ break; \ case IS_DOUBLE: \ - Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \ + ZVAL_BOOL(&holder, Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ if (Z_STRLEN_P(op) == 0 \ || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ - Z_LVAL(holder) = 0; \ + ZVAL_BOOL(&holder, 0); \ } else { \ - Z_LVAL(holder) = 1; \ + ZVAL_BOOL(&holder, 1); \ } \ break; \ case IS_ARRAY: \ - Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ + ZVAL_BOOL(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ break; \ case IS_OBJECT: \ ZVAL_DUP(&(holder), (op)); \ convert_to_boolean(&(holder)); \ break; \ default: \ - Z_LVAL(holder) = 0; \ + ZVAL_BOOL(&holder, 0); \ break; \ } \ - Z_TYPE(holder) = IS_BOOL; \ (op) = &(holder); \ } @@ -359,8 +357,7 @@ try_again: zend_get_type_by_const(ctype)); \ } else { \ zval_dtor(op); \ - Z_TYPE_P(op) = ctype; \ - op->value = dst.value; \ + ZVAL_COPY_VALUE(op, &dst); \ } \ } else { \ if (Z_OBJ_HT_P(op)->get) { \ @@ -390,33 +387,35 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */ switch (Z_TYPE_P(op)) { case IS_NULL: - Z_LVAL_P(op) = 0; + ZVAL_LONG(op, 0); break; case IS_RESOURCE: { TSRMLS_FETCH(); long l = Z_RES_HANDLE_P(op); zval_ptr_dtor(op); - Z_LVAL_P(op) = l; + ZVAL_LONG(op, l); } /* break missing intentionally */ case IS_BOOL: + Z_TYPE_INFO_P(op) = IS_LONG; + break; case IS_LONG: break; case IS_DOUBLE: - Z_LVAL_P(op) = zend_dval_to_lval(Z_DVAL_P(op)); + ZVAL_LONG(op, zend_dval_to_lval(Z_DVAL_P(op))); break; case IS_STRING: { zend_string *str = Z_STR_P(op); - Z_LVAL_P(op) = strtol(str->val, NULL, base); + ZVAL_LONG(op, strtol(str->val, NULL, base)); STR_RELEASE(str); } break; case IS_ARRAY: tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - Z_LVAL_P(op) = tmp; + ZVAL_LONG(op, tmp); break; case IS_OBJECT: { @@ -437,11 +436,9 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */ default: zend_error(E_WARNING, "Cannot convert to ordinal value"); zval_dtor(op); - Z_LVAL_P(op) = 0; + ZVAL_LONG(op, 0); break; } - - Z_TYPE_P(op) = IS_LONG; } /* }}} */ @@ -451,18 +448,18 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ switch (Z_TYPE_P(op)) { case IS_NULL: - Z_DVAL_P(op) = 0.0; + ZVAL_DOUBLE(op, 0.0); break; case IS_RESOURCE: { TSRMLS_FETCH(); double d = (double) Z_RES_HANDLE_P(op); zval_ptr_dtor(op); - Z_DVAL_P(op) = d; + ZVAL_DOUBLE(op, d); } break; case IS_BOOL: case IS_LONG: - Z_DVAL_P(op) = (double) Z_LVAL_P(op); + ZVAL_DOUBLE(op, (double) Z_LVAL_P(op)); break; case IS_DOUBLE: break; @@ -470,14 +467,14 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ { zend_string *str = Z_STR_P(op); - Z_DVAL_P(op) = zend_strtod(str->val, NULL); + ZVAL_DOUBLE(op, zend_strtod(str->val, NULL)); STR_RELEASE(str); } break; case IS_ARRAY: tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - Z_DVAL_P(op) = tmp; + ZVAL_DOUBLE(op, tmp); break; case IS_OBJECT: { @@ -498,10 +495,9 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ default: zend_error(E_WARNING, "Cannot convert to real value (type=%d)", Z_TYPE_P(op)); zval_dtor(op); - Z_DVAL_P(op) = 0; + ZVAL_DOUBLE(op, 0); break; } - Z_TYPE_P(op) = IS_DOUBLE; } /* }}} */ @@ -522,7 +518,7 @@ ZEND_API void convert_to_null(zval *op) /* {{{ */ } zval_dtor(op); - Z_TYPE_P(op) = IS_NULL; + ZVAL_NULL(op); } /* }}} */ @@ -534,21 +530,21 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ case IS_BOOL: break; case IS_NULL: - Z_LVAL_P(op) = 0; + ZVAL_BOOL(op, 0); break; case IS_RESOURCE: { TSRMLS_FETCH(); long l = (Z_RES_HANDLE_P(op) ? 1 : 0); zval_ptr_dtor(op); - Z_LVAL_P(op) = l; + ZVAL_BOOL(op, l); } break; case IS_LONG: - Z_LVAL_P(op) = (Z_LVAL_P(op) ? 1 : 0); + ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0); break; case IS_DOUBLE: - Z_LVAL_P(op) = (Z_DVAL_P(op) ? 1 : 0); + ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: { @@ -556,9 +552,9 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ if (str->len == 0 || (str->len == 1 && str->val[0] == '0')) { - Z_LVAL_P(op) = 0; + ZVAL_BOOL(op, 0); } else { - Z_LVAL_P(op) = 1; + ZVAL_BOOL(op, 1); } STR_RELEASE(str); } @@ -566,7 +562,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ case IS_ARRAY: tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - Z_LVAL_P(op) = tmp; + ZVAL_BOOL(op, tmp); break; case IS_OBJECT: { @@ -585,28 +581,27 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } default: zval_dtor(op); - Z_LVAL_P(op) = 0; + ZVAL_BOOL(op, 0); break; } - Z_TYPE_P(op) = IS_BOOL; } /* }}} */ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { - double dval; - switch (Z_TYPE_P(op)) { - case IS_DOUBLE: { - TSRMLS_FETCH(); - dval = Z_DVAL_P(op); - Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); - /* %H already handles removing trailing zeros from the fractional part, yay */ - break; - } - default: +//??? double dval; +//??? switch (Z_TYPE_P(op)) { +//??? case IS_DOUBLE: { +//??? TSRMLS_FETCH(); +//??? dval = Z_DVAL_P(op); +//??? Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); +//??? /* %H already handles removing trailing zeros from the fractional part, yay */ +//??? break; +//??? } +//??? default: _convert_to_string(op ZEND_FILE_LINE_CC); - } - Z_TYPE_P(op) = IS_STRING; +//??? } +//??? Z_TYPE_P(op) = IS_STRING; } /* }}} */ @@ -617,15 +612,15 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ switch (Z_TYPE_P(op)) { case IS_NULL: - Z_STR_P(op) = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(op); break; case IS_STRING: break; case IS_BOOL: if (Z_LVAL_P(op)) { - Z_STR_P(op) = STR_INIT("1", 1, 0); + ZVAL_NEW_STR(op, STR_INIT("1", 1, 0)); } else { - Z_STR_P(op) = STR_EMPTY_ALLOC(); + ZVAL_EMPTY_STRING(op); } break; case IS_RESOURCE: { @@ -636,7 +631,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zval_ptr_dtor(op); len = zend_spprintf(&str, 0, "Resource id #%ld", tmp); - Z_STR_P(op) = STR_INIT(str, len, 0); + ZVAL_NEW_STR(op, STR_INIT(str, len, 0)); efree(str); break; } @@ -646,7 +641,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ lval = Z_LVAL_P(op); len = zend_spprintf(&str, 0, "%ld", lval); - Z_STR_P(op) = STR_INIT(str, len, 0); + ZVAL_NEW_STR(op, STR_INIT(str, len, 0)); efree(str); break; } @@ -658,14 +653,14 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ dval = Z_DVAL_P(op); len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), dval); /* %G already handles removing trailing zeros from the fractional part, yay */ - Z_STR_P(op) = STR_INIT(str, len, 0); + ZVAL_NEW_STR(op, STR_INIT(str, len, 0)); efree(str); break; } case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); - Z_STR_P(op) = STR_INIT("Array", sizeof("Array")-1, 0); + ZVAL_NEW_STR(op, STR_INIT("Array", sizeof("Array")-1, 0)); break; case IS_OBJECT: { TSRMLS_FETCH(); @@ -678,7 +673,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val); zval_dtor(op); - Z_STR_P(op) = STR_INIT("Object", sizeof("Object")-1, 0); + ZVAL_NEW_STR(op, STR_INIT("Object", sizeof("Object")-1, 0)); break; } default: @@ -687,7 +682,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ ZVAL_BOOL(op, 0); break; } - Z_TYPE_P(op) = IS_STRING; } /* }}} */ @@ -702,7 +696,6 @@ static void convert_scalar_to_array(zval *op, int type TSRMLS_DC) /* {{{ */ ZVAL_NEW_ARR(op); zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_index_update(Z_ARRVAL_P(op), 0, &entry); - Z_TYPE_P(op) = IS_ARRAY; break; case IS_OBJECT: object_init(op); @@ -965,7 +958,7 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * long overflow; 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; + Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG; return SUCCESS; } @@ -1153,8 +1146,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ int i; zval op1_copy = *op1; - Z_TYPE_P(result) = IS_STRING; - Z_STR_P(result) = STR_ALLOC(Z_STRLEN(op1_copy), 0); + ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN(op1_copy), 0)); for (i = 0; i < Z_STRLEN(op1_copy); i++) { Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i]; } @@ -1196,7 +1188,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / if (result==op1) { STR_RELEASE(Z_STR_P(result)); } - ZVAL_STR(result, str); + ZVAL_NEW_STR(result, str); return SUCCESS; } @@ -1241,7 +1233,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (result==op1) { STR_RELEASE(Z_STR_P(result)); } - ZVAL_STR(result, str); + ZVAL_NEW_STR(result, str); return SUCCESS; } @@ -1286,7 +1278,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (result==op1) { STR_RELEASE(Z_STR_P(result)); } - ZVAL_STR(result, str); + ZVAL_NEW_STR(result, str); return SUCCESS; } @@ -1353,7 +1345,7 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) buf->val[length - 1] = (char) Z_LVAL_P(op2); buf->val[length] = 0; - ZVAL_STR(result, buf); + ZVAL_NEW_STR(result, buf); return SUCCESS; } /* }}} */ @@ -1367,7 +1359,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2 memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf->val[length] = 0; - ZVAL_STR(result, buf); + ZVAL_NEW_STR(result, buf); return SUCCESS; } /* }}} */ @@ -1411,7 +1403,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ } Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len, 0 ); - + Z_TYPE_INFO_P(result) = IS_STRING_EX; memcpy(Z_STRVAL_P(result) + op1_len, Z_STRVAL_P(op2), op2_len); Z_STRVAL_P(result)[res_len]=0; } else { @@ -1421,7 +1413,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ memcpy(buf->val, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); memcpy(buf->val + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf->val[length] = 0; - ZVAL_STR(result, buf); + ZVAL_NEW_STR(result, buf); } if (use_copy1) { zval_dtor(op1); @@ -1736,42 +1728,42 @@ static int hash_zval_identical_function(const zval *z1, const zval *z2) /* {{{ * ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { - Z_TYPE_P(result) = IS_BOOL; if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { - Z_LVAL_P(result) = 0; + ZVAL_BOOL(result, 0); return SUCCESS; } switch (Z_TYPE_P(op1)) { case IS_NULL: - Z_LVAL_P(result) = 1; + ZVAL_BOOL(result, 1); break; case IS_BOOL: case IS_LONG: - Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); + ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2)); break; case IS_RESOURCE: - Z_LVAL_P(result) = (Z_RES_P(op1) == Z_RES_P(op2)); + ZVAL_BOOL(result, Z_RES_P(op1) == Z_RES_P(op2)); break; case IS_DOUBLE: - Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); + ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2)); break; case IS_STRING: - Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) +// TODO: interned strings ??? + ZVAL_BOOL(result, (Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); break; case IS_ARRAY: - Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || + ZVAL_BOOL(result, Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1 TSRMLS_CC)==0); break; case IS_OBJECT: if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { - Z_LVAL_P(result) = (Z_OBJ_P(op1) == Z_OBJ_P(op2)); + ZVAL_BOOL(result, Z_OBJ_P(op1) == Z_OBJ_P(op2)); } else { - Z_LVAL_P(result) = 0; + ZVAL_BOOL(result, 0); } break; default: - Z_LVAL_P(result) = 0; + ZVAL_BOOL(result, 0); return FAILURE; } return SUCCESS; @@ -1872,11 +1864,13 @@ static void increment_string(zval *str) /* {{{ */ if (Z_STRLEN_P(str) == 0) { STR_RELEASE(Z_STR_P(str)); Z_STR_P(str) = STR_INIT("1", sizeof("1")-1, 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; return; } if (IS_INTERNED(Z_STR_P(str))) { Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0); + Z_TYPE_INFO_P(str) = IS_STRING_EX; } else if (Z_REFCOUNT_P(str) > 1) { Z_DELREF_P(str); Z_STR_P(str) = STR_INIT(Z_STRVAL_P(str), Z_STRLEN_P(str), 0); @@ -1940,7 +1934,7 @@ static void increment_string(zval *str) /* {{{ */ break; } STR_FREE(Z_STR_P(str)); - ZVAL_STR(str, t); + ZVAL_NEW_STR(str, t); } } /* }}} */ @@ -2342,17 +2336,15 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC) /* ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { - Z_TYPE_P(result) = IS_LONG; - if (Z_OBJ_P(o1) == Z_OBJ_P(o2)) { - Z_LVAL_P(result) = 0; + ZVAL_LONG(result, 0); return; } if (Z_OBJ_HT_P(o1)->compare_objects == NULL) { - Z_LVAL_P(result) = 1; + ZVAL_LONG(result, 1); } else { - Z_LVAL_P(result) = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC); + ZVAL_LONG(result, Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC)); } } /* }}} */ @@ -2364,7 +2356,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */ int len; len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); - Z_STR_P(op) = STR_INIT(str, len, 0); + ZVAL_NEW_STR(op, STR_INIT(str, len, 0)); efree(str); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 1fe473ba52e..17d60a9b041 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -449,7 +449,7 @@ ZEND_API void zend_update_current_locale(void); /* The offset in bytes between the value and type fields of a zval */ #define ZVAL_OFFSETOF_TYPE \ - (offsetof(zval, u.v.type) - offsetof(zval, value)) + (offsetof(zval, u1.type_info) - offsetof(zval, value)) static zend_always_inline int fast_increment_function(zval *op1) { @@ -460,7 +460,7 @@ static zend_always_inline int fast_increment_function(zval *op1) "jno 0f\n\t" "movl $0x0, (%0)\n\t" "movl $0x41e00000, 0x4(%0)\n\t" - "movb %1, %c2(%0)\n" + "movl %1, %c2(%0)\n" "0:" : : "r"(&op1->value), @@ -473,7 +473,7 @@ static zend_always_inline int fast_increment_function(zval *op1) "jno 0f\n\t" "movl $0x0, (%0)\n\t" "movl $0x43e00000, 0x4(%0)\n\t" - "movb %1, %c2(%0)\n" + "movl %1, %c2(%0)\n" "0:" : : "r"(&op1->value), @@ -483,8 +483,7 @@ static zend_always_inline int fast_increment_function(zval *op1) #else if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MAX)) { /* switch to double */ - Z_DVAL_P(op1) = (double)LONG_MAX + 1.0; - Z_TYPE_P(op1) = IS_DOUBLE; + ZVAL_DOUBLE(op1, (double)LONG_MAX + 1.0); } else { Z_LVAL_P(op1)++; } @@ -503,7 +502,7 @@ static zend_always_inline int fast_decrement_function(zval *op1) "jno 0f\n\t" "movl $0x00200000, (%0)\n\t" "movl $0xc1e00000, 0x4(%0)\n\t" - "movb %1,%c2(%0)\n" + "movl %1,%c2(%0)\n" "0:" : : "r"(&op1->value), @@ -516,7 +515,7 @@ static zend_always_inline int fast_decrement_function(zval *op1) "jno 0f\n\t" "movl $0x00000000, (%0)\n\t" "movl $0xc3e00000, 0x4(%0)\n\t" - "movb %1,%c2(%0)\n" + "movl %1,%c2(%0)\n" "0:" : : "r"(&op1->value), @@ -526,8 +525,7 @@ static zend_always_inline int fast_decrement_function(zval *op1) #else if (UNEXPECTED(Z_LVAL_P(op1) == LONG_MIN)) { /* switch to double */ - Z_DVAL_P(op1) = (double)LONG_MIN - 1.0; - Z_TYPE_P(op1) = IS_DOUBLE; + ZVAL_DOUBLE(op1, (double)LONG_MIN - 1.0); } else { Z_LVAL_P(op1)--; } @@ -547,13 +545,13 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o "addl (%2), %%eax\n\t" "jo 0f\n\t" "movl %%eax, (%0)\n\t" - "movb %3, %c5(%0)\n\t" + "movl %3, %c5(%0)\n\t" "jmp 1f\n" "0:\n\t" "fildl (%1)\n\t" "fildl (%2)\n\t" "faddp %%st, %%st(1)\n\t" - "movb %4, %c5(%0)\n\t" + "movl %4, %c5(%0)\n\t" "fstpl (%0)\n" "1:" : @@ -570,13 +568,13 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o "addq (%2), %%rax\n\t" "jo 0f\n\t" "movq %%rax, (%0)\n\t" - "movb %3, %c5(%0)\n\t" + "movl %3, %c5(%0)\n\t" "jmp 1f\n" "0:\n\t" "fildq (%1)\n\t" "fildq (%2)\n\t" "faddp %%st, %%st(1)\n\t" - "movb %4, %c5(%0)\n\t" + "movl %4, %c5(%0)\n\t" "fstpl (%0)\n" "1:" : @@ -596,27 +594,22 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) { - Z_DVAL_P(result) = (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); } else { - Z_LVAL_P(result) = Z_LVAL_P(op1) + Z_LVAL_P(op2); - Z_TYPE_P(result) = IS_LONG; + ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2)); } #endif return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); return SUCCESS; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) + Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -633,7 +626,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o "subl (%2), %%eax\n\t" "jo 0f\n\t" "movl %%eax, (%0)\n\t" - "movb %3, %c5(%0)\n\t" + "movl %3, %c5(%0)\n\t" "jmp 1f\n" "0:\n\t" "fildl (%2)\n\t" @@ -643,7 +636,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o #else "fsubp %%st, %%st(1)\n\t" #endif - "movb %4, %c5(%0)\n\t" + "movl %4, %c5(%0)\n\t" "fstpl (%0)\n" "1:" : @@ -660,7 +653,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o "subq (%2), %%rax\n\t" "jo 0f\n\t" "movq %%rax, (%0)\n\t" - "movb %3, %c5(%0)\n\t" + "movl %3, %c5(%0)\n\t" "jmp 1f\n" "0:\n\t" "fildq (%2)\n\t" @@ -670,7 +663,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o #else "fsubp %%st, %%st(1)\n\t" #endif - "movb %4, %c5(%0)\n\t" + "movl %4, %c5(%0)\n\t" "fstpl (%0)\n" "1:" : @@ -682,30 +675,24 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o "n"(ZVAL_OFFSETOF_TYPE) : "rax","cc"); #else - Z_LVAL_P(result) = Z_LVAL_P(op1) - Z_LVAL_P(op2); + ZVAL_LONG(result, Z_LVAL_P(op1) - Z_LVAL_P(op2)); if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) { - Z_DVAL_P(result) = (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; - } else { - Z_TYPE_P(result) = IS_LONG; + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); } #endif return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); return SUCCESS; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -719,21 +706,18 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o long overflow; 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; + Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG; return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); return SUCCESS; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) * Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { - Z_DVAL_P(result) = Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -747,53 +731,43 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_BOOL; + ZVAL_BOOL(result, 0); return FAILURE; } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN)) { /* Prevent overflow error/crash */ - Z_DVAL_P(result) = (double) LONG_MIN / -1; - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, (double) LONG_MIN / -1); } else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) { /* integer */ - Z_LVAL_P(result) = Z_LVAL_P(op1) / Z_LVAL_P(op2); - Z_TYPE_P(result) = IS_LONG; + ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); } else { - Z_DVAL_P(result) = ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2)); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2))); } return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (UNEXPECTED(Z_DVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_BOOL; + ZVAL_BOOL(result, 0); return FAILURE; } - Z_DVAL_P(result) = ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2)); return SUCCESS; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (UNEXPECTED(Z_DVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_BOOL; + ZVAL_BOOL(result, 0); return FAILURE; } - Z_DVAL_P(result) = Z_DVAL_P(op1) / Z_DVAL_P(op2); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_BOOL; + ZVAL_BOOL(result, 0); return FAILURE; } - Z_DVAL_P(result) = Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2)); - Z_TYPE_P(result) = IS_DOUBLE; + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -807,17 +781,14 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_BOOL; + ZVAL_BOOL(result, 0); return FAILURE; } else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) { /* Prevent overflow error/crash if op1==LONG_MIN */ - Z_LVAL_P(result) = 0; - Z_TYPE_P(result) = IS_LONG; + ZVAL_LONG(result, 0); return SUCCESS; } - Z_LVAL_P(result) = Z_LVAL_P(op1) % Z_LVAL_P(op2); - Z_TYPE_P(result) = IS_LONG; + ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2)); return SUCCESS; } } diff --git a/Zend/zend_string.c b/Zend/zend_string.c index c6a1f0183fe..ee4fe02a82f 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -152,7 +152,7 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC) p->h = h; p->key = str; Z_STR(p->val) = str; - Z_TYPE(p->val) = IS_STRING; + Z_TYPE_INFO(p->val) = IS_INTERNED_STRING_EX; nIndex = h & CG(interned_strings).nTableMask; Z_NEXT(p->val) = CG(interned_strings).arHash[nIndex]; CG(interned_strings).arHash[nIndex] = idx; diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 0687700be87..3072afd3221 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -98,10 +98,14 @@ static zend_always_inline zend_string *zend_str_alloc(int len, int persistent) zend_string *ret = pemalloc(sizeof(zend_string) + len, persistent); GC_REFCOUNT(ret) = 1; -// TODO use one assignment ??? +#if 1 + /* optimized single assignment */ + GC_TYPE_INFO(ret) = IS_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << 8); +#else GC_TYPE(ret) = IS_STRING; GC_FLAGS(ret) = (persistent ? IS_STR_PERSISTENT : 0); GC_INFO(ret) = 0; +#endif ret->h = 0; ret->len = len; return ret; diff --git a/Zend/zend_types.h b/Zend/zend_types.h index d9dd039b73e..c4c7bcdca21 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -109,14 +109,17 @@ struct _zval_struct { union { struct { ZEND_ENDIAN_LOHI_4( - zend_uchar type, /* active type */ - zend_uchar flags, /* various IS_VAR flags */ - zend_uchar res1, - zend_uchar res2) + zend_uchar type, /* active type */ + zend_uchar type_flags, + zend_uchar const_flags, + zend_uchar reserved) /* various IS_VAR flags */ } v; zend_uint type_info; - } u; - zend_uint next; /* hash collision chain */ + } u1; + union { + zend_uint var_flags; + zend_uint next; /* hash collision chain */ + } u2; }; struct _zend_refcounted { @@ -204,45 +207,45 @@ struct _zend_ast_ref { #define IS_BOOL 3 #define IS_LONG 4 #define IS_DOUBLE 5 -//#define IS_INTERNED_STRING 6 -#define IS_STRING 7 -#define IS_ARRAY 8 -#define IS_OBJECT 9 -#define IS_RESOURCE 10 -#define IS_REFERENCE 11 +#define IS_STRING 6 +#define IS_ARRAY 7 +#define IS_OBJECT 8 +#define IS_RESOURCE 9 +#define IS_REFERENCE 10 -#define IS_CONSTANT 12 -#define IS_CONSTANT_ARRAY 13 -#define IS_CONSTANT_AST 14 -#define IS_CALLABLE 15 +#define IS_CONSTANT 11 +#define IS_CONSTANT_ARRAY 12 +#define IS_CONSTANT_AST 13 +#define IS_CALLABLE 14 -#define IS_STR_OFFSET 16 -#define IS_PTR 17 +#define IS_STR_OFFSET 15 +#define IS_PTR 16 -/* Ugly hack to support constants as static array indices */ -#define IS_CONSTANT_TYPE_MASK 0x00f -#define IS_CONSTANT_UNQUALIFIED 0x010 -//???#define IS_CONSTANT_INDEX 0x080 -#define IS_LEXICAL_VAR 0x020 -#define IS_LEXICAL_REF 0x040 -#define IS_CONSTANT_IN_NAMESPACE 0x100 +static inline zend_uchar zval_get_type(const zval* pz) { + return pz->u1.v.type; +} -#define IS_CONSTANT_TYPE(type) \ - (((type) & IS_CONSTANT_TYPE_MASK) >= IS_CONSTANT && ((type) & IS_CONSTANT_TYPE_MASK) <= IS_CONSTANT_AST) - -/* All data types < IS_STRING have their constructor/destructors skipped */ -#define IS_REFCOUNTED(type) ((type) >= IS_STRING) - -#define Z_TYPE(zval) (zval).u.v.type +//??? +#if 0 +# define Z_TYPE(zval) (zval).u1.v.type +#else +# define Z_TYPE(zval) zval_get_type(&(zval)) +#endif #define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p)) -#define Z_FLAGS(zval) (zval).u.v.flags -#define Z_FLAGS_P(zval_p) Z_FLAGS(*(zval_p)) +#define Z_TYPE_FLAGS(zval) (zval).u1.v.type_flags +#define Z_TYPE_FLAGS_P(zval_p) Z_TYPE_FLAGS(*(zval_p)) -#define Z_TYPE_INFO(zval) (zval).u.type_info +#define Z_CONST_FLAGS(zval) (zval).u1.v.const_flags +#define Z_CONST_FLAGS_P(zval_p) Z_CONST_FLAGS(*(zval_p)) + +#define Z_VAR_FLAGS(zval) (zval).u2.var_flags +#define Z_VAR_FLAGS_P(zval_p) Z_VAR_FLAGS(*(zval_p)) + +#define Z_TYPE_INFO(zval) (zval).u1.type_info #define Z_TYPE_INFO_P(zval_p) Z_TYPE_INFO(*(zval_p)) -#define Z_NEXT(zval) (zval).next +#define Z_NEXT(zval) (zval).u2.next #define Z_NEXT_P(zval_p) Z_NEXT(*(zval_p)) #define Z_COUNTED(zval) (zval).value.counted @@ -266,7 +269,32 @@ struct _zend_ast_ref { #define Z_GC_TYPE_INFO(zval) GC_TYPE_INFO(Z_COUNTED(zval)) #define Z_GC_TYPE_INFO_P(zval_p) Z_GC_TYPE_INFO(*(zval_p)) -/* zval.var_flags */ +/* zval.u1.v.type_flags */ +#define IS_TYPE_CONSTANT (1<<0) +#define IS_TYPE_REFCOUNTED (1<<1) +#define IS_TYPE_COLLECTABLE (1<<2) +#define IS_TYPE_COPYABLE (1<<3) + +/* extended types */ +#define IS_INTERNED_STRING_EX IS_STRING + +#define IS_STRING_EX (IS_STRING | (( IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8)) +#define IS_ARRAY_EX (IS_ARRAY | (( IS_TYPE_REFCOUNTED | IS_TYPE_COLLECTABLE | IS_TYPE_COPYABLE) << 8)) +#define IS_OBJECT_EX (IS_OBJECT | (( IS_TYPE_REFCOUNTED | IS_TYPE_COLLECTABLE ) << 8)) +#define IS_RESOURCE_EX (IS_RESOURCE | (( IS_TYPE_REFCOUNTED ) << 8)) +#define IS_REFERENCE_EX (IS_REFERENCE | (( IS_TYPE_REFCOUNTED ) << 8)) + +#define IS_CONSTANT_EX (IS_CONSTANT | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8)) +#define IS_CONSTANT_ARRAY_EX (IS_CONSTANT_ARRAY | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8)) +#define IS_CONSTANT_AST_EX (IS_CONSTANT_AST | ((IS_TYPE_CONSTANT | IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE) << 8)) + +/* zval.u1.v.const_flags */ +#define IS_CONSTANT_UNQUALIFIED 0x010 +#define IS_LEXICAL_VAR 0x020 +#define IS_LEXICAL_REF 0x040 +#define IS_CONSTANT_IN_NAMESPACE 0x100 /* used only in opline->extended_value */ + +/* zval.u2.var_flags */ #define IS_VAR_RET_REF (1<<0) /* return by by reference */ /* string flags (zval.value->gc.u.flags) */ @@ -278,7 +306,7 @@ struct _zend_ast_ref { #define IS_STR_CONSTANT_UNQUALIFIED (1<<4) /* the same as IS_CONSTANT_UNQUALIFIED */ #define IS_STR_AST (1<<5) /* constant expression index */ -/* object flags (zval.value->gc.u.vflags) */ +/* object flags (zval.value->gc.u.flags) */ #define IS_OBJ_APPLY_COUNT 0x07 #define IS_OBJ_DESTRUCTOR_CALLED (1<<3) @@ -301,9 +329,8 @@ struct _zend_ast_ref { #define Z_OBJ_INC_APPLY_COUNT_P(zv) Z_OBJ_INC_APPLY_COUNT(*(zv)) #define Z_OBJ_DEC_APPLY_COUNT_P(zv) Z_OBJ_DEC_APPLY_COUNT(*(zv)) -#define Z_REFCOUNTED(zval) (IS_REFCOUNTED(Z_TYPE(zval)) && \ - (Z_TYPE(zval) != IS_STRING || \ - !IS_INTERNED(Z_STR(zval)))) +/* All data types < IS_STRING have their constructor/destructors skipped */ +#define Z_REFCOUNTED(zval) (Z_TYPE_FLAGS(zval) & IS_TYPE_REFCOUNTED) #define Z_REFCOUNTED_P(zval_p) Z_REFCOUNTED(*(zval_p)) #define Z_ISREF(zval) (Z_TYPE(zval) == IS_REFERENCE) @@ -396,42 +423,61 @@ struct _zend_ast_ref { #define Z_STR_OFFSET(zval) (zval).value.str_offset #define Z_STR_OFFSET_P(zval_p) Z_STR_OFFSET(*(zval_p)) -#define ZVAL_UNDEF(z) do { \ - Z_TYPE_P(z) = IS_UNDEF; \ +#define ZVAL_UNDEF(z) do { \ + Z_TYPE_INFO_P(z) = IS_UNDEF; \ } while (0) -#define ZVAL_NULL(z) do { \ - Z_TYPE_P(z) = IS_NULL; \ +#define ZVAL_NULL(z) do { \ + Z_TYPE_INFO_P(z) = IS_NULL; \ } while (0) -#define ZVAL_BOOL(z, b) do { \ - zval *__z = (z); \ - Z_LVAL_P(__z) = ((b) != 0); \ - Z_TYPE_P(__z) = IS_BOOL; \ +#define ZVAL_BOOL(z, b) do { \ + zval *__z = (z); \ + Z_LVAL_P(__z) = ((b) != 0); \ + Z_TYPE_INFO_P(__z) = IS_BOOL; \ } while (0) -#define ZVAL_LONG(z, l) { \ - zval *__z = (z); \ - Z_LVAL_P(__z) = l; \ - Z_TYPE_P(__z) = IS_LONG; \ +#define ZVAL_LONG(z, l) { \ + zval *__z = (z); \ + Z_LVAL_P(__z) = l; \ + Z_TYPE_INFO_P(__z) = IS_LONG; \ } -#define ZVAL_DOUBLE(z, d) { \ - zval *__z = (z); \ - Z_DVAL_P(__z) = d; \ - Z_TYPE_P(__z) = IS_DOUBLE; \ +#define ZVAL_DOUBLE(z, d) { \ + zval *__z = (z); \ + Z_DVAL_P(__z) = d; \ + Z_TYPE_INFO_P(__z) = IS_DOUBLE; \ } #define ZVAL_STR(z, s) do { \ zval *__z = (z); \ - Z_STR_P(__z) = (s); \ - Z_TYPE_P(__z) = IS_STRING; \ + zend_string *__s = (s); \ + Z_STR_P(__z) = __s; \ + /* interned strings support */ \ + Z_TYPE_INFO_P(__z) = IS_INTERNED(__s) ? \ + IS_INTERNED_STRING_EX : \ + IS_STRING_EX; \ + } while (0) + +#define ZVAL_INT_STR(z, s) do { \ + zval *__z = (z); \ + zend_string *__s = (s); \ + Z_STR_P(__z) = __s; \ + Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX; \ + } while (0) + +#define ZVAL_NEW_STR(z, s) do { \ + zval *__z = (z); \ + zend_string *__s = (s); \ + Z_STR_P(__z) = __s; \ + /* interned strings support */ \ + Z_TYPE_INFO_P(__z) = IS_STRING_EX; \ } while (0) #define ZVAL_ARR(z, a) do { \ zval *__z = (z); \ Z_ARR_P(__z) = (a); \ - Z_TYPE_P(__z) = IS_ARRAY; \ + Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ } while (0) #define ZVAL_NEW_ARR(z) do { \ @@ -440,7 +486,7 @@ struct _zend_ast_ref { GC_REFCOUNT(_arr) = 1; \ GC_TYPE_INFO(_arr) = IS_ARRAY; \ Z_ARR_P(__z) = _arr; \ - Z_TYPE_P(__z) = IS_ARRAY; \ + Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ } while (0) #define ZVAL_NEW_PERSISTENT_ARR(z) do { \ @@ -449,19 +495,19 @@ struct _zend_ast_ref { GC_REFCOUNT(_arr) = 1; \ GC_TYPE_INFO(_arr) = IS_ARRAY; \ Z_ARR_P(__z) = _arr; \ - Z_TYPE_P(__z) = IS_ARRAY; \ + Z_TYPE_INFO_P(__z) = IS_ARRAY_EX; \ } while (0) #define ZVAL_OBJ(z, o) do { \ zval *__z = (z); \ Z_OBJ_P(__z) = (o); \ - Z_TYPE_P(__z) = IS_OBJECT; \ + Z_TYPE_INFO_P(__z) = IS_OBJECT_EX; \ } while (0) #define ZVAL_RES(z, r) do { \ zval *__z = (z); \ Z_RES_P(__z) = (r); \ - Z_TYPE_P(__z) = IS_RESOURCE; \ + Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \ } while (0) #define ZVAL_NEW_RES(z, h, p, t) do { \ @@ -473,7 +519,7 @@ struct _zend_ast_ref { _res->ptr = (p); \ zval *__z = (z); \ Z_RES_P(__z) = _res; \ - Z_TYPE_P(__z) = IS_RESOURCE; \ + Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \ } while (0) #define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \ @@ -485,13 +531,13 @@ struct _zend_ast_ref { _res->ptr = (p); \ zval *__z = (z); \ Z_RES_P(__z) = _res; \ - Z_TYPE_P(__z) = IS_RESOURCE; \ + Z_TYPE_INFO_P(__z) = IS_RESOURCE_EX; \ } while (0) #define ZVAL_REF(z, r) do { \ zval *__z = (z); \ Z_REF_P(__z) = (r); \ - Z_TYPE_P(__z) = IS_REFERENCE; \ + Z_TYPE_INFO_P(__z) = IS_REFERENCE_EX; \ } while (0) #define ZVAL_NEW_REF(z, r) do { \ @@ -500,7 +546,7 @@ struct _zend_ast_ref { GC_TYPE_INFO(_ref) = IS_REFERENCE; \ ZVAL_COPY_VALUE(&_ref->val, r); \ Z_REF_P(z) = _ref; \ - Z_TYPE_P(z) = IS_REFERENCE; \ + Z_TYPE_INFO_P(z) = IS_REFERENCE_EX; \ } while (0) #define ZVAL_NEW_AST(z, a) do { \ @@ -510,27 +556,27 @@ struct _zend_ast_ref { GC_TYPE_INFO(_ast) = IS_CONSTANT_AST; \ _ast->ast = (a); \ Z_AST_P(__z) = _ast; \ - Z_TYPE_P(__z) = IS_CONSTANT_AST; \ + Z_TYPE_INFO_P(__z) = IS_CONSTANT_AST_EX; \ } while (0) #define ZVAL_INDIRECT(z, v) do { \ Z_INDIRECT_P(z) = (v); \ - Z_TYPE_P(z) = IS_INDIRECT; \ + Z_TYPE_INFO_P(z) = IS_INDIRECT; \ } while (0) #define ZVAL_PTR(z, p) do { \ Z_PTR_P(z) = (p); \ - Z_TYPE_P(z) = IS_PTR; \ + Z_TYPE_INFO_P(z) = IS_PTR; \ } while (0) #define ZVAL_FUNC(z, f) do { \ Z_FUNC_P(z) = (f); \ - Z_TYPE_P(z) = IS_PTR; \ + Z_TYPE_INFO_P(z) = IS_PTR; \ } while (0) #define ZVAL_CE(z, c) do { \ Z_CE_P(z) = (c); \ - Z_TYPE_P(z) = IS_PTR; \ + Z_TYPE_INFO_P(z) = IS_PTR; \ } while (0) #define ZVAL_STR_OFFSET(z, s, o) do { \ @@ -540,7 +586,7 @@ struct _zend_ast_ref { x->str = (s); \ x->offset = (o); \ Z_STR_OFFSET_P(z) = x; \ - Z_TYPE_P(z) = IS_STR_OFFSET; \ + Z_TYPE_INFO_P(z) = IS_STR_OFFSET; \ } while (0) #endif /* ZEND_TYPES_H */ diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 0a2059d4bc2..24e347a15bd 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -29,14 +29,13 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) { -//??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { switch (GC_TYPE(p)) { case IS_STRING: case IS_CONSTANT: { zend_string *str = (zend_string*)p; //??? CHECK_ZVAL_STRING_REL(zvalue); STR_RELEASE(str); - goto exit; + break; } case IS_ARRAY: case IS_CONSTANT_ARRAY: { @@ -47,23 +46,24 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) /* break possible cycles */ GC_TYPE(arr) = IS_NULL; zend_hash_destroy(&arr->ht); - goto gc_exit; + GC_REMOVE_FROM_BUFFER(arr); + efree(arr); } - goto exit; + break; } case IS_CONSTANT_AST: { zend_ast_ref *ast =(zend_ast_ref*)p; zend_ast_destroy(ast->ast); efree(ast); - goto exit; + break; } case IS_OBJECT: { zend_object *obj = (zend_object*)p; TSRMLS_FETCH(); OBJ_RELEASE(obj); - goto exit; + break; } case IS_RESOURCE: { zend_resource *res = (zend_resource*)p; @@ -73,36 +73,30 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) /* destroy resource */ zend_list_delete(res); } - goto exit; + break; } case IS_REFERENCE: { zend_reference *ref = (zend_reference*)p; if (--GC_REFCOUNT(ref) == 0) { zval_ptr_dtor(&ref->val); - goto gc_exit; + efree(ref); } - goto exit; + break; } default: - goto exit; + break; } -gc_exit: - GC_REMOVE_FROM_BUFFER(p); - efree(p); -exit: - return; } ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) { -//??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { switch (GC_TYPE(p)) { case IS_STRING: case IS_CONSTANT: { zend_string *str = (zend_string*)p; //??? CHECK_ZVAL_STRING_REL(zvalue); STR_FREE(str); - goto exit; + break; } case IS_ARRAY: case IS_CONSTANT_ARRAY: { @@ -113,23 +107,24 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) /* break possible cycles */ GC_TYPE(arr) = IS_NULL; zend_hash_destroy(&arr->ht); - goto gc_exit; + GC_REMOVE_FROM_BUFFER(arr); + efree(arr); } - goto exit; + break; } case IS_CONSTANT_AST: { zend_ast_ref *ast =(zend_ast_ref*)p; zend_ast_destroy(ast->ast); efree(ast); - goto exit; + break; } case IS_OBJECT: { zend_object *obj = (zend_object*)p; TSRMLS_FETCH(); zend_objects_store_del(obj TSRMLS_CC); - goto exit; + break; } case IS_RESOURCE: { zend_resource *res = (zend_resource*)p; @@ -137,27 +132,23 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) /* destroy resource */ zend_list_delete(res); - goto exit; + break; } case IS_REFERENCE: { zend_reference *ref = (zend_reference*)p; zval_ptr_dtor(&ref->val); - goto gc_exit; + efree(ref); + break; } default: - goto exit; + break; } -gc_exit: - GC_REMOVE_FROM_BUFFER(p); - efree(p); -exit: - return; } ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) { - switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(zvalue)) { case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(zvalue); @@ -181,7 +172,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC) { - switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(zvalue)) { case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(zvalue); @@ -233,7 +224,7 @@ ZEND_API void zval_add_ref_unref(zval *p) ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) { - switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(zvalue)) { case IS_CONSTANT: case IS_STRING: CHECK_ZVAL_STRING_REL(zvalue); @@ -316,8 +307,8 @@ ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_bool is_ref; zval tmp; - if (Z_TYPE_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) { - is_ref = Z_TYPE_P(p) & IS_LEXICAL_REF; + if (Z_CONST_FLAGS_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) { + is_ref = Z_CONST_FLAGS_P(p) & IS_LEXICAL_REF; if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h index c62a194e21e..37accac1916 100644 --- a/Zend/zend_variables.h +++ b/Zend/zend_variables.h @@ -38,12 +38,17 @@ static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC); +#define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC) + static zend_always_inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) { - if (!Z_REFCOUNTED_P(zvalue)) { - return; + if (Z_REFCOUNTED_P(zvalue)) { + if (Z_TYPE_FLAGS_P(zvalue) & IS_TYPE_COPYABLE) { + _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC); + } else { + Z_ADDREF_P(zvalue); + } } - _zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC); } ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 937eb9ef3d9..a3c73b3c12d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1807,7 +1807,7 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { + !(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!OP2_FREE) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -2025,7 +2025,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ZVAL_NULL(ret); //??? ret->var.ptr_ptr = &ret->var.ptr; - Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ @@ -2050,7 +2050,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ZVAL_NULL(return_value); //??? ret->var.ptr_ptr = &ret->var.ptr; - Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; } if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { @@ -2092,7 +2092,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) } else { //??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); //??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); - Z_FLAGS_P(EX_VAR(opline->result.var)) = 0; + Z_VAR_FLAGS_P(EX_VAR(opline->result.var)) = 0; //??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; } } @@ -2331,7 +2331,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_char_to_string(str, str, opline->op2.zv); @@ -2350,7 +2350,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_string_to_string(str, str, opline->op2.zv); @@ -2374,7 +2374,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -2913,7 +2913,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) if (OP1_TYPE == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { + (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -3109,7 +3109,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && + (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -3402,7 +3402,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); zval_ptr_dtor(var_ptr); if (param == NULL) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) { + if (Z_TYPE_FLAGS_P(opline->op2.zv) & IS_TYPE_CONSTANT) { zval tmp; ZVAL_COPY_VALUE(&tmp, opline->op2.zv); @@ -3715,7 +3715,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) { + if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) { zend_class_entry *old_scope = EG(scope); EG(scope) = ce; @@ -5339,7 +5339,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) name = GET_OP1_ZVAL_PTR(BP_VAR_R); val = GET_OP2_ZVAL_PTR(BP_VAR_R); - if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) { + if (Z_TYPE_FLAGS_P(val) & IS_TYPE_CONSTANT) { ZVAL_COPY_VALUE(&c.value, val); if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { zval_copy_ctor(&c.value); @@ -5445,7 +5445,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE * not return by reference we throw a notice. */ if (OP1_TYPE == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6ce1f99b9c9..3f03f632067 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -554,7 +554,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ZVAL_NULL(ret); //??? ret->var.ptr_ptr = &ret->var.ptr; - Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ @@ -579,7 +579,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ZVAL_NULL(return_value); //??? ret->var.ptr_ptr = &ret->var.ptr; - Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; } if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { @@ -621,7 +621,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR } else { //??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); //??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); - Z_FLAGS_P(EX_VAR(opline->result.var)) = 0; + Z_VAR_FLAGS_P(EX_VAR(opline->result.var)) = 0; //??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; } } @@ -1607,7 +1607,7 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); zval_ptr_dtor(var_ptr); if (param == NULL) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) { + if (Z_TYPE_FLAGS_P(opline->op2.zv) & IS_TYPE_CONSTANT) { zval tmp; ZVAL_COPY_VALUE(&tmp, opline->op2.zv); @@ -2602,7 +2602,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND if (IS_CONST == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { + (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -3929,7 +3929,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) { + if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) { zend_class_entry *old_scope = EG(scope); EG(scope) = ce; @@ -4205,7 +4205,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD name = opline->op1.zv; val = opline->op2.zv; - if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) { + if (Z_TYPE_FLAGS_P(val) & IS_TYPE_CONSTANT) { ZVAL_COPY_VALUE(&c.value, val); if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { zval_copy_ctor(&c.value); @@ -4274,7 +4274,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -4927,7 +4927,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -5906,7 +5906,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -6595,7 +6595,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -7301,7 +7301,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -7676,7 +7676,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { + (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -8867,7 +8867,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_char_to_string(str, str, opline->op2.zv); @@ -8886,7 +8886,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_string_to_string(str, str, opline->op2.zv); @@ -9266,7 +9266,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -9664,7 +9664,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -9919,7 +9919,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -10496,7 +10496,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -10898,7 +10898,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -11455,7 +11455,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -11853,7 +11853,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -12105,7 +12105,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -12672,7 +12672,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (IS_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { + (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -12772,7 +12772,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && + (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -15360,7 +15360,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) { + if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) { zend_class_entry *old_scope = EG(scope); EG(scope) = ce; @@ -15966,7 +15966,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -18016,7 +18016,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -19626,7 +19626,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { + !(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!(free_op2.var != NULL)) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -20452,7 +20452,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -21579,7 +21579,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -23007,7 +23007,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { + !(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!0) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -23683,7 +23683,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -24597,7 +24597,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_char_to_string(str, str, opline->op2.zv); @@ -24616,7 +24616,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } add_string_to_string(str, str, opline->op2.zv); @@ -24762,7 +24762,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) { - if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) { + if (Z_TYPE_FLAGS_P(value) & IS_TYPE_CONSTANT) { zend_class_entry *old_scope = EG(scope); EG(scope) = ce; @@ -25140,7 +25140,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -25977,7 +25977,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -26429,7 +26429,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -27266,7 +27266,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -27718,7 +27718,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -28120,7 +28120,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -28956,7 +28956,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ - ZVAL_STR(str, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(str); } if (Z_TYPE_P(var) != IS_STRING) { @@ -29406,7 +29406,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -29954,7 +29954,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER if (IS_CV == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { + (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -30053,7 +30053,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && + (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -32874,7 +32874,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -34796,7 +34796,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -36397,7 +36397,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { + !(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!(free_op2.var != NULL)) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -37103,7 +37103,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -38093,7 +38093,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -39512,7 +39512,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { + !(Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!0) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -40068,7 +40068,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) + && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e0cd1e30151..5809586a0d9 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2491,7 +2491,6 @@ static void date_object_free_storage_period(zend_object *object TSRMLS_DC) /* {{ /* Advanced Interface */ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) /* {{{ */ { - Z_TYPE_P(object) = IS_OBJECT; object_init_ex(object, pce); return object; } /* }}} */ diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 163cded77db..02e950a328d 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -1893,7 +1893,7 @@ PHP_FUNCTION(mysql_real_escape_string) new_str = STR_ALLOC(str_len * 2, 0); new_str->len = mysql_real_escape_string(mysql->conn, new_str->val, str, str_len); - RETURN_STR(new_str); + RETURN_NEW_STR(new_str); } /* }}} */ diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 1bbe286dbfc..86db53f1da6 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -924,12 +924,16 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, } else { Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0); } + Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX; memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC); - Z_TYPE(ZEND_OP1_LITERAL(last_op)) = IS_NULL; + if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(opline)))) { + Z_TYPE_FLAGS(ZEND_OP1_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } + ZVAL_NULL(&ZEND_OP1_LITERAL(last_op)); #else Z_STR(ZEND_OP1_LITERAL(opline)) = Z_STR(ZEND_OP1_LITERAL(last_op)); #endif @@ -968,12 +972,16 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, } else { Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0); } + Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX; memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC); - Z_TYPE(ZEND_OP2_LITERAL(src)) = IS_NULL; + if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(opline)))) { + Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } + ZVAL_NULL(&ZEND_OP2_LITERAL(src)); #else Z_STR(ZEND_OP2_LITERAL(opline)) = Z_STR(ZEND_OP2_LITERAL(src)); #endif @@ -1055,7 +1063,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, /* BOOL */ result = ZEND_OP1_LITERAL(opline); convert_to_boolean(&result); - Z_TYPE(ZEND_OP1_LITERAL(opline)) = IS_NULL; + ZVAL_NULL(&ZEND_OP1_LITERAL(opline)); } //??? PZ_SET_REFCOUNT_P(&result, 1); //??? PZ_UNSET_ISREF_P(&result); diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index b8d226ef84a..3bf59be84b4 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -7,7 +7,7 @@ */ #if ZEND_EXTENSION_API_NO > PHP_5_2_X_API_NO -# define ZEND_IS_CONSTANT_TYPE(t) (((t) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) +# define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT) #else # define ZEND_IS_CONSTANT_TYPE(t) ((t) == IS_CONSTANT) #endif @@ -177,7 +177,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (requires_conversion) { /* ZEND_ADD_CHAR */ char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); - ZVAL_STR(&ZEND_OP2_LITERAL(opline), str); + ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str); ptr[0] = chval; opline->opcode = ZEND_ADD_STRING; ptr++; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 55f57207e7e..f92c866e413 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -131,7 +131,7 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) # define literal_dtor(zv) do { \ zval_dtor(zv); \ - Z_TYPE_P(zv) = IS_NULL; \ + ZVAL_NULL(zv); \ } while (0) #define COPY_NODE(target, src) do { \ diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 7d5d9bc5952..78d9f9dfb80 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -353,9 +353,13 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string) + str->len); p->h = h; GC_REFCOUNT(p->key) = 1; -// TODO: use one assignment ??? +#if 1 + /* optimized single assignment */ + GC_TYPE_INFO(p->key) = IS_STRING | ((IS_STR_INTERNED | IS_STR_PERMANENT) << 8); +#else GC_TYPE(p->key) = IS_STRING; GC_FLAGS(p->key) = IS_STR_INTERNED | IS_STR_PERMANENT; +#endif p->key->h = str->h; p->key->len = str->len; memcpy(p->key->val, str->val, str->len); @@ -2204,9 +2208,9 @@ static void accel_fast_zval_dtor(zval *zvalue) { if (Z_REFCOUNTED_P(zvalue) && Z_DELREF_P(zvalue) == 0) { #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(zvalue)) { #else - switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(zvalue)) { #endif case IS_ARRAY: case IS_CONSTANT_ARRAY: { @@ -2217,7 +2221,7 @@ static void accel_fast_zval_dtor(zval *zvalue) #endif if (Z_ARR_P(zvalue) != &EG(symbol_table)) { /* break possible cycles */ - Z_TYPE_P(zvalue) = IS_NULL; + ZVAL_NULL(zvalue); Z_ARRVAL_P(zvalue)->pDestructor = accel_fast_zval_dtor; accel_fast_hash_destroy(Z_ARRVAL_P(zvalue)); } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index e8fd91b8cf5..586af626742 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -249,9 +249,9 @@ static inline void zend_clone_zval(zval *src, int bind TSRMLS_DC) void *ptr; #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch ((Z_TYPE_P(src) & IS_CONSTANT_TYPE_MASK)) { + switch (Z_TYPE_P(src)) { #else - switch ((Z_TYPE_P(src) & ~IS_CONSTANT_INDEX)) { + switch (Z_TYPE_P(src)) { #endif case IS_STRING: case IS_CONSTANT: diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 7706840c890..c4b10264bbf 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -115,9 +115,9 @@ static void zend_persist_zval(zval *z TSRMLS_DC) void *new_ptr; #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(z)) { #else - switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(z)) { #endif case IS_STRING: case IS_CONSTANT: diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 93b53ae8178..14f971f87b4 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -112,14 +112,17 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC) START_SIZE(); #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(z)) { #else - switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(z)) { #endif case IS_STRING: case IS_CONSTANT: flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); ADD_INTERNED_STRING(Z_STR_P(z), 0); + if (IS_INTERNED(Z_STR_P(z))) { + Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); + } Z_GC_FLAGS_P(z) |= flags; break; case IS_ARRAY: diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 60580b86f5e..1abb471fbc4 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2588,7 +2588,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) ZVAL_COPY_VALUE(return_value, precv->op2.zv); //??? INIT_PZVAL(return_value); - if (!IS_CONSTANT_TYPE(Z_TYPE_P(return_value))) { + if (!(Z_TYPE_FLAGS_P(return_value) & IS_TYPE_CONSTANT)) { zval_copy_ctor(return_value); } zval_update_constant_ex(return_value, (void*)0, param->fptr->common.scope TSRMLS_CC); @@ -2612,7 +2612,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueConstant) } precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); - if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) { RETURN_TRUE; } @@ -2637,7 +2637,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) } precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); - if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { + if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) { RETURN_STR(STR_COPY(Z_STR_P(precv->op2.zv))); } } @@ -3383,7 +3383,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value /* this is necessary to make it able to work with default array * properties, returned to user */ - if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) { + if (Z_TYPE_FLAGS(prop_copy) & IS_TYPE_CONSTANT) { zval_update_constant(&prop_copy, (void *) 1 TSRMLS_CC); } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 8a60979307c..b00a8862bc0 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -441,8 +441,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o zend_update_class_constants(ce TSRMLS_CC); intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC)); - return_value->value.obj = &intern->std; - Z_TYPE_P(return_value) = IS_OBJECT; + ZVAL_OBJ(return_value, &intern->std); if (ce->constructor->common.scope != spl_ce_SplFileInfo) { ZVAL_STRINGL(&arg1, file_path, file_path_len); @@ -484,8 +483,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file zend_update_class_constants(ce TSRMLS_CC); intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC)); - return_value->value.obj = &intern->std; - Z_TYPE_P(return_value) = IS_OBJECT; + ZVAL_OBJ(return_value, &intern->std); spl_filesystem_object_get_file_name(source TSRMLS_CC); if (ce->constructor->common.scope != spl_ce_SplFileInfo) { @@ -506,8 +504,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file intern = spl_filesystem_from_obj(spl_filesystem_object_new_ex(ce TSRMLS_CC)); - return_value->value.obj = &intern->std; - Z_TYPE_P(return_value) = IS_OBJECT; + ZVAL_OBJ(return_value, &intern->std); spl_filesystem_object_get_file_name(source TSRMLS_CC); @@ -632,7 +629,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem if (intern->u.dir.sub_path) { ZVAL_STRINGL(&tmp, intern->u.dir.sub_path, intern->u.dir.sub_path_len); } else { - ZVAL_STR(&tmp, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(&tmp); } zend_symtable_update(rv, pnstr, &tmp); STR_RELEASE(pnstr); @@ -1548,7 +1545,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPath) if (intern->u.dir.sub_path) { RETURN_STRINGL(intern->u.dir.sub_path, intern->u.dir.sub_path_len); } else { - RETURN_STR(STR_EMPTY_ALLOC()); + RETURN_EMPTY_STRING(); } } /* }}} */ diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 784d1db9687..d2339b3a8dd 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -744,7 +744,6 @@ SPL_METHOD(SplFixedArray, fromArray) } object_init_ex(return_value, spl_ce_SplFixedArray); - Z_TYPE_P(return_value) = IS_OBJECT; intern = Z_SPLFIXEDARRAY_P(return_value); intern->array = array; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 1703f2e3ad0..1aba634b28a 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1167,7 +1167,7 @@ SPL_METHOD(RecursiveTreeIterator, current) zval_ptr_dtor(&entry); zval_ptr_dtor(&postfix); - RETURN_STR(str); + RETURN_NEW_STR(str); } /* }}} */ /* {{{ proto mixed RecursiveTreeIterator::key() @@ -1223,7 +1223,7 @@ SPL_METHOD(RecursiveTreeIterator, key) zval_ptr_dtor(&key); zval_ptr_dtor(&postfix); - RETURN_STR(str); + RETURN_NEW_STR(str); } /* }}} */ ZEND_BEGIN_ARG_INFO_EX(arginfo_recursive_tree_it___construct, 0, 0, 1) diff --git a/ext/standard/array.c b/ext/standard/array.c index 5bbb620282f..e774a7371b3 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1271,7 +1271,7 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - ZVAL_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); if (add_underscore) { diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 7e768df0de6..3b7b994ab0a 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -169,7 +169,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) ) { - ZVAL_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent)); + ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent)); } else if ( (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || @@ -177,7 +177,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) ) { // TODO: USE STR_EMPTY_ALLOC()? - ZVAL_STR(&new_property, STR_INIT("", sizeof("")-1, persistent)); + ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent)); } else { /* Other than true/false setting */ ZVAL_STR(&new_property, STR_DUP(Z_STR_P(arg2), persistent)); } diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c index 280aba5ceca..326e9e21b8f 100644 --- a/ext/standard/cyr_convert.c +++ b/ext/standard/cyr_convert.c @@ -282,7 +282,7 @@ PHP_FUNCTION(convert_cyr_string) str = STR_INIT(input, input_len, 0); php_convert_cyr_string(str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC); - RETVAL_STR(str); + RETVAL_NEW_STR(str); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index ebe9e93d984..020860873f0 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -556,7 +556,7 @@ PHP_FUNCTION(file_get_contents) if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) { RETVAL_STR(contents); } else { - RETVAL_STR(STR_EMPTY_ALLOC()); + RETVAL_EMPTY_STRING(); } php_stream_close(stream); @@ -1751,7 +1751,7 @@ PHPAPI PHP_FUNCTION(fread) RETURN_FALSE; } - ZVAL_STR(return_value, STR_ALLOC(len, 0)); + ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0)); Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index a1bc44fda0d..4e6b1f1e2ec 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -257,7 +257,7 @@ PHP_FUNCTION(quoted_printable_decode) str_out->val[j] = '\0'; str_out->len = j; - RETVAL_STR(str_out); + RETVAL_NEW_STR(str_out); } /* }}} */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 4fd149804eb..4210f11d6b1 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -1207,8 +1207,7 @@ done: static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ { if (numVars) { - Z_TYPE_P(return_value) = IS_LONG; - Z_LVAL_P(return_value) = SCAN_ERROR_EOF; /* EOF marker */ + ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ convert_to_null(return_value); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 0efd14c57fa..3524ae9c634 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -399,7 +399,7 @@ PHP_FUNCTION(stream_socket_recvfrom) } read_buf->val[recvd] = '\0'; read_buf->len = recvd; - RETURN_STR(read_buf); + RETURN_NEW_STR(read_buf); } STR_FREE(read_buf); diff --git a/ext/standard/string.c b/ext/standard/string.c index 50a565f8b7e..e353b5d536c 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -917,7 +917,7 @@ PHP_FUNCTION(wordwrap) } } - RETURN_STR(newtext); + RETURN_NEW_STR(newtext); } else { /* Multiple character line break or forced cut */ if (linelength > 0) { @@ -1000,7 +1000,7 @@ PHP_FUNCTION(wordwrap) /* free unused memory */ newtext = STR_REALLOC(newtext, newtextlen, 0); - RETURN_STR(newtext); + RETURN_NEW_STR(newtext); } } /* }}} */ @@ -1222,7 +1222,7 @@ PHP_FUNCTION(implode) return; } - ZVAL_STR(&tmp, STR_EMPTY_ALLOC()); + ZVAL_EMPTY_STRING(&tmp); delim = &tmp; SEPARATE_ZVAL(arg1); @@ -1356,7 +1356,7 @@ PHP_FUNCTION(strtoupper) result = STR_INIT(arg, arglen, 0); php_strtoupper(result->val, result->len); - RETURN_STR(result); + RETURN_NEW_STR(result); } /* }}} */ @@ -1391,7 +1391,7 @@ PHP_FUNCTION(strtolower) result = STR_INIT(str, arglen, 0); php_strtolower(result->val, result->len); - RETURN_STR(result); + RETURN_NEW_STR(result); } /* }}} */ @@ -1513,7 +1513,7 @@ PHP_FUNCTION(dirname) ret = STR_INIT(str, str_len, 0); ret->len = zend_dirname(ret->val, str_len); - RETURN_STR(ret); + RETURN_NEW_STR(ret); } /* }}} */ @@ -2183,7 +2183,7 @@ PHP_FUNCTION(chunk_split) memcpy(result->val, str, str_len); memcpy(result->val + str_len, end, endlen); result->val[result->len] = '\0'; - RETURN_STR(result); + RETURN_NEW_STR(result); } if (!str_len) { @@ -2380,7 +2380,7 @@ PHP_FUNCTION(substr_replace) } memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l); result->val[result->len] = '\0'; - RETURN_STR(result); + RETURN_NEW_STR(result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented"); RETURN_STR(STR_COPY(Z_STR_P(str))); @@ -2611,7 +2611,7 @@ PHP_FUNCTION(quotemeta) *q = '\0'; - RETURN_STR(STR_REALLOC(str, q - str->val, 0)); + RETURN_NEW_STR(STR_REALLOC(str, q - str->val, 0)); } /* }}} */ @@ -3153,7 +3153,7 @@ PHP_FUNCTION(strrev) *p = '\0'; - RETVAL_STR(n); + RETVAL_NEW_STR(n); } /* }}} */ @@ -3569,7 +3569,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l return 0; } - ZVAL_STR(result, STR_ALLOC(len + (char_count * (to_len - 1)), 0)); + ZVAL_NEW_STR(result, STR_ALLOC(len + (char_count * (to_len - 1)), 0)); target = Z_STRVAL_P(result); //??? = target = safe_emalloc(char_count, to_len, len + 1); if (case_sensitivity) { @@ -3818,7 +3818,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec ZVAL_EMPTY_STRING(result); return; } - Z_TYPE_P(result) = IS_STRING; +//??? Z_TYPE_P(result) = IS_STRING; /* If search is an array */ if (Z_TYPE_P(search) == IS_ARRAY) { @@ -3884,6 +3884,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec STR_FREE(Z_STR_P(result)); Z_STR_P(result) = Z_STR(temp_result); + Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result); if (Z_STRLEN_P(result) == 0) { zval_ptr_dtor(&tmp_subject); @@ -4163,7 +4164,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) php_char_to_str(broken_str->val, broken_str->len,'\n', "
\n", 7, return_value); STR_FREE(broken_str); } else { - RETURN_STR(broken_str); + RETURN_NEW_STR(broken_str); } } /* }}} */ @@ -4260,7 +4261,7 @@ PHP_FUNCTION(nl2br) *target = '\0'; - RETURN_STR(result); + RETURN_NEW_STR(result); } /* }}} */ @@ -4879,7 +4880,7 @@ PHP_FUNCTION(str_repeat) result->val[result_len] = '\0'; - RETURN_STR(result); + RETURN_NEW_STR(result); } /* }}} */ @@ -5254,7 +5255,7 @@ PHP_FUNCTION(str_pad) result->val[result->len] = '\0'; - RETURN_STR(result); + RETURN_NEW_STR(result); } /* }}} */ @@ -5464,7 +5465,7 @@ PHP_FUNCTION(money_format) } str->val[str->len] = '\0'; - RETURN_STR(STR_REALLOC(str, str->len, 0)); + RETURN_NEW_STR(STR_REALLOC(str, str->len, 0)); } /* }}} */ #endif diff --git a/ext/standard/url.c b/ext/standard/url.c index 26587dc8f8a..3ce1c568ed5 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -558,7 +558,7 @@ PHP_FUNCTION(urldecode) out_str = STR_INIT(in_str->val, in_str->len, 0); out_str->len = php_url_decode(out_str->val, out_str->len); - RETURN_STR(out_str); + RETURN_NEW_STR(out_str); } /* }}} */ @@ -653,7 +653,7 @@ PHP_FUNCTION(rawurldecode) out_str = STR_INIT(in_str->val, in_str->len, 0); out_str->len = php_raw_url_decode(out_str->val, out_str->len); - RETURN_STR(out_str); + RETURN_NEW_STR(out_str); } /* }}} */ diff --git a/main/php_ini.c b/main/php_ini.c index 5fd5bfc8524..a1b2cecabc0 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -594,7 +594,7 @@ int php_init_config(TSRMLS_D) { zval tmp; - ZVAL_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1)); + ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1)); zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp); if (php_ini_opened_path) { efree(php_ini_opened_path); diff --git a/main/php_variables.c b/main/php_variables.c index 20bee7e8d9f..4202db5aa2b 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -49,7 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva assert(strval != NULL); /* Prepare value */ - ZVAL_STR(&new_entry, STR_INIT(strval, str_len, 0)); + ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0)); php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); } @@ -609,11 +609,9 @@ static inline void php_register_server_variables(TSRMLS_D) /* store request init time */ { zval request_time_float, request_time_long; - Z_TYPE(request_time_float) = IS_DOUBLE; - Z_DVAL(request_time_float) = sapi_get_request_time(TSRMLS_C); + ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C)); php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); - Z_TYPE(request_time_long) = IS_LONG; - Z_LVAL(request_time_long) = zend_dval_to_lval(Z_DVAL(request_time_float)); + ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float))); php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); } diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 82f7ad36f65..a5845d9f8d1 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -1511,7 +1511,7 @@ void fcgi_impersonate(void) void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len) { zval zvalue; - ZVAL_STR(&zvalue, STR_INIT(value, value_len, 1)); + ZVAL_NEW_STR(&zvalue, STR_INIT(value, value_len, 1)); zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue); } diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index b85aded875e..2156cb14fca 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -425,7 +425,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */ /* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */ #define INI_DEFAULT(name,value)\ - ZVAL_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\ + ZVAL_NEW_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\ zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\ static void sapi_cli_ini_defaults(HashTable *configuration_hash) diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 04ece1a509d..bd057f0577e 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -711,7 +711,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co new_break.code_len = expr_len; str = STR_ALLOC(expr_len + sizeof("return ;") - 1, 0); - ZVAL_STR(&pv, str); + ZVAL_NEW_STR(&pv, str); memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_len); Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';