diff options
author | Anatol Belski <ab@php.net> | 2014-08-25 19:24:55 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-25 19:24:55 +0200 |
commit | c3e3c98ec666812daaaca896cf5ef758a8a6df14 (patch) | |
tree | d82a76de5c8d117d1cf2dcca19bb30a283621870 /Zend | |
parent | 0cf2dbdf58645b52cb6582b1b2571c5cd9e9e6b3 (diff) | |
download | php-git-c3e3c98ec666812daaaca896cf5ef758a8a6df14.tar.gz |
master renames phase 1
Diffstat (limited to 'Zend')
53 files changed, 2267 insertions, 2349 deletions
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 8a676cba15..945409eb1e 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -130,7 +130,7 @@ int main() exit(1); } ], [ - AC_DEFINE([ZEND_DVAL_TO_IVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits]) + AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits]) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) diff --git a/Zend/zend.c b/Zend/zend.c index d52f3b6b9b..4c97e4231b 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -46,7 +46,7 @@ /* true multithread-shared globals */ ZEND_API zend_class_entry *zend_standard_class_def = NULL; -ZEND_API zend_size_t (*zend_printf)(const char *format, ...); +ZEND_API size_t (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); @@ -54,14 +54,14 @@ ZEND_API void (*zend_block_interruptions)(void); ZEND_API void (*zend_unblock_interruptions)(void); ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC); ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); -zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap); +size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); void (*zend_on_timeout)(int seconds TSRMLS_DC); -static void (*zend_message_dispatcher_p)(zend_int_t message, const void *data TSRMLS_DC); +static void (*zend_message_dispatcher_p)(zend_long message, const void *data TSRMLS_DC); static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents); static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ @@ -134,7 +134,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, { zval *tmp; zend_string *string_key; - zend_uint_t num_key; + zend_ulong num_key; int i; for (i = 0; i < indent; i++) { @@ -193,7 +193,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */ { zval *tmp; zend_string *string_key; - zend_uint_t num_key; + zend_ulong num_key; int i = 0; ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) { @@ -226,23 +226,23 @@ again: break; case IS_TRUE: if (CG(one_char_string)['1']) { - ZVAL_INT_STR(expr_copy, CG(one_char_string)['1']); + ZVAL_LONG_STR(expr_copy, CG(one_char_string)['1']); } else { - ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0)); + ZVAL_NEW_STR(expr_copy, zend_string_init("1", 1, 0)); } break; case IS_RESOURCE: { - char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT]; + char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; int len; len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(expr)); - ZVAL_NEW_STR(expr_copy, STR_INIT(buf, len, 0)); + ZVAL_NEW_STR(expr_copy, zend_string_init(buf, len, 0)); } break; case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); // TODO: use interned string ??? - ZVAL_NEW_STR(expr_copy, STR_INIT("Array", sizeof("Array") - 1, 0)); + ZVAL_NEW_STR(expr_copy, zend_string_init("Array", sizeof("Array") - 1, 0)); break; case IS_OBJECT: if (Z_OBJ_HANDLER_P(expr, cast_object)) { @@ -278,7 +278,7 @@ again: case IS_REFERENCE: expr = Z_REFVAL_P(expr); if (Z_TYPE_P(expr) == IS_STRING) { - ZVAL_STR(expr_copy, STR_COPY(Z_STR_P(expr))); + ZVAL_STR(expr_copy, zend_string_copy(Z_STR_P(expr))); return 1; } goto again; @@ -307,7 +307,7 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in write_func(str->val, len); } - STR_RELEASE(str); + zend_string_release(str); return len; } /* }}} */ @@ -343,7 +343,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */ zend_printf("%s Object (", "Unknown Class"); } if (class_name) { - STR_RELEASE(class_name); + zend_string_release(class_name); } if (Z_OBJ_HANDLER_P(expr, get_properties)) { properties = Z_OBJPROP_P(expr); @@ -406,7 +406,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int } ZEND_PUTS_EX(" Object\n"); if (class_name) { - STR_RELEASE(class_name); + zend_string_release(class_name); } if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { break; @@ -739,7 +739,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS zend_interned_strings_init(TSRMLS_C); zend_startup_builtin_functions(TSRMLS_C); zend_register_standard_constants(TSRMLS_C); - zend_register_auto_global(STR_INIT("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals TSRMLS_CC); + zend_register_auto_global(zend_string_init("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals TSRMLS_CC); #ifndef ZTS zend_init_rsrc_plist(TSRMLS_C); @@ -972,7 +972,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC) /* {{{ */ +ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC) /* {{{ */ { if (zend_message_dispatcher_p) { zend_message_dispatcher_p(message, data TSRMLS_CC); @@ -1152,13 +1152,13 @@ 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_NEW_STR(¶ms[1], STR_INIT(str, len, 0)); + ZVAL_NEW_STR(¶ms[1], zend_string_init(str, len, 0)); efree(str); #ifdef va_copy va_end(usr_copy); #endif - ZVAL_INT(¶ms[0], type); + ZVAL_LONG(¶ms[0], type); if (error_filename) { ZVAL_STRING(¶ms[2], error_filename); @@ -1166,7 +1166,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ ZVAL_NULL(¶ms[2]); } - ZVAL_INT(¶ms[3], error_lineno); + ZVAL_LONG(¶ms[3], error_lineno); symbol_table = zend_rebuild_symbol_table(TSRMLS_C); @@ -1293,7 +1293,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_cou int i; zend_file_handle *file_handle; zend_op_array *op_array; - zend_int_t orig_interactive = CG(interactive); + zend_long orig_interactive = CG(interactive); va_start(files, file_count); for (i = 0; i < file_count; i++) { @@ -1390,7 +1390,7 @@ void free_estring(char **str_p) /* {{{ */ void free_string_zval(zval *zv) /* {{{ */ { zend_string *str = Z_PTR_P(zv); - STR_RELEASE(str); + zend_string_release(str); } /* }}} */ diff --git a/Zend/zend.h b/Zend/zend.h index 731a8e5a81..4c784cd9a0 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -274,11 +274,11 @@ char *alloca (); #endif #if SIZEOF_ZEND_INT == 4 -#define MAX_LENGTH_OF_ZEND_INT 11 -static const char int_min_digits[] = "2147483648"; +#define MAX_LENGTH_OF_LONG 11 +static const char long_min_digits[] = "2147483648"; #elif SIZEOF_ZEND_INT == 8 -#define MAX_LENGTH_OF_ZEND_INT 20 -static const char int_min_digits[] = "9223372036854775808"; +#define MAX_LENGTH_OF_LONG 20 +static const char long_min_digits[] = "9223372036854775808"; #else #error "Unknown SIZEOF_ZEND_INT" #endif @@ -388,7 +388,7 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore # else /* ! (CRAY || __arm) */ # define XtOffset(p_type, field) \ - ((zend_int_t) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) + ((zend_long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) # endif /* !CRAY */ @@ -534,8 +534,8 @@ struct _zend_class_entry { #include "zend_stream.h" typedef struct _zend_utility_functions { void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); - zend_size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); - zend_size_t (*write_function)(const char *str, zend_size_t str_length); + size_t (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); + size_t (*write_function)(const char *str, size_t str_length); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); void (*message_handler)(long message, const void *data TSRMLS_DC); void (*block_interruptions)(void); @@ -544,7 +544,7 @@ typedef struct _zend_utility_functions { void (*ticks_function)(int ticks TSRMLS_DC); void (*on_timeout)(int seconds TSRMLS_DC); int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); - zend_size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap); + size_t (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap); zend_string *(*vstrpprintf_function)(size_t max_len, const char *format, va_list ap); char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC); char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC); @@ -646,7 +646,7 @@ END_EXTERN_C() #define ZEND_PUTC(c) zend_write(&(c), 1) BEGIN_EXTERN_C() -extern ZEND_API zend_size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); +extern ZEND_API size_t (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); extern ZEND_API zend_write_func_t zend_write; extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); extern ZEND_API void (*zend_block_interruptions)(void); @@ -655,8 +655,8 @@ extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC); extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC); extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -extern zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap); -extern zend_string *(*zend_vstrpprintf)(zend_size_t max_len, const char *format, va_list ap); +extern size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); +extern zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap); extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); @@ -685,7 +685,7 @@ END_EXTERN_C() #endif BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC); +ZEND_API void zend_message_dispatcher(zend_long message, const void *data TSRMLS_DC); ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents); END_EXTERN_C() diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 348737bddc..02d6484afd 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -166,7 +166,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ case IS_FALSE: case IS_TRUE: return "boolean"; - case IS_INT: + case IS_LONG: return "integer"; case IS_DOUBLE: return "double"; @@ -228,7 +228,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type TSRMLS_CC) == SUCCESS) { zval_ptr_dtor(arg); ZVAL_COPY_VALUE(arg, &obj); - *pl = Z_STRSIZE_P(arg); + *pl = Z_STRLEN_P(arg); *p = Z_STRVAL_P(arg); return SUCCESS; } @@ -237,7 +237,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) { SEPARATE_ZVAL_NOREF(arg); if (zend_std_cast_object_tostring(arg, arg, type TSRMLS_CC) == SUCCESS) { - *pl = Z_STRSIZE_P(arg); + *pl = Z_STRLEN_P(arg); *p = Z_STRVAL_P(arg); return SUCCESS; } @@ -252,7 +252,7 @@ static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSR if (!zend_make_printable_zval(z, arg TSRMLS_CC)) { ZVAL_ZVAL(arg, z, 1, 1); } - *pl = Z_STRSIZE_P(arg); + *pl = Z_STRLEN_P(arg); *p = Z_STRVAL_P(arg); return SUCCESS; } @@ -413,7 +413,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons case 'l': case 'L': { - long *p = va_arg(*va, long *); + zend_long *p = va_arg(*va, zend_long *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); @@ -426,71 +426,10 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons double d; int type; - if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), (zend_int_t *)p, &d, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { - if (d > LONG_MAX) { - *p = LONG_MAX; - break; - } else if (d < LONG_MIN) { - *p = LONG_MIN; - break; - } - } - - *p = zend_dval_to_ival(d); - } - } - break; - - case IS_DOUBLE: - if (c == 'L') { - if (Z_DVAL_P(arg) > LONG_MAX) { - *p = LONG_MAX; - break; - } else if (Z_DVAL_P(arg) < LONG_MIN) { - *p = LONG_MIN; - break; - } - } - case IS_NULL: - case IS_FALSE: - case IS_TRUE: - case IS_INT: - convert_to_int_ex(arg); - *p = Z_IVAL_P(arg); - break; - - case IS_ARRAY: - case IS_OBJECT: - case IS_RESOURCE: - default: - return "long"; - } - } - break; - - case 'i': - case 'I': - { - zend_int_t *p = va_arg(*va, zend_int_t *); - - if (check_null) { - zend_bool *p = va_arg(*va, zend_bool *); - *p = (Z_TYPE_P(arg) == IS_NULL); - } - - switch (Z_TYPE_P(arg)) { - case IS_STRING: - { - double d; - int type; - - if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), p, &d, -1)) == 0) { - return "long"; - } else if (type == IS_DOUBLE) { - if (c == 'I') { if (d > ZEND_INT_MAX) { *p = ZEND_INT_MAX; break; @@ -500,13 +439,13 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } } - *p = zend_dval_to_ival(d); + *p = zend_dval_to_lval(d); } } break; case IS_DOUBLE: - if (c == 'I') { + if (c == 'L') { if (Z_DVAL_P(arg) > ZEND_INT_MAX) { *p = ZEND_INT_MAX; break; @@ -518,9 +457,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons case IS_NULL: case IS_FALSE: case IS_TRUE: - case IS_INT: + case IS_LONG: convert_to_int_ex(arg); - *p = Z_IVAL_P(arg); + *p = Z_LVAL_P(arg); break; case IS_ARRAY: @@ -544,12 +483,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons switch (Z_TYPE_P(arg)) { case IS_STRING: { - zend_int_t l; + zend_long l; int type; - if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &l, p, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &l, p, -1)) == 0) { return "double"; - } else if (type == IS_INT) { + } else if (type == IS_LONG) { *p = (double) l; } } @@ -558,7 +497,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons case IS_NULL: case IS_FALSE: case IS_TRUE: - case IS_INT: + case IS_LONG: case IS_DOUBLE: convert_to_double_ex(arg); *p = Z_DVAL_P(arg); @@ -587,14 +526,14 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } /* break omitted intentionally */ - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(arg); case IS_STRING: *p = Z_STRVAL_P(arg); - *pl = Z_STRSIZE_P(arg); + *pl = Z_STRLEN_P(arg); if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) { return "a valid path"; } @@ -628,7 +567,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } /* break omitted intentionally */ - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: @@ -668,7 +607,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons switch (Z_TYPE_P(arg)) { case IS_NULL: case IS_STRING: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: @@ -932,7 +871,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, case 'f': case 'A': case 'H': case 'p': case 'S': case 'P': - case 'i': + case 'L': max_num_args++; break; @@ -1205,7 +1144,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC) if (key) { zval member; - ZVAL_STR(&member, STR_COPY(key)); + ZVAL_STR(&member, zend_string_copy(key)); obj_ht->write_property(obj, &member, value, NULL TSRMLS_CC); zval_ptr_dtor(&member); } @@ -1425,11 +1364,11 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr) } /* }}} */ -ZEND_API int add_assoc_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n) /* {{{ */ +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, zend_long n) /* {{{ */ { zval *ret, tmp; - ZVAL_INT(&tmp, n); + ZVAL_LONG(&tmp, n); ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); return ret ? SUCCESS : FAILURE; } @@ -1514,16 +1453,16 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v } /* }}} */ -ZEND_API int add_index_int(zval *arg, zend_uint_t index, zend_int_t n) /* {{{ */ +ZEND_API int add_index_long(zval *arg, zend_ulong index, zend_long n) /* {{{ */ { zval tmp; - ZVAL_INT(&tmp, n); + ZVAL_LONG(&tmp, n); return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE; } /* }}} */ -ZEND_API int add_index_null(zval *arg, zend_uint_t index) /* {{{ */ +ZEND_API int add_index_null(zval *arg, zend_ulong index) /* {{{ */ { zval tmp; @@ -1532,7 +1471,7 @@ ZEND_API int add_index_null(zval *arg, zend_uint_t index) /* {{{ */ } /* }}} */ -ZEND_API int add_index_bool(zval *arg, zend_uint_t index, int b) /* {{{ */ +ZEND_API int add_index_bool(zval *arg, zend_ulong index, int b) /* {{{ */ { zval tmp; @@ -1541,7 +1480,7 @@ ZEND_API int add_index_bool(zval *arg, zend_uint_t index, int b) /* {{{ */ } /* }}} */ -ZEND_API int add_index_resource(zval *arg, zend_uint_t index, zend_resource *r) /* {{{ */ +ZEND_API int add_index_resource(zval *arg, zend_ulong index, zend_resource *r) /* {{{ */ { zval tmp; @@ -1550,7 +1489,7 @@ ZEND_API int add_index_resource(zval *arg, zend_uint_t index, zend_resource *r) } /* }}} */ -ZEND_API int add_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */ +ZEND_API int add_index_double(zval *arg, zend_ulong index, double d) /* {{{ */ { zval tmp; @@ -1559,7 +1498,7 @@ ZEND_API int add_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */ } /* }}} */ -ZEND_API int add_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{{ */ +ZEND_API int add_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */ { zval tmp; @@ -1568,7 +1507,7 @@ ZEND_API int add_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{ } /* }}} */ -ZEND_API int add_index_string(zval *arg, zend_uint_t index, const char *str) /* {{{ */ +ZEND_API int add_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */ { zval tmp; @@ -1577,7 +1516,7 @@ ZEND_API int add_index_string(zval *arg, zend_uint_t index, const char *str) /* } /* }}} */ -ZEND_API int add_index_stringl(zval *arg, zend_uint_t index, const char *str, uint length) /* {{{ */ +ZEND_API int add_index_stringl(zval *arg, zend_ulong index, const char *str, uint length) /* {{{ */ { zval tmp; @@ -1586,17 +1525,17 @@ ZEND_API int add_index_stringl(zval *arg, zend_uint_t index, const char *str, ui } /* }}} */ -ZEND_API int add_index_zval(zval *arg, zend_uint_t index, zval *value) /* {{{ */ +ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value) /* {{{ */ { return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE; } /* }}} */ -ZEND_API int add_next_index_int(zval *arg, zend_int_t n) /* {{{ */ +ZEND_API int add_next_index_long(zval *arg, zend_long n) /* {{{ */ { zval tmp; - ZVAL_INT(&tmp, n); + ZVAL_LONG(&tmp, n); return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE; } /* }}} */ @@ -1690,16 +1629,16 @@ ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len } /* }}} */ -ZEND_API zval *add_get_index_int(zval *arg, zend_uint_t index, zend_int_t l) /* {{{ */ +ZEND_API zval *add_get_index_long(zval *arg, zend_ulong index, zend_long l) /* {{{ */ { zval tmp; - ZVAL_INT(&tmp, l); + ZVAL_LONG(&tmp, l); return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); } /* }}} */ -ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t index, double d) /* {{{ */ +ZEND_API zval *add_get_index_double(zval *arg, zend_ulong index, double d) /* {{{ */ { zval tmp; @@ -1708,7 +1647,7 @@ ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t index, double d) /* { } /* }}} */ -ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str) /* {{{ */ +ZEND_API zval *add_get_index_str(zval *arg, zend_ulong index, zend_string *str) /* {{{ */ { zval tmp; @@ -1717,7 +1656,7 @@ ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str) } /* }}} */ -ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t index, const char *str) /* {{{ */ +ZEND_API zval *add_get_index_string(zval *arg, zend_ulong index, const char *str) /* {{{ */ { zval tmp; @@ -1726,7 +1665,7 @@ ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t index, const char *st } /* }}} */ -ZEND_API zval *add_get_index_stringl(zval *arg, zend_uint_t index, const char *str, uint length) /* {{{ */ +ZEND_API zval *add_get_index_stringl(zval *arg, zend_ulong index, const char *str, uint length) /* {{{ */ { zval tmp; @@ -1756,11 +1695,11 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC) case IS_TRUE: result = zend_hash_index_update(ht, 1, value); break; - case IS_INT: - result = zend_hash_index_update(ht, Z_IVAL_P(key), value); + case IS_LONG: + result = zend_hash_index_update(ht, Z_LVAL_P(key), value); break; case IS_DOUBLE: - result = zend_hash_index_update(ht, zend_dval_to_ival(Z_DVAL_P(key)), value); + result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -1778,12 +1717,12 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC) } /* }}} */ -ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, zend_long n TSRMLS_DC) /* {{{ */ { zval tmp; zval z_key; - ZVAL_INT(&tmp, n); + ZVAL_LONG(&tmp, n); ZVAL_STRINGL(&z_key, key, key_len); Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, NULL TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ @@ -1792,7 +1731,7 @@ ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_ } /* }}} */ -ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_int_t b TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_long b TSRMLS_DC) /* {{{ */ { zval tmp; zval z_key; @@ -1920,17 +1859,17 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ zend_module_entry *req_mod; name_len = strlen(dep->name); - lcname = STR_ALLOC(name_len, 0); + lcname = zend_string_alloc(name_len, 0); zend_str_tolower_copy(lcname->val, dep->name, name_len); if ((req_mod = zend_hash_find_ptr(&module_registry, lcname)) == NULL || !req_mod->module_started) { - STR_FREE(lcname); + zend_string_free(lcname); /* TODO: Check version relationship */ zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name); module->module_started = 0; return FAILURE; } - STR_FREE(lcname); + zend_string_free(lcname); } ++dep; } @@ -2109,31 +2048,31 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS while (dep->name) { if (dep->type == MODULE_DEP_CONFLICTS) { name_len = strlen(dep->name); - lcname = STR_ALLOC(name_len, 0); + lcname = zend_string_alloc(name_len, 0); zend_str_tolower_copy(lcname->val, dep->name, name_len); if (zend_hash_exists(&module_registry, lcname)) { - STR_FREE(lcname); + zend_string_free(lcname); /* TODO: Check version relationship */ zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name); return NULL; } - STR_FREE(lcname); + zend_string_free(lcname); } ++dep; } } name_len = strlen(module->name); - lcname = STR_ALLOC(name_len, 1); + lcname = zend_string_alloc(name_len, 1); zend_str_tolower_copy(lcname->val, module->name, name_len); if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) { zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name); - STR_RELEASE(lcname); + zend_string_release(lcname); return NULL; } - STR_RELEASE(lcname); + zend_string_release(lcname); module = module_ptr; EG(current_module) = module; @@ -2261,7 +2200,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio while (ptr->fname) { fname_len = strlen(ptr->fname); internal_function->handler = ptr->handler; - internal_function->function_name = zend_new_interned_string(STR_INIT(ptr->fname, fname_len, 1) TSRMLS_CC); + internal_function->function_name = zend_new_interned_string(zend_string_init(ptr->fname, fname_len, 1) TSRMLS_CC); internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->flags) { @@ -2327,7 +2266,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio return FAILURE; } } - lowercase_name = STR_ALLOC(fname_len, 1); + lowercase_name = zend_string_alloc(fname_len, 1); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); reg_function = malloc(sizeof(zend_internal_function)); @@ -2335,7 +2274,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (zend_hash_add_ptr(target_function_table, lowercase_name, reg_function) == NULL) { unload=1; free(reg_function); - STR_RELEASE(lowercase_name); + zend_string_release(lowercase_name); break; } @@ -2392,7 +2331,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } ptr++; count++; - STR_RELEASE(lowercase_name); + zend_string_release(lowercase_name); } if (unload) { /* before unloading, display all remaining bad function in the module */ if (scope) { @@ -2400,12 +2339,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } while (ptr->fname) { fname_len = strlen(ptr->fname); - lowercase_name = STR_ALLOC(fname_len, 0); + lowercase_name = zend_string_alloc(fname_len, 0); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); if (zend_hash_exists(target_function_table, lowercase_name)) { zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname); } - STR_FREE(lowercase_name); + zend_string_free(lowercase_name); ptr++; } zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); @@ -2516,10 +2455,10 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in break; } fname_len = strlen(ptr->fname); - lowercase_name = STR_ALLOC(fname_len, 0); + lowercase_name = zend_string_alloc(fname_len, 0); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); zend_hash_del(target_function_table, lowercase_name); - STR_FREE(lowercase_name); + zend_string_free(lowercase_name); ptr++; i++; } @@ -2721,7 +2660,7 @@ int zend_next_free_module(void) /* {{{ */ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */ { zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); - zend_string *lowercase_name = STR_ALLOC(orig_class_entry->name->len, 1); + zend_string *lowercase_name = zend_string_alloc(orig_class_entry->name->len, 1); *class_entry = *orig_class_entry; class_entry->type = ZEND_INTERNAL_CLASS; @@ -2736,7 +2675,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class zend_str_tolower_copy(lowercase_name->val, orig_class_entry->name->val, class_entry->name->len); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry); - STR_RELEASE(lowercase_name); + zend_string_release(lowercase_name); return class_entry; } /* }}} */ @@ -2793,14 +2732,14 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c zend_string *lcname; if (name[0] == '\\') { - lcname = STR_ALLOC(name_len-1, 1); + lcname = zend_string_alloc(name_len-1, 1); zend_str_tolower_copy(lcname->val, name+1, name_len-1); } else { - lcname = STR_ALLOC(name_len, 1); + lcname = zend_string_alloc(name_len, 1); zend_str_tolower_copy(lcname->val, name, name_len); } ce = zend_hash_add_ptr(CG(class_table), lcname, ce); - STR_RELEASE(lcname); + zend_string_release(lcname); if (ce) { ce->refcount++; return SUCCESS; @@ -2886,7 +2825,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_ zend_class_entry *disabled_class; zend_string *key; - key = STR_ALLOC(class_name_length, 0); + key = zend_string_alloc(class_name_length, 0); zend_str_tolower_copy(key->val, class_name, class_name_length); disabled_class = zend_hash_find_ptr(CG(class_table), key); if (!disabled_class) { @@ -3003,7 +2942,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca /* Skip leading \ */ if (UNEXPECTED(Z_STRVAL_P(callable)[0] == '\\')) { - STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRSIZE_P(callable) - 1, use_heap); + STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1, use_heap); } else { lmname = Z_STR_P(callable); } @@ -3016,9 +2955,9 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca return 1; } else { if (lmname == Z_STR_P(callable)) { - STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRSIZE_P(callable), use_heap); + STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRLEN_P(callable), use_heap); } else { - STR_FORGET_HASH_VAL(lmname); + zend_string_forget_hash_val(lmname); } zend_str_tolower(lmname->val, lmname->len); if ((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL) { @@ -3032,13 +2971,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } /* Split name into class/namespace and method/function names */ - if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRSIZE_P(callable))) != NULL && + if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRLEN_P(callable))) != NULL && colon > Z_STRVAL_P(callable) && *(colon-1) == ':' ) { colon--; clen = colon - Z_STRVAL_P(callable); - mlen = Z_STRSIZE_P(callable) - clen - 2; + mlen = Z_STRLEN_P(callable) - clen - 2; if (colon == Z_STRVAL_P(callable)) { if (error) zend_spprintf(error, 0, "invalid function name"); @@ -3052,13 +2991,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca EG(scope) = ce_org; } - cname = STR_INIT(Z_STRVAL_P(callable), clen, 0); + cname = zend_string_init(Z_STRVAL_P(callable), clen, 0); if (!zend_is_callable_check_class(cname, fcc, &strict_class, error TSRMLS_CC)) { - STR_RELEASE(cname); + zend_string_release(cname); EG(scope) = last_scope; return 0; } - STR_RELEASE(cname); + zend_string_release(cname); EG(scope) = last_scope; ftable = &fcc->calling_scope->function_table; @@ -3066,12 +3005,12 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ce_org->name->val, fcc->calling_scope->name->val); return 0; } - mname = STR_INIT(Z_STRVAL_P(callable) + clen + 2, mlen, 0); + mname = zend_string_init(Z_STRVAL_P(callable) + clen + 2, mlen, 0); } else if (ce_org) { /* Try to fetch find static method of given class. */ - mlen = Z_STRSIZE_P(callable); + mlen = Z_STRLEN_P(callable); mname = Z_STR_P(callable); - STR_ADDREF(mname); + zend_string_addref(mname); ftable = &ce_org->function_table; fcc->calling_scope = ce_org; } else { @@ -3082,7 +3021,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca return 0; } - lmname = STR_ALLOC(mlen, 0); + lmname = zend_string_alloc(mlen, 0); zend_str_tolower_copy(lmname->val, mname->val, mlen); if (strict_class && fcc->calling_scope && @@ -3136,7 +3075,7 @@ get_function_via_handler: fcc->function_handler->internal_function.scope = ce_org; fcc->function_handler->internal_function.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; fcc->function_handler->internal_function.function_name = mname; - STR_ADDREF(mname); + zend_string_addref(mname); call_via_handler = 1; retval = 1; } else if (fcc->object->handlers->get_method) { @@ -3147,7 +3086,7 @@ get_function_via_handler: !instanceof_function(ce_org, fcc->function_handler->common.scope TSRMLS_CC))) { if ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fcc->function_handler->common.function_name); + zend_string_release(fcc->function_handler->common.function_name); } efree(fcc->function_handler); } @@ -3250,8 +3189,8 @@ get_function_via_handler: if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname->val); } } - STR_FREE(lmname); - STR_RELEASE(mname); + zend_string_free(lmname); + zend_string_release(mname); if (fcc->object) { fcc->called_scope = zend_get_class_entry(fcc->object TSRMLS_CC); @@ -3299,16 +3238,16 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint if (callable_name) { char *ptr; - *callable_name = STR_ALLOC(fcc->calling_scope->name->len + Z_STRSIZE_P(callable) + sizeof("::") - 1, 0); + *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(callable) + sizeof("::") - 1, 0); ptr = (*callable_name)->val; memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); ptr += fcc->calling_scope->name->len; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_P(callable), Z_STRSIZE_P(callable) + 1); + memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1); } } else if (callable_name) { - *callable_name = STR_COPY(Z_STR_P(callable)); + *callable_name = zend_string_copy(Z_STR_P(callable)); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { fcc->called_scope = fcc->calling_scope; @@ -3323,7 +3262,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fcc->function_handler->common.function_name); + zend_string_release(fcc->function_handler->common.function_name); } efree(fcc->function_handler); } @@ -3356,13 +3295,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint char *ptr; - *callable_name = STR_ALLOC(Z_STRSIZE_P(obj) + Z_STRSIZE_P(method) + sizeof("::") - 1, 0); + *callable_name = zend_string_alloc(Z_STRLEN_P(obj) + Z_STRLEN_P(method) + sizeof("::") - 1, 0); ptr = (*callable_name)->val; - memcpy(ptr, Z_STRVAL_P(obj), Z_STRSIZE_P(obj)); - ptr += Z_STRSIZE_P(obj); + memcpy(ptr, Z_STRVAL_P(obj), Z_STRLEN_P(obj)); + ptr += Z_STRLEN_P(obj); memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_P(method), Z_STRSIZE_P(method) + 1); + memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { @@ -3386,13 +3325,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint if (callable_name) { char *ptr; - *callable_name = STR_ALLOC(fcc->calling_scope->name->len + Z_STRSIZE_P(method) + sizeof("::") - 1, 0); + *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(method) + sizeof("::") - 1, 0); ptr = (*callable_name)->val; memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); ptr += fcc->calling_scope->name->len; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_P(method), Z_STRSIZE_P(method) + 1); + memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { @@ -3411,7 +3350,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fcc->function_handler->common.function_name); + zend_string_release(fcc->function_handler->common.function_name); } efree(fcc->function_handler); } @@ -3430,7 +3369,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint if (error) zend_spprintf(error, 0, "array must have exactly two members"); } if (callable_name) { - *callable_name = STR_INIT("Array", sizeof("Array")-1, 0); + *callable_name = zend_string_init("Array", sizeof("Array")-1, 0); } } return 0; @@ -3441,7 +3380,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint if (callable_name) { zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */ - *callable_name = STR_ALLOC(ce->name->len + sizeof("::__invoke") - 1, 0); + *callable_name = zend_string_alloc(ce->name->len + sizeof("::__invoke") - 1, 0); memcpy((*callable_name)->val, ce->name->val, ce->name->len); memcpy((*callable_name)->val + ce->name->len, "::__invoke", sizeof("::__invoke")); } @@ -3473,8 +3412,8 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) { zval_dtor(callable); array_init(callable); - add_next_index_str(callable, STR_COPY(fcc.calling_scope->name)); - add_next_index_str(callable, STR_COPY(fcc.function_handler->common.function_name)); + add_next_index_str(callable, zend_string_copy(fcc.calling_scope->name)); + add_next_index_str(callable, zend_string_copy(fcc.function_handler->common.function_name)); } if (fcc.function_handler && ((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION && @@ -3482,7 +3421,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY || fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) { if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fcc.function_handler->common.function_name); + zend_string_release(fcc.function_handler->common.function_name); } efree(fcc.function_handler); } @@ -3676,10 +3615,10 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */ int name_len = strlen(module_name); zend_module_entry *module; - lname = STR_ALLOC(name_len, 0); + lname = zend_string_alloc(name_len, 0); zend_str_tolower_copy(lname->val, module_name, name_len); module = zend_hash_find_ptr(&module_registry, lname); - STR_FREE(lname); + zend_string_free(lname); return module ? module->version : NULL; } /* }}} */ @@ -3747,7 +3686,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z } break; case ZEND_ACC_PUBLIC: - property_info->name = STR_COPY(name); + property_info->name = zend_string_copy(name); break; } @@ -3763,9 +3702,9 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */ { - zend_string *key = STR_INIT(name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_string *key = zend_string_init(name, name_length, ce->type & ZEND_INTERNAL_CLASS); int ret = zend_declare_property_ex(ce, key, property, access_type, NULL TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } /* }}} */ @@ -3779,7 +3718,7 @@ ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, } /* }}} */ -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC) /* {{{ */ { zval property; @@ -3788,11 +3727,11 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, } /* }}} */ -ZEND_API int zend_declare_property_int(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC) /* {{{ */ { zval property; - ZVAL_INT(&property, value); + ZVAL_LONG(&property, value); return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); } /* }}} */ @@ -3810,7 +3749,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name { zval property; - ZVAL_NEW_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&property, zend_string_init(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); } /* }}} */ @@ -3819,7 +3758,7 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *nam { zval property; - ZVAL_NEW_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&property, zend_string_init(value, value_len, ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); } /* }}} */ @@ -3843,11 +3782,11 @@ ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char * } /* }}} */ -ZEND_API int zend_declare_class_constant_int(zend_class_entry *ce, const char *name, size_t name_length, zend_int_t value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value TSRMLS_DC) /* {{{ */ { zval constant; - ZVAL_INT(&constant, value); + ZVAL_LONG(&constant, value); return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC); } /* }}} */ @@ -3874,7 +3813,7 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha { zval constant; - ZVAL_NEW_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS)); + ZVAL_NEW_STR(&constant, zend_string_init(value, value_length, ce->type & ZEND_INTERNAL_CLASS)); return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC); } /* }}} */ @@ -3913,7 +3852,7 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c } /* }}} */ -ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */ { zval tmp; @@ -3922,11 +3861,11 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c } /* }}} */ -ZEND_API void zend_update_property_int(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */ { zval tmp; - ZVAL_INT(&tmp, value); + ZVAL_LONG(&tmp, value); zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC); } /* }}} */ @@ -3973,12 +3912,12 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na { zval *property; zend_class_entry *old_scope = EG(scope); - zend_string *key = STR_INIT(name, name_length, 0); + zend_string *key = zend_string_init(name, name_length, 0); EG(scope) = scope; property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC); EG(scope) = old_scope; - STR_FREE(key); + zend_string_free(key); if (!property) { return FAILURE; } else { @@ -4015,7 +3954,7 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */ { zval tmp; @@ -4024,11 +3963,11 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_int(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC) /* {{{ */ { zval tmp; - ZVAL_INT(&tmp, value); + ZVAL_LONG(&tmp, value); return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC); } /* }}} */ @@ -4088,12 +4027,12 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *na { zval *property; zend_class_entry *old_scope = EG(scope); - zend_string *key = STR_INIT(name, name_length, 0); + zend_string *key = zend_string_init(name, name_length, 0); EG(scope) = scope; property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC); EG(scope) = old_scope; - STR_FREE(key); + zend_string_free(key); return property; } @@ -4132,10 +4071,10 @@ static int same_zval(zval *zv1, zval *zv2) /* {{{ */ case IS_FALSE: case IS_TRUE: return 1; - case IS_INT: - return Z_IVAL_P(zv1) == Z_IVAL_P(zv2); + case IS_LONG: + return Z_LVAL_P(zv1) == Z_LVAL_P(zv2); case IS_DOUBLE: - return Z_IVAL_P(zv1) == Z_IVAL_P(zv2); + return Z_LVAL_P(zv1) == Z_LVAL_P(zv2); case IS_STRING: case IS_ARRAY: case IS_OBJECT: diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 7f61431e2f..e29f09501c 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -171,7 +171,7 @@ typedef struct _zend_fcall_info_cache { #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ { \ zend_string *cl_name; \ - cl_name = STR_INIT(class_name, class_name_len, 1); \ + cl_name = zend_string_init(class_name, class_name_len, 1); \ class_container.name = zend_new_interned_string(cl_name TSRMLS_CC); \ INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ } @@ -303,15 +303,15 @@ ZEND_API int zend_get_module_started(const char *module_name); ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment TSRMLS_DC); ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_int(zend_class_entry *ce, const char *name, int name_length, zend_int_t value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, zend_long value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC); ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC); ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_int(zend_class_entry *ce, const char *name, size_t name_length, zend_int_t value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, zend_long value TSRMLS_DC); ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC); ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC); ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC); @@ -320,8 +320,8 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC); ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC); ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC); -ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC); -ZEND_API void zend_update_property_int(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_int_t value TSRMLS_DC); +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC); +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long value TSRMLS_DC); ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC); ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_string *value TSRMLS_DC); ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC); @@ -329,8 +329,8 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC); ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC); -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC); -ZEND_API int zend_update_static_property_int(zend_class_entry *scope, const char *name, int name_length, zend_int_t value TSRMLS_DC); +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC); +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, zend_long value TSRMLS_DC); ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC); ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC); ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC); @@ -374,7 +374,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC); /* no longer supported */ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); -ZEND_API int add_assoc_int_ex(zval *arg, const char *key, uint key_len, zend_int_t n); +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, zend_long n); ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len); ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b); ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r); @@ -384,7 +384,7 @@ ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length); ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value); -#define add_assoc_int(__arg, __key, __n) add_assoc_int_ex(__arg, __key, strlen(__key), __n) +#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key)) #define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key), __b) #define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r) @@ -400,17 +400,17 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v #define add_next_index_unset(__arg) add_next_index_null(__arg) #define add_property_unset(__arg, __key) add_property_null(__arg, __key) -ZEND_API int add_index_int(zval *arg, zend_uint_t idx, zend_int_t n); -ZEND_API int add_index_null(zval *arg, zend_uint_t idx); -ZEND_API int add_index_bool(zval *arg, zend_uint_t idx, int b); -ZEND_API int add_index_resource(zval *arg, zend_uint_t idx, zend_resource *r); -ZEND_API int add_index_double(zval *arg, zend_uint_t idx, double d); -ZEND_API int add_index_str(zval *arg, zend_uint_t idx, zend_string *str); -ZEND_API int add_index_string(zval *arg, zend_uint_t idx, const char *str); -ZEND_API int add_index_stringl(zval *arg, zend_uint_t idx, const char *str, uint length); -ZEND_API int add_index_zval(zval *arg, zend_uint_t index, zval *value); - -ZEND_API int add_next_index_int(zval *arg, zend_int_t n); +ZEND_API int add_index_long(zval *arg, zend_ulong idx, zend_long n); +ZEND_API int add_index_null(zval *arg, zend_ulong idx); +ZEND_API int add_index_bool(zval *arg, zend_ulong idx, int b); +ZEND_API int add_index_resource(zval *arg, zend_ulong idx, zend_resource *r); +ZEND_API int add_index_double(zval *arg, zend_ulong idx, double d); +ZEND_API int add_index_str(zval *arg, zend_ulong idx, zend_string *str); +ZEND_API int add_index_string(zval *arg, zend_ulong idx, const char *str); +ZEND_API int add_index_stringl(zval *arg, zend_ulong idx, const char *str, uint length); +ZEND_API int add_index_zval(zval *arg, zend_ulong index, zval *value); + +ZEND_API int add_next_index_long(zval *arg, zend_long n); ZEND_API int add_next_index_null(zval *arg); ZEND_API int add_next_index_bool(zval *arg, int b); ZEND_API int add_next_index_resource(zval *arg, zend_resource *r); @@ -426,17 +426,17 @@ ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len #define add_get_assoc_string(__arg, __key, __str) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str) #define add_get_assoc_stringl(__arg, __key, __str, __length) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length) -ZEND_API zval *add_get_index_int(zval *arg, zend_uint_t idx, zend_int_t l); -ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t idx, double d); -ZEND_API zval *add_get_index_str(zval *arg, zend_uint_t index, zend_string *str); -ZEND_API zval *add_get_index_string(zval *arg, zend_uint_t idx, const char *str); -ZEND_API zval *add_get_index_stringl(zval *arg, zend_uint_t idx, const char *str, uint length); +ZEND_API zval *add_get_index_long(zval *arg, zend_ulong idx, zend_long l); +ZEND_API zval *add_get_index_double(zval *arg, zend_ulong idx, double d); +ZEND_API zval *add_get_index_str(zval *arg, zend_ulong index, zend_string *str); +ZEND_API zval *add_get_index_string(zval *arg, zend_ulong idx, const char *str); +ZEND_API zval *add_get_index_stringl(zval *arg, zend_ulong idx, const char *str, uint length); ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC); -ZEND_API int add_property_int_ex(zval *arg, const char *key, uint key_len, zend_int_t l TSRMLS_DC); +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, zend_long l TSRMLS_DC); ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC); -ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_int_t b TSRMLS_DC); +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, zend_long b TSRMLS_DC); ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC); ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC); ZEND_API int add_property_str_ex(zval *arg, const char *key, uint key_len, zend_string *str TSRMLS_DC); @@ -444,7 +444,7 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC); ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC); -#define add_property_int(__arg, __key, __n) add_property_int_ex(__arg, __key, strlen(__key), __n TSRMLS_CC) +#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) TSRMLS_CC) #define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC) #define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC) @@ -547,11 +547,11 @@ END_EXTERN_C() #define CHECK_ZVAL_STRING_REL(z) #endif -#define CHECK_ZVAL_NULL_PATH(p) (Z_STRSIZE_P(p) != strlen(Z_STRVAL_P(p))) +#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p))) #define CHECK_NULL_PATH(p, l) (strlen(p) != l) #define ZVAL_STRINGL(z, s, l) do { \ - ZVAL_NEW_STR(z, STR_INIT(s, l, 0)); \ + ZVAL_NEW_STR(z, zend_string_init(s, l, 0)); \ } while (0) #define ZVAL_STRING(z, s) do { \ @@ -560,11 +560,11 @@ END_EXTERN_C() } while (0) #define ZVAL_EMPTY_STRING(z) do { \ - ZVAL_INT_STR(z, STR_EMPTY_ALLOC()); \ + ZVAL_LONG_STR(z, STR_EMPTY_ALLOC()); \ } while (0) #define ZVAL_PSTRINGL(z, s, l) do { \ - ZVAL_NEW_STR(z, STR_INIT(s, l, 1)); \ + ZVAL_NEW_STR(z, zend_string_init(s, l, 1)); \ } while (0) #define ZVAL_PSTRING(z, s) do { \ @@ -598,10 +598,10 @@ END_EXTERN_C() #define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b) #define RETVAL_NULL() ZVAL_NULL(return_value) -#define RETVAL_INT(l) ZVAL_INT(return_value, l) +#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_LONG_STR(s) ZVAL_LONG_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) @@ -614,10 +614,10 @@ END_EXTERN_C() #define RETURN_BOOL(b) { RETVAL_BOOL(b); return; } #define RETURN_NULL() { RETVAL_NULL(); return;} -#define RETURN_INT(l) { RETVAL_INT(l); return; } +#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_LONG_STR(s) { RETVAL_LONG_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; } @@ -899,28 +899,28 @@ ZEND_API int _z_param_class(zval *arg, zend_class_entry **pce, int num, int chec Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, 0, 0) /* old "l" */ -#define Z_PARAM_INT_EX(dest, is_null, check_null, separate) \ +#define Z_PARAM_LONG_EX(dest, is_null, check_null, separate) \ Z_PARAM_PROLOGUE(separate); \ - if (UNEXPECTED(!_z_param_int(_arg, &dest, &is_null, check_null, 0))) { \ + if (UNEXPECTED(!_z_param_long(_arg, &dest, &is_null, check_null, 0))) { \ _expected_type = Z_EXPECTED_LONG; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } -#define Z_PARAM_INT(dest) \ - Z_PARAM_INT_EX(dest, _dummy, 0, 0) +#define Z_PARAM_LONG(dest) \ + Z_PARAM_LONG_EX(dest, _dummy, 0, 0) /* old "L" */ -#define Z_PARAM_STRICT_INT_EX(dest, is_null, check_null, separate) \ +#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) \ Z_PARAM_PROLOGUE(separate); \ - if (UNEXPECTED(!_z_param_int(_arg, &dest, &is_null, check_null, 1))) { \ + if (UNEXPECTED(!_z_param_long(_arg, &dest, &is_null, check_null, 1))) { \ _expected_type = Z_EXPECTED_LONG; \ error_code = ZPP_ERROR_WRONG_ARG; \ break; \ } -#define Z_PARAM_STRICT_INT(dest) \ - Z_PARAM_STRICT_INT_EX(dest, _dummy, 0, 0) +#define Z_PARAM_STRICT_LONG(dest) \ + Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0) /* old "o" */ #define Z_PARAM_OBJECT_EX(dest, check_null, separate) \ @@ -1073,33 +1073,33 @@ static zend_always_inline int _z_param_bool(zval *arg, zend_bool *dest, zend_boo return 1; } -static zend_always_inline int _z_param_int(zval *arg, zend_int_t *dest, zend_bool *is_null, int check_null, int strict) +static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null, int strict) { if (check_null) { *is_null = 0; } - if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) { - *dest = Z_IVAL_P(arg); + if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { + *dest = Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) { *dest = ZEND_INT_MAX; } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) { *dest = ZEND_INT_MIN; } else { - *dest = zend_dval_to_ival(Z_DVAL_P(arg)); + *dest = zend_dval_to_lval(Z_DVAL_P(arg)); } } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { double d; int type; - if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_INT)) { + if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { if (strict && UNEXPECTED(d > ZEND_INT_MAX)) { *dest = ZEND_INT_MAX; } else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) { *dest = ZEND_INT_MIN; } else { - *dest = zend_dval_to_ival(d); + *dest = zend_dval_to_lval(d); } } else { return 0; @@ -1125,10 +1125,10 @@ static zend_always_inline int _z_param_double(zval *arg, double *dest, zend_bool } if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { *dest = Z_DVAL_P(arg); - } else if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) { - *dest = (double)Z_IVAL_P(arg); + } else if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { + *dest = (double)Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { - zend_int_t l; + zend_long l; int type; if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) { diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 195235ffd9..b8edffeb47 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -488,16 +488,16 @@ static unsigned int _zend_mm_cookie = 0; #define ZEND_MM_RESERVE_SIZE (8*1024) #ifdef _WIN64 -# define ZEND_MM_INT_CONST(x) (x##i64) +# define ZEND_MM_LONG_CONST(x) (x##i64) #else -# define ZEND_MM_INT_CONST(x) (x##L) +# define ZEND_MM_LONG_CONST(x) (x##L) #endif -#define ZEND_MM_TYPE_MASK ZEND_MM_INT_CONST(0x3) +#define ZEND_MM_TYPE_MASK ZEND_MM_LONG_CONST(0x3) -#define ZEND_MM_FREE_BLOCK ZEND_MM_INT_CONST(0x0) -#define ZEND_MM_USED_BLOCK ZEND_MM_INT_CONST(0x1) -#define ZEND_MM_GUARD_BLOCK ZEND_MM_INT_CONST(0x3) +#define ZEND_MM_FREE_BLOCK ZEND_MM_LONG_CONST(0x0) +#define ZEND_MM_USED_BLOCK ZEND_MM_LONG_CONST(0x1) +#define ZEND_MM_GUARD_BLOCK ZEND_MM_LONG_CONST(0x3) #define ZEND_MM_BLOCK(b, type, size) do { \ size_t _size = (size); \ @@ -742,7 +742,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo *p = mm_block; mm_block->parent = p; mm_block->prev_free_block = mm_block->next_free_block = mm_block; - heap->large_free_bitmap |= (ZEND_MM_INT_CONST(1) << index); + heap->large_free_bitmap |= (ZEND_MM_LONG_CONST(1) << index); } else { size_t m; @@ -775,7 +775,7 @@ static inline void zend_mm_add_to_free_list(zend_mm_heap *heap, zend_mm_free_blo prev = ZEND_MM_SMALL_FREE_BUCKET(heap, index); if (prev->prev_free_block == prev) { - heap->free_bitmap |= (ZEND_MM_INT_CONST(1) << index); + heap->free_bitmap |= (ZEND_MM_LONG_CONST(1) << index); } next = prev->next_free_block; @@ -809,7 +809,7 @@ static inline void zend_mm_remove_from_free_list(zend_mm_heap *heap, zend_mm_fre ZEND_MM_CHECK_TREE(mm_block); *mm_block->parent = NULL; if (mm_block->parent == &heap->large_free_buckets[index]) { - heap->large_free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index); + heap->large_free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index); } } else { while (*(cp = &(prev->child[prev->child[1] != NULL])) != NULL) { @@ -847,7 +847,7 @@ subst_block: size_t index = ZEND_MM_BUCKET_INDEX(ZEND_MM_FREE_BLOCK_SIZE(mm_block)); if (EXPECTED(heap->free_buckets[index*2] == heap->free_buckets[index*2+1])) { - heap->free_bitmap &= ~(ZEND_MM_INT_CONST(1) << index); + heap->free_bitmap &= ~(ZEND_MM_LONG_CONST(1) << index); } } } else if (UNEXPECTED(mm_block->parent == ZEND_MM_REST_BLOCK)) { @@ -1116,7 +1116,7 @@ ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_mem_handlers *handlers, heap->real_size = 0; heap->overflow = 0; heap->real_peak = 0; - heap->limit = ZEND_MM_INT_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2); + heap->limit = ZEND_MM_LONG_CONST(1)<<(ZEND_MM_NUM_BUCKETS-2); heap->size = 0; heap->peak = 0; heap->internal = internal; @@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) } #if ZEND_DEBUG -static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) +static zend_long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) { - zend_int_t leaks = 0; + zend_long leaks = 0; zend_mm_block *p, *q; p = ZEND_MM_NEXT_BLOCK(b); @@ -1291,7 +1291,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC) } if (!ZEND_MM_IS_FREE_BLOCK(p)) { if (p->magic == MEM_BLOCK_VALID) { - zend_int_t repeated; + zend_long repeated; zend_leak_info leak; ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK); @@ -1373,7 +1373,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE #ifdef ZTS if (ZEND_MM_BAD_THREAD_ID(p)) { if (!silent) { - zend_debug_alloc_output("Invalid pointer: ((thread_id=0x%0.8X) != (expected=0x%0.8X))\n", (zend_int_t)p->thread_id, (zend_int_t)tsrm_thread_id()); + zend_debug_alloc_output("Invalid pointer: ((thread_id=0x%0.8X) != (expected=0x%0.8X))\n", (zend_long)p->thread_id, (zend_long)tsrm_thread_id()); had_problems = 1; } else { return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); @@ -1842,7 +1842,7 @@ static zend_mm_free_block *zend_mm_search_large_block(zend_mm_heap *heap, size_t best_size = ZEND_MM_FREE_BLOCK_SIZE(p); best_fit = p; } - if ((m & (ZEND_MM_INT_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) { + if ((m & (ZEND_MM_LONG_CONST(1) << (ZEND_MM_NUM_BUCKETS-1))) == 0) { if (p->child[1]) { rst = p->child[1]; } @@ -2474,7 +2474,7 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) { size_t res = nmemb; - zend_uint_t overflow = 0; + zend_ulong overflow = 0; __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1" : "=&a"(res), "=&d" (overflow) @@ -2494,7 +2494,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) { size_t res = nmemb; - zend_uint_t overflow = 0; + zend_ulong overflow = 0; #ifdef __ILP32__ /* x32 */ # define LP_SUFF "l" @@ -2523,7 +2523,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) { size_t res; - zend_uint_t overflow; + zend_ulong overflow; __asm__ ("umlal %0,%1,%2,%3" : "=r"(res), "=r"(overflow) @@ -2544,7 +2544,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) { size_t res; - zend_uint_t overflow; + zend_ulong overflow; __asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr" : "=&r"(res), "=&r"(overflow) @@ -2630,7 +2630,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { - zend_size_t length; + size_t length; char *p; #ifdef ZEND_SIGNALS TSRMLS_FETCH(); @@ -2649,7 +2649,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) return p; } -ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +ZEND_API char *_estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { char *p; #ifdef ZEND_SIGNALS @@ -2670,7 +2670,7 @@ ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEN } -ZEND_API char *zend_strndup(const char *s, zend_size_t length) +ZEND_API char *zend_strndup(const char *s, size_t length) { char *p; #ifdef ZEND_SIGNALS diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 3c143419ae..0d47d1c926 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -53,7 +53,7 @@ typedef struct _zend_leak_info { BEGIN_EXTERN_C() -ZEND_API char *zend_strndup(const char *s, zend_size_t length) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *zend_strndup(const char *s, size_t length) ZEND_ATTRIBUTE_MALLOC; ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1); ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; @@ -64,7 +64,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset); ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; -ZEND_API char *_estrndup(const char *s, zend_size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *_estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); /* Standard wrapper macros */ diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index dd7574ba3c..810b9b1fe8 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -114,8 +114,8 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS case IS_NULL: zend_symtable_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), expr); break; - case IS_INT: - zend_hash_index_update(Z_ARRVAL_P(result), Z_IVAL_P(offset), expr); + case IS_LONG: + zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), expr); break; case IS_FALSE: zend_hash_index_update(Z_ARRVAL_P(result), 0, expr); @@ -124,7 +124,7 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS zend_hash_index_update(Z_ARRVAL_P(result), 1, expr); break; case IS_DOUBLE: - zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_ival(Z_DVAL_P(offset)), expr); + zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr); break; default: zend_error(E_ERROR, "Illegal offset type"); @@ -331,13 +331,13 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s } break; case ZEND_UNARY_PLUS: - ZVAL_INT(&op1, 0); + ZVAL_LONG(&op1, 0); zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC); add_function(result, &op1, &op2 TSRMLS_CC); zval_dtor(&op2); break; case ZEND_UNARY_MINUS: - ZVAL_INT(&op1, 0); + ZVAL_LONG(&op1, 0); zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC); sub_function(result, &op1, &op2 TSRMLS_CC); zval_dtor(&op2); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index e89f199b11..631c825033 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -364,7 +364,7 @@ ZEND_FUNCTION(zend_version) Returns number of freed zvals */ ZEND_FUNCTION(gc_collect_cycles) { - RETURN_INT(gc_collect_cycles(TSRMLS_C)); + RETURN_LONG(gc_collect_cycles(TSRMLS_C)); } /* }}} */ @@ -380,9 +380,9 @@ ZEND_FUNCTION(gc_enabled) Activates the circular reference collector */ ZEND_FUNCTION(gc_enable) { - zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); + zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); zend_alter_ini_entry(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } /* }}} */ @@ -390,9 +390,9 @@ ZEND_FUNCTION(gc_enable) Deactivates the circular reference collector */ ZEND_FUNCTION(gc_disable) { - zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); + zend_string *key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } /* }}} */ @@ -403,10 +403,10 @@ ZEND_FUNCTION(func_num_args) zend_execute_data *ex = EG(current_execute_data)->prev_execute_data; if (ex->frame_kind == VM_FRAME_NESTED_FUNCTION || ex->frame_kind == VM_FRAME_TOP_FUNCTION) { - RETURN_INT(ex->num_args); + RETURN_LONG(ex->num_args); } else { zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); - RETURN_INT(-1); + RETURN_LONG(-1); } } /* }}} */ @@ -417,10 +417,10 @@ ZEND_FUNCTION(func_get_arg) { int arg_count, first_extra_arg; zval *arg; - zend_int_t requested_offset; + zend_long requested_offset; zend_execute_data *ex; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &requested_offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &requested_offset) == FAILURE) { return; } @@ -534,7 +534,7 @@ ZEND_FUNCTION(strlen) ZEND_PARSE_PARAMETERS_END(); #endif - RETVAL_INT(s->len); + RETVAL_LONG(s->len); } /* }}} */ @@ -549,7 +549,7 @@ ZEND_FUNCTION(strcmp) return; } - RETURN_INT(zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len)); + RETURN_LONG(zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len)); } /* }}} */ @@ -559,9 +559,9 @@ ZEND_FUNCTION(strcmp) ZEND_FUNCTION(strncmp) { zend_string *s1, *s2; - zend_int_t len; + zend_long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s2, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) { return; } @@ -570,7 +570,7 @@ ZEND_FUNCTION(strncmp) RETURN_FALSE; } - RETURN_INT(zend_binary_strncmp(s1->val, s1->len, s2->val, s2->len, len)); + RETURN_LONG(zend_binary_strncmp(s1->val, s1->len, s2->val, s2->len, len)); } /* }}} */ @@ -585,7 +585,7 @@ ZEND_FUNCTION(strcasecmp) return; } - RETURN_INT(zend_binary_strcasecmp(s1->val, s1->len, s2->val, s2->len)); + RETURN_LONG(zend_binary_strcasecmp(s1->val, s1->len, s2->val, s2->len)); } /* }}} */ @@ -595,9 +595,9 @@ ZEND_FUNCTION(strcasecmp) ZEND_FUNCTION(strncasecmp) { zend_string *s1, *s2; - zend_int_t len; + zend_long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi", &s1, &s2, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s2, &len) == FAILURE) { return; } @@ -606,7 +606,7 @@ ZEND_FUNCTION(strncasecmp) RETURN_FALSE; } - RETURN_INT(zend_binary_strncasecmp(s1->val, s1->len, s2->val, s2->len, len)); + RETURN_LONG(zend_binary_strncasecmp(s1->val, s1->len, s2->val, s2->len, len)); } /* }}} */ @@ -616,7 +616,7 @@ ZEND_FUNCTION(strncasecmp) ZEND_FUNCTION(each) { zval *array, *entry, tmp; - zend_uint_t num_key; + zend_ulong num_key; HashTable *target_hash; zend_string *key; @@ -659,10 +659,10 @@ ZEND_FUNCTION(each) /* add the key elements */ if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) { - ZVAL_STR(&tmp, STR_COPY(key)); + ZVAL_STR(&tmp, zend_string_copy(key)); if (Z_REFCOUNTED(tmp)) Z_ADDREF(tmp); } else { - ZVAL_INT(&tmp, num_key); + ZVAL_LONG(&tmp, num_key); } zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp); zend_hash_str_add_new(Z_ARRVAL_P(return_value), "key", sizeof("key")-1, &tmp); @@ -685,12 +685,12 @@ ZEND_FUNCTION(error_reporting) old_error_reporting = EG(error_reporting); if(ZEND_NUM_ARGS() != 0) { - zend_string *key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0); + zend_string *key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0); zend_alter_ini_entry(key, err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } - RETVAL_INT(old_error_reporting); + RETVAL_LONG(old_error_reporting); } /* }}} */ @@ -732,7 +732,7 @@ ZEND_FUNCTION(define) repeat: switch (Z_TYPE_P(val)) { - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_FALSE: @@ -764,7 +764,7 @@ repeat: ZVAL_DUP(&c.value, val); zval_ptr_dtor(&val_free); c.flags = case_sensitive; /* non persistent */ - c.name = STR_COPY(name); + c.name = zend_string_copy(name); c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) { RETURN_TRUE; @@ -812,7 +812,7 @@ ZEND_FUNCTION(get_class) if (!obj) { if (EG(scope)) { - RETURN_STR(STR_COPY(EG(scope)->name)); + RETURN_STR(zend_string_copy(EG(scope)->name)); } else { zend_error(E_WARNING, "get_class() called without object from outside a class"); RETURN_FALSE; @@ -833,7 +833,7 @@ ZEND_FUNCTION(get_called_class) } if (EG(current_execute_data)->called_scope) { - RETURN_STR(STR_COPY(EG(current_execute_data)->called_scope->name)); + RETURN_STR(zend_string_copy(EG(current_execute_data)->called_scope->name)); } else if (!EG(scope)) { zend_error(E_WARNING, "get_called_class() called from outside a class"); } @@ -857,7 +857,7 @@ ZEND_FUNCTION(get_parent_class) if (!ZEND_NUM_ARGS()) { ce = EG(scope); if (ce && ce->parent) { - RETURN_STR(STR_COPY(ce->parent->name)); + RETURN_STR(zend_string_copy(ce->parent->name)); } else { RETURN_FALSE; } @@ -875,7 +875,7 @@ ZEND_FUNCTION(get_parent_class) } if (ce && ce->parent) { - RETURN_STR(STR_COPY(ce->parent->name)); + RETURN_STR(zend_string_copy(ce->parent->name)); } else { RETURN_FALSE; } @@ -1130,7 +1130,7 @@ ZEND_FUNCTION(get_class_methods) /* Do not display old-style inherited constructors */ if (!key) { - ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name)); + ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name)); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name); } else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || mptr->common.scope == ce || @@ -1140,10 +1140,10 @@ ZEND_FUNCTION(get_class_methods) *mptr->op_array.refcount > 1 && (len != key->len || !same_name(key->val, mptr->common.function_name->val, len))) { - ZVAL_STR(&method_name, STR_COPY(zend_find_alias_name(mptr->common.scope, key))); + ZVAL_STR(&method_name, zend_string_copy(zend_find_alias_name(mptr->common.scope, key))); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name); } else { - ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name)); + ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name)); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name); } } @@ -1182,10 +1182,10 @@ ZEND_FUNCTION(method_exists) RETURN_FALSE; } - lcname = STR_ALLOC(method_name->len, 0); + lcname = zend_string_alloc(method_name->len, 0); zend_str_tolower_copy(lcname->val, method_name->val, method_name->len); if (zend_hash_exists(&ce->function_table, lcname)) { - STR_FREE(lcname); + zend_string_free(lcname); RETURN_TRUE; } else { union _zend_function *func = NULL; @@ -1202,8 +1202,8 @@ ZEND_FUNCTION(method_exists) && (method_name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0); - STR_FREE(lcname); - STR_RELEASE(func->common.function_name); + zend_string_free(lcname); + zend_string_release(func->common.function_name); efree(func); return; } @@ -1287,14 +1287,14 @@ ZEND_FUNCTION(class_exists) if (!autoload) { if (class_name->val[0] == '\\') { /* Ignore leading "\" */ - lc_name = STR_ALLOC(class_name->len - 1, 0); + lc_name = zend_string_alloc(class_name->len - 1, 0); zend_str_tolower_copy(lc_name->val, class_name->val + 1, class_name->len - 1); } else { - lc_name = STR_ALLOC(class_name->len, 0); + lc_name = zend_string_alloc(class_name->len, 0); zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len); } ce = zend_hash_find_ptr(EG(class_table), lc_name); - STR_FREE(lc_name); + zend_string_free(lc_name); RETURN_BOOL(ce && !((ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)); } @@ -1330,14 +1330,14 @@ ZEND_FUNCTION(interface_exists) if (!autoload) { if (iface_name->val[0] == '\\') { /* Ignore leading "\" */ - lc_name = STR_ALLOC(iface_name->len - 1, 0); + lc_name = zend_string_alloc(iface_name->len - 1, 0); zend_str_tolower_copy(lc_name->val, iface_name->val + 1, iface_name->len - 1); } else { - lc_name = STR_ALLOC(iface_name->len, 0); + lc_name = zend_string_alloc(iface_name->len, 0); zend_str_tolower_copy(lc_name->val, iface_name->val, iface_name->len); } ce = zend_hash_find_ptr(EG(class_table), lc_name); - STR_FREE(lc_name); + zend_string_free(lc_name); RETURN_BOOL(ce && ce->ce_flags & ZEND_ACC_INTERFACE); } @@ -1373,14 +1373,14 @@ ZEND_FUNCTION(trait_exists) if (!autoload) { if (trait_name->val[0] == '\\') { /* Ignore leading "\" */ - lc_name = STR_ALLOC(trait_name->len - 1, 0); + lc_name = zend_string_alloc(trait_name->len - 1, 0); zend_str_tolower_copy(lc_name->val, trait_name->val + 1, trait_name->len - 1); } else { - lc_name = STR_ALLOC(trait_name->len, 0); + lc_name = zend_string_alloc(trait_name->len, 0); zend_str_tolower_copy(lc_name->val, trait_name->val, trait_name->len); } ce = zend_hash_find_ptr(EG(class_table), lc_name); - STR_FREE(lc_name); + zend_string_free(lc_name); RETURN_BOOL(ce && ((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)); } @@ -1415,15 +1415,15 @@ ZEND_FUNCTION(function_exists) if (name[0] == '\\') { /* Ignore leading "\" */ - lcname = STR_ALLOC(name_len - 1, 0); + lcname = zend_string_alloc(name_len - 1, 0); zend_str_tolower_copy(lcname->val, name + 1, name_len - 1); } else { - lcname = STR_ALLOC(name_len, 0); + lcname = zend_string_alloc(name_len, 0); zend_str_tolower_copy(lcname->val, name, name_len); } func = zend_hash_find_ptr(EG(function_table), lcname); - STR_FREE(lcname); + zend_string_free(lcname); /* * A bit of a hack, but not a bad one: we see if the handler of the function @@ -1474,9 +1474,9 @@ ZEND_FUNCTION(class_alias) Cause an intentional memory leak, for testing/debugging purposes */ ZEND_FUNCTION(leak) { - zend_int_t leakbytes=3; + zend_long leakbytes=3; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &leakbytes) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &leakbytes) == FAILURE) { return; } @@ -1531,7 +1531,7 @@ ZEND_FUNCTION(get_included_files) array_init(return_value); ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) { if (entry) { - add_next_index_str(return_value, STR_COPY(entry)); + add_next_index_str(return_value, zend_string_copy(entry)); } } ZEND_HASH_FOREACH_END(); } @@ -1542,11 +1542,11 @@ ZEND_FUNCTION(get_included_files) Generates a user-level error/warning/notice message */ ZEND_FUNCTION(trigger_error) { - zend_int_t error_type = E_USER_NOTICE; + zend_long error_type = E_USER_NOTICE; char *message; int message_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &message, &message_len, &error_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) { return; } @@ -1574,9 +1574,9 @@ ZEND_FUNCTION(set_error_handler) { zval *error_handler; zend_string *error_handler_name = NULL; - zend_int_t error_type = E_ALL; + zend_long error_type = E_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &error_handler, &error_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &error_handler, &error_type) == FAILURE) { return; } @@ -1584,10 +1584,10 @@ ZEND_FUNCTION(set_error_handler) if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), error_handler_name?error_handler_name->val:"unknown"); - STR_RELEASE(error_handler_name); + zend_string_release(error_handler_name); return; } - STR_RELEASE(error_handler_name); + zend_string_release(error_handler_name); } if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { @@ -1650,10 +1650,10 @@ ZEND_FUNCTION(set_exception_handler) if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name->val:"unknown"); - STR_RELEASE(exception_handler_name); + zend_string_release(exception_handler_name); return; } - STR_RELEASE(exception_handler_name); + zend_string_release(exception_handler_name); } if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { @@ -1703,9 +1703,9 @@ static int copy_class_or_interface_name(zval *el TSRMLS_DC, int num_args, va_lis if (ce->refcount > 1 && (ce->name->len != hash_key->key->len || !same_name(hash_key->key->val, ce->name->val, ce->name->len))) { - add_next_index_str(array, STR_COPY(hash_key->key)); + add_next_index_str(array, zend_string_copy(hash_key->key)); } else { - add_next_index_str(array, STR_COPY(ce->name)); + add_next_index_str(array, zend_string_copy(ce->name)); } } return ZEND_HASH_APPLY_KEEP; @@ -1772,9 +1772,9 @@ static int copy_function_name(zval *zv TSRMLS_DC, int num_args, va_list args, ze } if (func->type == ZEND_INTERNAL_FUNCTION) { - add_next_index_str(internal_ar, STR_COPY(hash_key->key)); + add_next_index_str(internal_ar, zend_string_copy(hash_key->key)); } else if (func->type == ZEND_USER_FUNCTION) { - add_next_index_str(user_ar, STR_COPY(hash_key->key)); + add_next_index_str(user_ar, zend_string_copy(hash_key->key)); } return 0; @@ -1882,11 +1882,11 @@ ZEND_FUNCTION(create_function) } (*func->refcount)++; - function_name = STR_ALLOC(sizeof("0lambda_")+MAX_LENGTH_OF_ZEND_INT, 0); + function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0); function_name->val[0] = '\0'; do { - function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_ZEND_INT, "lambda_%d", ++EG(lambda_count)) + 1; + function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1; } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL); static_variables = func->static_variables; func->static_variables = NULL; @@ -1913,7 +1913,7 @@ ZEND_FUNCTION(zend_test_func) #ifdef ZTS ZEND_FUNCTION(zend_thread_id) { - RETURN_INT((zend_int_t)tsrm_thread_id()); + RETURN_LONG((zend_long)tsrm_thread_id()); } #endif #endif @@ -1944,7 +1944,7 @@ ZEND_FUNCTION(get_resources) { zend_string *type = NULL; zend_string *key; - zend_uint_t index; + zend_ulong index; zval *val; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &type) == FAILURE) { @@ -2165,10 +2165,10 @@ ZEND_FUNCTION(debug_print_backtrace) const char *include_filename = NULL; zval arg_array; int indent = 0; - zend_int_t options = 0; - zend_int_t limit = 0; + zend_long options = 0; + zend_long limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) { return; } @@ -2406,7 +2406,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int lineno = skip->opline->lineno; } add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename); - add_assoc_int_ex(&stack_frame, "line", sizeof("line")-1, lineno); + add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, lineno); /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function * and debug_baktrace() might have been called by the error_handler. in this case we don't @@ -2424,8 +2424,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int break; } if (prev->func && ZEND_USER_CODE(prev->func->common.type)) { - add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, STR_COPY(prev->func->op_array.filename)); - add_assoc_int_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno); + add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, zend_string_copy(prev->func->op_array.filename)); + add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno); break; } prev_call = prev; @@ -2462,10 +2462,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int if (object) { if (func->common.scope) { - add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(func->common.scope->name)); + add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(func->common.scope->name)); } else { class_name = zend_get_object_classname(object TSRMLS_CC); - add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(class_name)); + add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(class_name)); } if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) { @@ -2477,7 +2477,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->"); } else if (func->common.scope) { - add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(func->common.scope->name)); + add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, zend_string_copy(func->common.scope->name)); add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::"); } @@ -2553,10 +2553,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int Return backtrace as array */ ZEND_FUNCTION(debug_backtrace) { - zend_int_t options = DEBUG_BACKTRACE_PROVIDE_OBJECT; - zend_int_t limit = 0; + zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT; + zend_long limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &options, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &options, &limit) == FAILURE) { return; } @@ -2576,14 +2576,14 @@ ZEND_FUNCTION(extension_loaded) return; } - lcname = STR_ALLOC(extension_name_len, 0); + lcname = zend_string_alloc(extension_name_len, 0); zend_str_tolower_copy(lcname->val, extension_name, extension_name_len); if (zend_hash_exists(&module_registry, lcname)) { RETVAL_TRUE; } else { RETVAL_FALSE; } - STR_FREE(lcname); + zend_string_free(lcname); } /* }}} */ @@ -2602,13 +2602,13 @@ ZEND_FUNCTION(get_extension_funcs) return; } if (strncasecmp(extension_name, "zend", sizeof("zend"))) { - lcname = STR_ALLOC(extension_name_len, 0); + lcname = zend_string_alloc(extension_name_len, 0); zend_str_tolower_copy(lcname->val, extension_name, extension_name_len); } else { - lcname = STR_INIT("core", sizeof("core")-1, 0); + lcname = zend_string_init("core", sizeof("core")-1, 0); } module = zend_hash_find_ptr(&module_registry, lcname); - STR_FREE(lcname); + zend_string_free(lcname); if (!module) { RETURN_FALSE; } @@ -2628,7 +2628,7 @@ ZEND_FUNCTION(get_extension_funcs) array_init(return_value); array = 1; } - add_next_index_str(return_value, STR_COPY(zif->common.function_name)); + add_next_index_str(return_value, zend_string_copy(zif->common.function_name)); } } ZEND_HASH_FOREACH_END(); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index c10c1a4327..63cf7d7935 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -61,7 +61,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ efree(arguments); /* destruct the function also, then - we have allocated it in get_method */ - STR_RELEASE(func->internal_function.function_name); + zend_string_release(func->internal_function.function_name); efree(func); } /* }}} */ @@ -96,10 +96,10 @@ ZEND_METHOD(Closure, bind) ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", class_name->val); - STR_RELEASE(class_name); + zend_string_release(class_name); RETURN_NULL(); } - STR_RELEASE(class_name); + zend_string_release(class_name); } } else { /* scope argument not given; do not change the scope by default */ ce = closure->func.common.scope; @@ -133,7 +133,7 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object TSRML invoke->internal_function.handler = ZEND_MN(Closure___invoke); invoke->internal_function.module = 0; invoke->internal_function.scope = zend_ce_closure; - invoke->internal_function.function_name = STR_INIT(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0); + invoke->internal_function.function_name = zend_string_init(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0); return invoke; } /* }}} */ @@ -156,15 +156,15 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string { zend_string *lc_name; - lc_name = STR_ALLOC(method->len, 0); + lc_name = zend_string_alloc(method->len, 0); zend_str_tolower_copy(lc_name->val, method->val, method->len); if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && memcmp(lc_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 ) { - STR_FREE(lc_name); + zend_string_free(lc_name); return zend_get_closure_invoke_method(*object TSRMLS_CC); } - STR_FREE(lc_name); + zend_string_free(lc_name); return std_object_handlers.get_method(object, method, key TSRMLS_CC); } /* }}} */ @@ -326,7 +326,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_ } ZVAL_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>")); zend_hash_update(Z_ARRVAL(val), name, &info); - STR_RELEASE(name); + zend_string_release(name); arg_info++; } zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b15548a27f..c9864f3a7c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -110,9 +110,9 @@ static zend_property_info *zend_duplicate_property_info(zend_property_info *prop new_property_info = zend_arena_alloc(&CG(arena), sizeof(zend_property_info)); memcpy(new_property_info, property_info, sizeof(zend_property_info)); - STR_ADDREF(new_property_info->name); + zend_string_addref(new_property_info->name); if (new_property_info->doc_comment) { - STR_ADDREF(new_property_info->doc_comment); + zend_string_addref(new_property_info->doc_comment); } return new_property_info; } @@ -122,7 +122,7 @@ static zend_property_info *zend_duplicate_property_info_internal(zend_property_i { zend_property_info* new_property_info = pemalloc(sizeof(zend_property_info), 1); memcpy(new_property_info, property_info, sizeof(zend_property_info)); - STR_ADDREF(new_property_info->name); + zend_string_addref(new_property_info->name); return new_property_info; } /* }}} */ @@ -131,9 +131,9 @@ static void zend_destroy_property_info(zval *zv) /* {{{ */ { zend_property_info *property_info = Z_PTR_P(zv); - STR_RELEASE(property_info->name); + zend_string_release(property_info->name); if (property_info->doc_comment) { - STR_RELEASE(property_info->doc_comment); + zend_string_release(property_info->doc_comment); } } /* }}} */ @@ -142,7 +142,7 @@ static void zend_destroy_property_info_internal(zval *zv) /* {{{ */ { zend_property_info *property_info = Z_PTR_P(zv); - STR_RELEASE(property_info->name); + zend_string_release(property_info->name); free(property_info); } /* }}} */ @@ -161,7 +161,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_NEW_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0)); + ZVAL_NEW_STR(result, zend_string_alloc(1+name_length+strlen(filename)+char_pos_len, 0)); /* must be binary safe */ Z_STRVAL_P(result)[0] = '\0'; @@ -171,7 +171,7 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i static void init_compiler_declarables(TSRMLS_D) /* {{{ */ { - ZVAL_INT(&CG(declarables).ticks, 0); + ZVAL_LONG(&CG(declarables).ticks, 0); } /* }}} */ @@ -261,7 +261,7 @@ ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filen CG(compiled_filename) = p; return p; } - p = STR_COPY(new_compiled_filename); + p = zend_string_copy(new_compiled_filename); zend_hash_update_ptr(&CG(filenames_table), new_compiled_filename, p); CG(compiled_filename) = p; return p; @@ -300,14 +300,14 @@ static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */ static int lookup_cv(zend_op_array *op_array, zend_string* name TSRMLS_DC) /* {{{ */{ int i = 0; - zend_uint_t hash_value = STR_HASH_VAL(name); + zend_ulong hash_value = zend_string_hash_val(name); while (i < op_array->last_var) { if (op_array->vars[i]->val == name->val || (op_array->vars[i]->h == hash_value && op_array->vars[i]->len == name->len && memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) { - STR_RELEASE(name); + zend_string_release(name); return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i); } i++; @@ -339,7 +339,7 @@ void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int literal_position TSRMLS_DC) /* {{{ */ { if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { - STR_HASH_VAL(Z_STR_P(zv)); + zend_string_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); @@ -383,8 +383,8 @@ static int zend_add_func_name_literal(zend_op_array *op_array, zval *zv TSRMLS_D ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); + lc_name = zend_string_alloc(Z_STRLEN_P(zv), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -409,17 +409,17 @@ static int zend_add_ns_func_name_literal(zend_op_array *op_array, zval *zv TSRML ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); + lc_name = zend_string_alloc(Z_STRLEN_P(zv), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); 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_STRSIZE_P(zv)); + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)); if (ns_separator != NULL) { ns_separator += 1; - lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv)); - lc_name = STR_ALLOC(lc_len, 0); + lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); + lc_name = zend_string_alloc(lc_len, 0); zend_str_tolower_copy(lc_name->val, ns_separator, lc_len); ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -445,11 +445,11 @@ static int zend_add_class_name_literal(zend_op_array *op_array, zval *zv TSRMLS_ } if (Z_STRVAL_P(zv)[0] == '\\') { - lc_name = STR_ALLOC(Z_STRSIZE_P(zv) - 1, 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv) + 1, Z_STRSIZE_P(zv) - 1); + lc_name = zend_string_alloc(Z_STRLEN_P(zv) - 1, 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv) + 1, Z_STRLEN_P(zv) - 1); } else { - lc_name = STR_ALLOC(Z_STRSIZE_P(zv), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); + lc_name = zend_string_alloc(Z_STRLEN_P(zv), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); } ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -480,10 +480,10 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un /* skip leading '\\' */ if (Z_STRVAL_P(zv)[0] == '\\') { - name_len = Z_STRSIZE_P(zv) - 1; + name_len = Z_STRLEN_P(zv) - 1; name = Z_STRVAL_P(zv) + 1; } else { - name_len = Z_STRSIZE_P(zv); + name_len = Z_STRLEN_P(zv); name = Z_STRVAL_P(zv); } ns_separator = zend_memrchr(name, '\\', name_len); @@ -495,13 +495,13 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un if (ns_len) { /* lowercased namespace name & original constant name */ - tmp_name = STR_INIT(name, name_len, 0); + tmp_name = zend_string_init(name, name_len, 0); zend_str_tolower(tmp_name->val, ns_len); 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); + tmp_name = zend_string_alloc(name_len, 0); zend_str_tolower_copy(tmp_name->val, name, name_len); ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -517,12 +517,12 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un } /* original constant name */ - tmp_name = STR_INIT(name, name_len, 0); + tmp_name = zend_string_init(name, name_len, 0); 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); + tmp_name = zend_string_alloc(name_len, 0); zend_str_tolower_copy(tmp_name->val, name, name_len); ZVAL_NEW_STR(&c, tmp_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -543,15 +543,15 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zval *zv, int un op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \ } while (0) -#define LITERAL_INT(op, val) do { \ +#define LITERAL_LONG(op, val) do { \ zval _c; \ - ZVAL_INT(&_c, val); \ + ZVAL_LONG(&_c, val); \ op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \ } while (0) -#define LITERAL_INT_EX(op_array, op, val) do { \ +#define LITERAL_LONG_EX(op_array, op, val) do { \ zval _c; \ - ZVAL_INT(&_c, val); \ + ZVAL_LONG(&_c, val); \ op.constant = zend_add_literal(op_array, &_c TSRMLS_CC); \ } while (0) @@ -657,7 +657,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar } if (!zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) && - !(Z_STRSIZE(varname->u.constant) == (sizeof("this")-1) && + !(Z_STRLEN(varname->u.constant) == (sizeof("this")-1) && !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1)) && (CG(active_op_array)->last == 0 || CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) { @@ -713,7 +713,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* zend_op opline; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name TSRMLS_CC); class_node = *class_name; } else { @@ -727,7 +727,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* opline.result_type = IS_VAR; opline.result.var = get_temporary_variable(CG(active_op_array)); opline.op1_type = IS_CONST; - LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(result->u.op.var)])); + LITERAL_STR(opline.op1, zend_string_copy(CG(active_op_array)->vars[EX_VAR_TO_NUM(result->u.op.var)])); GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant); if (class_node.op_type == IS_CONST) { opline.op2_type = IS_CONST; @@ -751,7 +751,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* opline.result_type = IS_VAR; opline.result.var = get_temporary_variable(CG(active_op_array)); opline.op1_type = IS_CONST; - LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(opline_ptr->op1.var)])); + LITERAL_STR(opline.op1, zend_string_copy(CG(active_op_array)->vars[EX_VAR_TO_NUM(opline_ptr->op1.var)])); GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant); if (class_node.op_type == IS_CONST) { opline.op2_type = IS_CONST; @@ -811,11 +811,11 @@ void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC) /* {{{ SET_NODE(opline.op1, parent); SET_NODE(opline.op2, dim); if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) { - zend_uint_t index; + zend_ulong index; if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline.op2.constant)), index)) { zval_dtor(&CONSTANT(opline.op2.constant)); - ZVAL_INT(&CONSTANT(opline.op2.constant), index); + ZVAL_LONG(&CONSTANT(opline.op2.constant), index); } } @@ -859,17 +859,17 @@ void zend_do_abstract_method(const znode *function_name, znode *modifiers, const char *method_type; if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - Z_IVAL(modifiers->u.constant) |= ZEND_ACC_ABSTRACT; + Z_LVAL(modifiers->u.constant) |= ZEND_ACC_ABSTRACT; method_type = "Interface"; } else { method_type = "Abstract"; } - if (Z_IVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) { - if(Z_IVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) { + if (Z_LVAL(modifiers->u.constant) & ZEND_ACC_ABSTRACT) { + if(Z_LVAL(modifiers->u.constant) & ZEND_ACC_PRIVATE) { zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant)); } - if (Z_IVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { + if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_RAISE_ABSTRACT_ERROR; @@ -880,7 +880,7 @@ void zend_do_abstract_method(const znode *function_name, znode *modifiers, const zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", method_type, CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant)); } } else { - if (Z_IVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { + if (Z_LVAL(body->u.constant) == ZEND_ACC_ABSTRACT) { zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant)); } } @@ -893,7 +893,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */ && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) && ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER) && (Z_STRHASH(CONSTANT(opline->op1.constant)) == THIS_HASHVAL) - && (Z_STRSIZE(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) + && (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this") - 1)) { return 1; } else { @@ -922,7 +922,7 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* { opline->result.var = get_temporary_variable(CG(active_op_array)); opline->op1_type = IS_CONST; LITERAL_STR(opline->op1, - STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(value->u.op.var)])); + zend_string_copy(CG(active_op_array)->vars[EX_VAR_TO_NUM(value->u.op.var)])); SET_UNUSED(opline->op2); opline->extended_value = ZEND_FETCH_LOCAL; GET_NODE(value, opline->result); @@ -1304,7 +1304,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS variable->u.op.var = CG(active_op_array)->this_var; } } else if (CG(active_op_array)->this_var == -1) { - CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), STR_INIT("this", sizeof("this")-1, 0) TSRMLS_CC); + CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), zend_string_init("this", sizeof("this")-1, 0) TSRMLS_CC); } } @@ -1369,19 +1369,19 @@ void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC) /* {{{ { zend_op *opline; - if (Z_STRSIZE(op2->u.constant) > 1) { + if (Z_STRLEN(op2->u.constant) > 1) { opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_STRING; - } else if (Z_STRSIZE(op2->u.constant) == 1) { + } else if (Z_STRLEN(op2->u.constant) == 1) { int ch = *Z_STRVAL(op2->u.constant); /* Free memory and use ZEND_ADD_CHAR in case of 1 character strings */ - STR_FREE(Z_STR(op2->u.constant)); - ZVAL_INT(&op2->u.constant, ch); + zend_string_free(Z_STR(op2->u.constant)); + ZVAL_LONG(&op2->u.constant, ch); opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_CHAR; } else { /* String can be empty after a variable at the end of a heredoc */ - STR_FREE(Z_STR(op2->u.constant)); + zend_string_free(Z_STR(op2->u.constant)); return; } @@ -1480,26 +1480,26 @@ void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */ int zend_do_verify_access_types(const znode *current_access_type, const znode *new_modifier) /* {{{ */ { - if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) - && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK)) { + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_PPP_MASK) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_PPP_MASK)) { zend_error_noreturn(E_COMPILE_ERROR, "Multiple access type modifiers are not allowed"); } - if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_ABSTRACT) - && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_ABSTRACT)) { + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_ABSTRACT) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_ABSTRACT)) { zend_error_noreturn(E_COMPILE_ERROR, "Multiple abstract modifiers are not allowed"); } - if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_STATIC) - && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_STATIC)) { + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_STATIC) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_STATIC)) { zend_error_noreturn(E_COMPILE_ERROR, "Multiple static modifiers are not allowed"); } - if ((Z_IVAL(current_access_type->u.constant) & ZEND_ACC_FINAL) - && (Z_IVAL(new_modifier->u.constant) & ZEND_ACC_FINAL)) { + if ((Z_LVAL(current_access_type->u.constant) & ZEND_ACC_FINAL) + && (Z_LVAL(new_modifier->u.constant) & ZEND_ACC_FINAL)) { zend_error_noreturn(E_COMPILE_ERROR, "Multiple final modifiers are not allowed"); } - if (((Z_IVAL(current_access_type->u.constant) | Z_IVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { + if (((Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)) & (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use the final modifier on an abstract class member"); } - return (Z_IVAL(current_access_type->u.constant) | Z_IVAL(new_modifier->u.constant)); + return (Z_LVAL(current_access_type->u.constant) | Z_LVAL(new_modifier->u.constant)); } /* }}} */ @@ -1515,12 +1515,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n if (is_method) { if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { - if ((Z_IVAL(fn_flags_znode->u.constant) & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) { + if ((Z_LVAL(fn_flags_znode->u.constant) & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) { zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted", CG(active_class_entry)->name->val, Z_STRVAL(function_name->u.constant)); } - Z_IVAL(fn_flags_znode->u.constant) |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ + Z_LVAL(fn_flags_znode->u.constant) |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */ } - fn_flags = Z_IVAL(fn_flags_znode->u.constant); /* must be done *after* the above check */ + fn_flags = Z_LVAL(fn_flags_znode->u.constant); /* must be done *after* the above check */ } else { fn_flags = 0; } @@ -1547,7 +1547,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); if (is_method) { - lcname = STR_ALLOC(name->len, 0); + lcname = zend_string_alloc(name->len, 0); zend_str_tolower_copy(lcname->val, name->val, name->len); lcname = zend_new_interned_string(lcname TSRMLS_CC); CG(active_op_array) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array)); @@ -1676,7 +1676,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n free_alloca(class_lcname, use_heap); } - STR_RELEASE(lcname); + zend_string_release(lcname); } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); zval key; @@ -1689,10 +1689,10 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n ZVAL_DUP(&tmp.u.constant, &CG(current_namespace)); zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC); op_array.function_name = Z_STR(tmp.u.constant); - lcname = STR_ALLOC(Z_STRSIZE(tmp.u.constant), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL(tmp.u.constant), Z_STRSIZE(tmp.u.constant)); + lcname = zend_string_alloc(Z_STRLEN(tmp.u.constant), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant)); } else { - lcname = STR_ALLOC(name->len, 0); + lcname = zend_string_alloc(name->len, 0); zend_str_tolower_copy(lcname->val, name->val, name->len); } @@ -1700,10 +1700,10 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n if (CG(current_import_function) && (ns_name = zend_hash_find(CG(current_import_function), lcname)) != NULL) { - char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name)); + char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name)); - if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(function_name->u.constant) || - memcmp(tmp, lcname->val, Z_STRSIZE(function_name->u.constant))) { + if (Z_STRLEN_P(ns_name) != Z_STRLEN(function_name->u.constant) || + memcmp(tmp, lcname->val, Z_STRLEN(function_name->u.constant))) { zend_error(E_COMPILE_ERROR, "Cannot declare function %s because the name is already in use", Z_STRVAL(function_name->u.constant)); } efree(tmp); @@ -1714,14 +1714,14 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n build_runtime_defined_function_key(&key, lcname->val, lcname->len TSRMLS_CC); opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC); opline->op2_type = IS_CONST; - LITERAL_STR(opline->op2, STR_COPY(lcname)); + LITERAL_STR(opline->op2, zend_string_copy(lcname)); opline->extended_value = ZEND_DECLARE_FUNCTION; CG(active_op_array) = zend_arena_alloc(&CG(arena), sizeof(zend_op_array)); memcpy(CG(active_op_array), &op_array, sizeof(zend_op_array)); zend_hash_update_ptr(CG(function_table), Z_STR(key), CG(active_op_array)); zend_stack_push(&CG(context_stack), (void *) &CG(context)); zend_init_compiler_context(TSRMLS_C); - STR_RELEASE(lcname); + zend_string_release(lcname); } if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) { @@ -1847,7 +1847,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, if (EX_VAR_TO_NUM(var.u.op.var) != CG(active_op_array)->num_args) { zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s", Z_STRVAL(varname->u.constant)); } else if (Z_STRHASH(varname->u.constant) == THIS_HASHVAL && - Z_STRSIZE(varname->u.constant) == sizeof("this")-1 && + Z_STRLEN(varname->u.constant) == sizeof("this")-1 && !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) { if (CG(active_op_array)->scope && (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) { @@ -1886,8 +1886,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, } CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args)); cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1]; - cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRSIZE(varname->u.constant)); - cur_arg_info->name_len = Z_STRSIZE(varname->u.constant); + cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)); + cur_arg_info->name_len = Z_STRLEN(varname->u.constant); cur_arg_info->type_hint = 0; cur_arg_info->pass_by_reference = pass_by_reference; cur_arg_info->allow_null = 1; @@ -1919,7 +1919,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, } } else { cur_arg_info->type_hint = IS_OBJECT; - if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) { 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); @@ -1928,12 +1928,12 @@ void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, } // TODO: for now we have to copy it ??? #if 1 - cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant)); - cur_arg_info->class_name_len = Z_STRSIZE(class_type->u.constant); - STR_RELEASE(Z_STR(class_type->u.constant)); + cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant)); + cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant); + zend_string_release(Z_STR(class_type->u.constant)); #else cur_arg_info->class_name = Z_STRVAL(class_type->u.constant); - cur_arg_info->class_name_len = Z_STRSIZE(class_type->u.constant); + cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant); #endif if (op == ZEND_RECV_INIT) { if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) { @@ -1958,7 +1958,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace zend_uint op_number; zend_function *function; zend_string *lcname; - char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRSIZE(function_name->u.constant)); + char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRLEN(function_name->u.constant)); zend_resolve_function_name(function_name, &check_namespace TSRMLS_CC); @@ -1972,8 +1972,8 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace return 1; } - lcname = STR_ALLOC(Z_STRSIZE(function_name->u.constant), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL(function_name->u.constant), Z_STRSIZE(function_name->u.constant)); + lcname = zend_string_alloc(Z_STRLEN(function_name->u.constant), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL(function_name->u.constant), Z_STRLEN(function_name->u.constant)); if (((function = zend_hash_find_ptr(CG(function_table), lcname)) == NULL) || ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) && (function->type == ZEND_INTERNAL_FUNCTION))) { @@ -1981,7 +1981,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace efree(lcname); return 1; /* Dynamic */ } - STR_RELEASE(Z_STR(function_name->u.constant)); + zend_string_release(Z_STR(function_name->u.constant)); Z_STR(function_name->u.constant) = lcname; op_number = get_next_op_number(CG(active_op_array)); @@ -2008,8 +2008,8 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ last_op_number = get_next_op_number(CG(active_op_array))-1; last_op = &CG(active_op_array)->opcodes[last_op_number]; - if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRSIZE(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) - && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRSIZE(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { + if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRLEN(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) + && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRLEN(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); } @@ -2020,7 +2020,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ if (Z_TYPE(name) != IS_STRING) { zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string"); } - Z_STR(name) = STR_COPY(Z_STR(name)); + Z_STR(name) = zend_string_copy(Z_STR(name)); FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant); last_op->op2.constant = zend_add_func_name_literal(CG(active_op_array), &name TSRMLS_CC); @@ -2028,7 +2028,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ } last_op->opcode = ZEND_INIT_METHOD_CALL; last_op->result_type = IS_UNUSED; - Z_IVAL(left_bracket->u.constant) = ZEND_INIT_FCALL_BY_NAME; + Z_LVAL(left_bracket->u.constant) = ZEND_INIT_FCALL_BY_NAME; } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_INIT_FCALL_BY_NAME; @@ -2098,12 +2098,12 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace int len; zval *ns; zend_string *lookup_name; - char *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRSIZE(element_name->u.constant)); + char *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant)); if (Z_STRVAL(element_name->u.constant)[0] == '\\') { /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */ - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRSIZE(element_name->u.constant)); - --Z_STRSIZE(element_name->u.constant); + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRLEN(element_name->u.constant)); + --Z_STRLEN(element_name->u.constant); return; } @@ -2112,28 +2112,28 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace } if (current_import_sub) { - len = Z_STRSIZE(element_name->u.constant); + len = Z_STRLEN(element_name->u.constant); if (case_sensitive) { - lookup_name = STR_INIT(Z_STRVAL(element_name->u.constant), len, 0); + lookup_name = zend_string_init(Z_STRVAL(element_name->u.constant), len, 0); } else { - lookup_name = STR_ALLOC(len, 0); + lookup_name = zend_string_alloc(len, 0); zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len); } /* Check if function/const matches imported name */ if ((ns = zend_hash_find(current_import_sub, lookup_name)) != NULL) { zval_dtor(&element_name->u.constant); ZVAL_DUP(&element_name->u.constant, ns); - STR_FREE(lookup_name); + zend_string_free(lookup_name); *check_namespace = 0; return; } - STR_FREE(lookup_name); + zend_string_free(lookup_name); } if (compound && CG(current_import)) { len = compound - Z_STRVAL(element_name->u.constant); /* namespace is always lowercase */ - lookup_name = STR_ALLOC(len, 0); + lookup_name = zend_string_alloc(len, 0); zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len); /* Check if first part of compound name is an import name */ if ((ns = zend_hash_find(CG(current_import), lookup_name)) != NULL) { @@ -2141,25 +2141,25 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace tmp.op_type = IS_CONST; ZVAL_DUP(&tmp.u.constant, ns); len += 1; - Z_STRSIZE(element_name->u.constant) -= len; - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRSIZE(element_name->u.constant)+1); + Z_STRLEN(element_name->u.constant) -= len; + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC); *element_name = tmp; - STR_FREE(lookup_name); + zend_string_free(lookup_name); *check_namespace = 0; return; } - STR_FREE(lookup_name); + zend_string_free(lookup_name); } if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { tmp = *element_name; - Z_STR(tmp.u.constant) = STR_ALLOC(sizeof("\\")-1 + Z_STRSIZE(element_name->u.constant) + Z_STRSIZE(CG(current_namespace)), 0); + Z_STR(tmp.u.constant) = zend_string_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_STRSIZE(CG(current_namespace))); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE(CG(current_namespace))]), "\\", sizeof("\\")-1); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRSIZE(element_name->u.constant)+1); - STR_RELEASE(Z_STR(element_name->u.constant)); + 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); + zend_string_release(Z_STR(element_name->u.constant)); *element_name = tmp; } } @@ -2183,7 +2183,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static int lctype; znode constant_name; - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); lctype = zend_get_class_fetch_type(lcname, strlen(lcname)); switch (lctype) { case ZEND_FETCH_CLASS_SELF: @@ -2192,7 +2192,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static } zval_dtor(&class_name->u.constant); class_name->op_type = IS_CONST; - ZVAL_STR(&class_name->u.constant, STR_COPY(CG(active_class_entry)->name)); + ZVAL_STR(&class_name->u.constant, zend_string_copy(CG(active_class_entry)->name)); *result = *class_name; break; case ZEND_FETCH_CLASS_STATIC: @@ -2232,24 +2232,24 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ znode tmp; int len; - compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRSIZE(class_name->u.constant)); + compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRLEN(class_name->u.constant)); if (compound) { /* This is a compound class name that contains namespace prefix */ if (Z_STRVAL(class_name->u.constant)[0] == '\\') { /* The STRING name has "\" prefix */ - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRSIZE(class_name->u.constant)); - Z_STR(class_name->u.constant) = STR_REALLOC( + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)); + Z_STR(class_name->u.constant) = zend_string_realloc( Z_STR(class_name->u.constant), - Z_STRSIZE(class_name->u.constant) - 1, 0); + 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_STRSIZE(class_name->u.constant))) { + 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)); } } else { if (CG(current_import)) { len = compound - Z_STRVAL(class_name->u.constant); - lcname = STR_ALLOC(len, 0); + lcname = zend_string_alloc(len, 0); zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), len); /* Check if first part of compound name is an import name */ if ((ns = zend_hash_find(CG(current_import), lcname)) != NULL) { @@ -2257,14 +2257,14 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ tmp.op_type = IS_CONST; ZVAL_DUP(&tmp.u.constant, ns); len += 1; - Z_STRSIZE(class_name->u.constant) -= len; - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRSIZE(class_name->u.constant)+1); + Z_STRLEN(class_name->u.constant) -= len; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRLEN(class_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; - STR_FREE(lcname); + zend_string_free(lcname); return; } - STR_FREE(lcname); + zend_string_free(lcname); } /* Here name is not prefixed with \ and not imported */ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { @@ -2276,8 +2276,8 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ } } else if (CG(current_import) || Z_TYPE(CG(current_namespace)) != IS_UNDEF) { /* this is a plain name (without \) */ - lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + lcname = zend_string_alloc(Z_STRLEN(class_name->u.constant), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); if (CG(current_import) && (ns = zend_hash_find(CG(current_import), lcname)) != NULL) { @@ -2291,14 +2291,14 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */ zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; } - STR_FREE(lcname); + zend_string_free(lcname); } } /* }}} */ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ { - zend_int_t fetch_class_op_number; + zend_long fetch_class_op_number; zend_op *opline; fetch_class_op_number = get_next_op_number(CG(active_op_array)); @@ -2311,7 +2311,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ if (class_name->op_type == IS_CONST) { int fetch_type; - fetch_type = zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + fetch_type = zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); switch (fetch_type) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: @@ -2367,7 +2367,7 @@ void zend_do_label(znode *label TSRMLS_DC) /* {{{ */ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 TSRMLS_DC) /* {{{ */ { zend_label *dest; - zend_int_t current, distance; + zend_long current, distance; zval *label; if (pass2) { @@ -2415,7 +2415,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 SET_UNUSED(opline->op2); } else { /* Set real break distance */ - ZVAL_INT(label, distance); + ZVAL_LONG(label, distance); } if (pass2) { @@ -2462,21 +2462,21 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c } if (is_class_member) { - int old_len = Z_STRSIZE(result->u.constant); - length = sizeof("::")-1 + old_len + Z_STRSIZE(name->u.constant); - Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0); + int old_len = Z_STRLEN(result->u.constant); + length = sizeof("::")-1 + old_len + Z_STRLEN(name->u.constant); + Z_STR(result->u.constant) = zend_string_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_STRSIZE(name->u.constant)+1); - STR_RELEASE(Z_STR(name->u.constant)); + memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); + zend_string_release(Z_STR(name->u.constant)); } else { - int old_len = Z_STRSIZE(result->u.constant); - length = sizeof("\\")-1 + old_len + Z_STRSIZE(name->u.constant); - Z_STR(result->u.constant) = STR_REALLOC(Z_STR(result->u.constant), length, 0); + int old_len = Z_STRLEN(result->u.constant); + length = sizeof("\\")-1 + old_len + Z_STRLEN(name->u.constant); + Z_STR(result->u.constant) = zend_string_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_STRSIZE(name->u.constant)+1); - STR_RELEASE(Z_STR(name->u.constant)); + memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1); + zend_string_release(Z_STR(name->u.constant)); } } /* }}} */ @@ -2492,8 +2492,8 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na if (Z_TYPE(method_name->u.constant) != IS_STRING) { zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string"); } - lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRSIZE(method_name->u.constant)); - if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRSIZE(method_name->u.constant) && + lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); + if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { zval_dtor(&method_name->u.constant); method_name->op_type = IS_UNUSED; @@ -2502,7 +2502,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na } if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name TSRMLS_CC); class_node = *class_name; op_number = get_next_op_number(CG(active_op_array)); @@ -2539,7 +2539,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na } /* }}} */ -static int zend_do_convert_call(zend_op *init_opline, zend_op *opline, zend_int_t num_args, zend_function **func_ptr TSRMLS_DC) /* {{{ */ +static int zend_do_convert_call(zend_op *init_opline, zend_op *opline, zend_long num_args, zend_function **func_ptr TSRMLS_DC) /* {{{ */ { zval *function_name; zend_string *lcname; @@ -2548,13 +2548,13 @@ static int zend_do_convert_call(zend_op *init_opline, zend_op *opline, zend_int_ *func_ptr = NULL; if (opline->op1_type == IS_CONST && Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) { function_name = &CONSTANT(opline->op1.constant); - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); if (((function = zend_hash_find_ptr(CG(function_table), lcname)) == NULL) || ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) && (function->type == ZEND_INTERNAL_FUNCTION))) { function = NULL; - STR_RELEASE(lcname); + zend_string_release(lcname); opline->opcode = ZEND_INIT_USER_CALL; opline->extended_value = num_args; opline->op2_type = opline->op1_type; @@ -2565,7 +2565,7 @@ static int zend_do_convert_call(zend_op *init_opline, zend_op *opline, zend_int_ MAKE_NOP(init_opline); return 1; } else { - STR_RELEASE(Z_STR_P(function_name)); + zend_string_release(Z_STR_P(function_name)); Z_STR_P(function_name) = zend_new_interned_string(lcname TSRMLS_CC); opline->opcode = ZEND_INIT_FCALL; opline->extended_value = num_args; @@ -2808,8 +2808,8 @@ static int zend_do_convert_defined(zend_op *init_opline, znode *result TSRMLS_DC if (opline->opcode != ZEND_SEND_VAL || opline->op1_type != IS_CONST || Z_TYPE(CONSTANT(opline->op1.constant)) != IS_STRING - || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), '\\', Z_STRSIZE(CONSTANT(opline->op1.constant))) != NULL - || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), ':', Z_STRSIZE(CONSTANT(opline->op1.constant))) != NULL) { + || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), '\\', Z_STRLEN(CONSTANT(opline->op1.constant))) != NULL + || zend_memrchr(Z_STRVAL(CONSTANT(opline->op1.constant)), ':', Z_STRLEN(CONSTANT(opline->op1.constant))) != NULL) { return 0; } @@ -2818,8 +2818,8 @@ static int zend_do_convert_defined(zend_op *init_opline, znode *result TSRMLS_DC opline->extended_value = 0; GET_CACHE_SLOT(opline->op1.constant); /* lowcase constant name */ - lc_name = STR_ALLOC(Z_STRSIZE(CONSTANT(opline->op1.constant)), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant))); + lc_name = zend_string_alloc(Z_STRLEN(CONSTANT(opline->op1.constant)), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant))); ZVAL_NEW_STR(&c, lc_name); zend_add_literal(CG(active_op_array), &c TSRMLS_CC); opline->result.var = get_temporary_variable(CG(active_op_array)); @@ -2839,7 +2839,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, int is_metho if (fcall->arg_num != 0) { zend_error(E_WARNING, "Clone method does not require arguments"); } - opline = &CG(active_op_array)->opcodes[Z_IVAL(function_name->u.constant)]; + opline = &CG(active_op_array)->opcodes[Z_LVAL(function_name->u.constant)]; } else { zend_uint call_flags = 0; @@ -2902,7 +2902,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, int is_metho } else if (func->common.function_name->len == sizeof("is_long")-1 && memcmp(func->common.function_name->val, "is_long", sizeof("is_long")-1) == 0) { if (fcall->arg_num == 1) { - if (zend_do_convert_type_check(opline, result, IS_INT TSRMLS_CC)) { + if (zend_do_convert_type_check(opline, result, IS_LONG TSRMLS_CC)) { zend_stack_del_top(&CG(function_call_stack)); return; } @@ -3337,12 +3337,12 @@ void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */ { - zend_int_t catch_op_number; + zend_long catch_op_number; zend_op *opline; znode catch_class; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name TSRMLS_CC); catch_class = *class_name; } else { @@ -3442,7 +3442,7 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */ op_array->run_time_cache = NULL; } else if (function->type == ZEND_INTERNAL_FUNCTION) { if (function->common.function_name) { - STR_ADDREF(function->common.function_name); + zend_string_addref(function->common.function_name); } } } @@ -3528,10 +3528,10 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ zend_string *lc_class_name; zend_string *lc_parent_class_name; - lc_class_name = STR_ALLOC(ce->name->len, 0); + lc_class_name = zend_string_alloc(ce->name->len, 0); zend_str_tolower_copy(lc_class_name->val, ce->name->val, ce->name->len); if (!zend_hash_exists(&ce->function_table, lc_class_name)) { - lc_parent_class_name = STR_ALLOC(ce->parent->name->len, 0); + lc_parent_class_name = zend_string_alloc(ce->parent->name->len, 0); zend_str_tolower_copy(lc_parent_class_name->val, ce->parent->name->val, ce->parent->name->len); if (!zend_hash_exists(&ce->function_table, lc_parent_class_name) && (function = zend_hash_find_ptr(&ce->parent->function_table, lc_parent_class_name)) != NULL) { @@ -3543,9 +3543,9 @@ static void do_inherit_parent_constructor(zend_class_entry *ce TSRMLS_DC) /* {{{ function_add_ref(new_function); } } - STR_RELEASE(lc_parent_class_name); + zend_string_release(lc_parent_class_name); } - STR_FREE(lc_class_name); + zend_string_free(lc_class_name); } ce->constructor = ce->parent->constructor; } @@ -3658,21 +3658,21 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c zend_string *fe_class_name, *proto_class_name; if (!strcasecmp(fe_arg_info->class_name, "parent") && proto->common.scope) { - fe_class_name = STR_COPY(proto->common.scope->name); + fe_class_name = zend_string_copy(proto->common.scope->name); } else if (!strcasecmp(fe_arg_info->class_name, "self") && fe->common.scope) { - fe_class_name = STR_COPY(fe->common.scope->name); + fe_class_name = zend_string_copy(fe->common.scope->name); } else { - fe_class_name = STR_INIT( + fe_class_name = zend_string_init( fe_arg_info->class_name, fe_arg_info->class_name_len, 0); } if (!strcasecmp(proto_arg_info->class_name, "parent") && proto->common.scope && proto->common.scope->parent) { - proto_class_name = STR_COPY(proto->common.scope->parent->name); + proto_class_name = zend_string_copy(proto->common.scope->parent->name); } else if (!strcasecmp(proto_arg_info->class_name, "self") && proto->common.scope) { - proto_class_name = STR_COPY(proto->common.scope->name); + proto_class_name = zend_string_copy(proto->common.scope->name); } else { - proto_class_name = STR_INIT( + proto_class_name = zend_string_init( proto_arg_info->class_name, proto_arg_info->class_name_len, 0); } @@ -3681,8 +3681,8 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c const char *colon; if (fe->common.type != ZEND_USER_FUNCTION) { - STR_RELEASE(proto_class_name); - STR_RELEASE(fe_class_name); + zend_string_release(proto_class_name); + zend_string_release(fe_class_name); return 0; } else if (strchr(proto_class_name->val, '\\') != NULL || (colon = zend_memrchr(fe_class_name->val, '\\', fe_class_name->len)) == NULL || @@ -3697,14 +3697,14 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c fe_ce->type == ZEND_INTERNAL_CLASS || proto_ce->type == ZEND_INTERNAL_CLASS || fe_ce != proto_ce) { - STR_RELEASE(proto_class_name); - STR_RELEASE(fe_class_name); + zend_string_release(proto_class_name); + zend_string_release(fe_class_name); return 0; } } } - STR_RELEASE(proto_class_name); - STR_RELEASE(fe_class_name); + zend_string_release(proto_class_name); + zend_string_release(fe_class_name); } if (fe_arg_info->type_hint != proto_arg_info->type_hint) { /* Incompatible type hint */ @@ -3825,7 +3825,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ ++idx; while (op < end) { if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT) - && op->op1.num == (zend_int_t)idx) + && op->op1.num == (zend_long)idx) { precv = op; } @@ -3836,9 +3836,9 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ zval *zv = precv->op2.zv; if (Z_TYPE_P(zv) == IS_CONSTANT) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRSIZE_P(zv)); - memcpy(offset, Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); - offset += Z_STRSIZE_P(zv); + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv)); + memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); + offset += Z_STRLEN_P(zv); } else if (Z_TYPE_P(zv) == IS_FALSE) { memcpy(offset, "false", 5); offset += 5; @@ -3850,10 +3850,10 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += 4; } else if (Z_TYPE_P(zv) == IS_STRING) { *(offset++) = '\''; - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRSIZE_P(zv), 10)); - memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 10)); - offset += MIN(Z_STRSIZE_P(zv), 10); - if (Z_STRSIZE_P(zv) > 10) { + REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), 10)); + memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10)); + offset += MIN(Z_STRLEN_P(zv), 10); + if (Z_STRLEN_P(zv) > 10) { *(offset++) = '.'; *(offset++) = '.'; *(offset++) = '.'; @@ -3870,7 +3870,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ REALLOC_BUF_IF_EXCEED(buf, offset, length, str->len); memcpy(offset, str->val, str->len); offset += str->len; - STR_RELEASE(str); + zend_string_release(str); } } } else { @@ -4406,7 +4406,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen } else if (!strncmp(mname->val, ZEND_DEBUGINFO_FUNC_NAME, mname->len)) { ce->__debugInfo = fe; } else if (ce->name->len == mname->len) { - zend_string *lowercase_name = STR_ALLOC(ce->name->len, 0); + zend_string *lowercase_name = zend_string_alloc(ce->name->len, 0); zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); if (!memcmp(mname->val, lowercase_name->val, mname->len)) { @@ -4416,7 +4416,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; } - STR_RELEASE(lowercase_name); + zend_string_release(lowercase_name); } } /* }}} */ @@ -4535,10 +4535,10 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK)); } - lcname = STR_ALLOC(alias->alias->len, 0); + lcname = zend_string_alloc(alias->alias->len, 0); zend_str_tolower_copy(lcname->val, alias->alias->val, alias->alias->len); zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden TSRMLS_CC); - STR_RELEASE(lcname); + zend_string_release(lcname); /* Record the trait from which this alias was resolved. */ if (!alias->trait_method->ce) { @@ -4623,13 +4623,13 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC); /** Ensure that the prefered method is actually available. */ - lcname = STR_ALLOC(cur_method_ref->method_name->len, 0); + lcname = zend_string_alloc(cur_method_ref->method_name->len, 0); zend_str_tolower_copy(lcname->val, cur_method_ref->method_name->val, cur_method_ref->method_name->len); method_exists = zend_hash_exists(&cur_method_ref->ce->function_table, lcname); - STR_FREE(lcname); + zend_string_free(lcname); if (!method_exists) { zend_error_noreturn(E_COMPILE_ERROR, "A precedence rule was defined for %s::%s but this method does not exist", @@ -4663,7 +4663,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* cur_precedence->trait_method->ce->name->val); } - STR_RELEASE(class_name); + zend_string_release(class_name); j++; } } @@ -4683,13 +4683,13 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC); /** And, ensure that the referenced method is resolvable, too. */ - lcname = STR_ALLOC(cur_method_ref->method_name->len, 0); + lcname = zend_string_alloc(cur_method_ref->method_name->len, 0); zend_str_tolower_copy(lcname->val, cur_method_ref->method_name->val, cur_method_ref->method_name->len); method_exists = zend_hash_exists(&cur_method_ref->ce->function_table, lcname); - STR_FREE(lcname); + zend_string_free(lcname); if (!method_exists) { zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name->val, cur_method_ref->method_name->val); @@ -4713,16 +4713,16 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra j = 0; while (precedences[i]->exclude_from_classes[j].ce) { if (precedences[i]->exclude_from_classes[j].ce == trait) { - zend_string *lcname = STR_ALLOC(precedences[i]->trait_method->method_name->len, 0); + zend_string *lcname = zend_string_alloc(precedences[i]->trait_method->method_name->len, 0); zend_str_tolower_copy(lcname->val, precedences[i]->trait_method->method_name->val, precedences[i]->trait_method->method_name->len); if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) { - STR_RELEASE(lcname); + zend_string_release(lcname); zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name->val, trait->name->val); } - STR_RELEASE(lcname); + zend_string_release(lcname); } ++j; } @@ -4813,7 +4813,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { */ flags = property_info->flags; if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) { - prop_name = STR_COPY(property_info->name); + prop_name = zend_string_copy(property_info->name); } else { const char *pname; int pname_len; @@ -4821,7 +4821,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { /* for private and protected we need to unmangle the names */ zend_unmangle_property_name_ex(property_info->name->val, property_info->name->len, &class_name_unused, &pname, &pname_len); - prop_name = STR_INIT(pname, pname_len, 0); + prop_name = zend_string_init(pname, pname_len, 0); } /* next: check for conflicts with current class */ @@ -4837,12 +4837,12 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { not_compatible = (FAILURE == compare_function(&compare_result, &ce->default_static_members_table[coliding_prop->offset], &ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC)) - || (Z_IVAL(compare_result) != 0); + || (Z_LVAL(compare_result) != 0); } else { not_compatible = (FAILURE == compare_function(&compare_result, &ce->default_properties_table[coliding_prop->offset], &ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC)) - || (Z_IVAL(compare_result) != 0); + || (Z_LVAL(compare_result) != 0); } } else { /* the flags are not identical, thus, we assume properties are not compatible */ @@ -4863,7 +4863,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { property_info->ce->name->val, prop_name->val, ce->name->val); - STR_RELEASE(prop_name); + zend_string_release(prop_name); continue; } } @@ -4877,11 +4877,11 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { } if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value); - doc_comment = property_info->doc_comment ? STR_COPY(property_info->doc_comment) : NULL; + doc_comment = property_info->doc_comment ? zend_string_copy(property_info->doc_comment) : NULL; zend_declare_property_ex(ce, prop_name, prop_value, flags, doc_comment TSRMLS_CC); - STR_RELEASE(prop_name); + zend_string_release(prop_name); } ZEND_HASH_FOREACH_END(); } } @@ -4914,19 +4914,19 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce 2) it is just a plain old inconsitency/typo/bug as in the case where alias is set. */ - lc_method_name = STR_ALLOC(cur_alias->trait_method->method_name->len, 0); + lc_method_name = zend_string_alloc(cur_alias->trait_method->method_name->len, 0); zend_str_tolower_copy( lc_method_name->val, cur_alias->trait_method->method_name->val, cur_alias->trait_method->method_name->len); if (zend_hash_exists(&ce->function_table, lc_method_name)) { - STR_FREE(lc_method_name); + zend_string_free(lc_method_name); zend_error_noreturn(E_COMPILE_ERROR, "The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error", cur_alias->trait_method->method_name->val); } else { - STR_FREE(lc_method_name); + zend_string_free(lc_method_name); zend_error_noreturn(E_COMPILE_ERROR, "The modifiers of the trait method %s() are changed, but this method does not exist. Error", cur_alias->trait_method->method_name->val); @@ -5035,20 +5035,20 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia zend_class_entry *ce = CG(active_class_entry); zend_trait_alias *trait_alias; - if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_STATIC) { + if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier"); return; - } else if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_ABSTRACT) { + } else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_ABSTRACT) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier"); return; - } else if (Z_IVAL(modifiers->u.constant) == ZEND_ACC_FINAL) { + } else if (Z_LVAL(modifiers->u.constant) == ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier"); return; } trait_alias = emalloc(sizeof(zend_trait_alias)); trait_alias->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr; - trait_alias->modifiers = Z_IVAL(modifiers->u.constant); + trait_alias->modifiers = Z_LVAL(modifiers->u.constant); if (alias) { trait_alias->alias = Z_STR(alias->u.constant); } else { @@ -5347,12 +5347,12 @@ void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) /* {{{ */ if (expr) { if (expr->op_type != IS_CONST) { zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator with non-constant operand is no longer supported", op == ZEND_BRK ? "break" : "continue"); - } else if (Z_TYPE(expr->u.constant) != IS_INT || Z_IVAL(expr->u.constant) < 1) { + } else if (Z_TYPE(expr->u.constant) != IS_LONG || Z_LVAL(expr->u.constant) < 1) { zend_error_noreturn(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers", op == ZEND_BRK ? "break" : "continue"); } SET_NODE(opline->op2, expr); } else { - LITERAL_INT(opline->op2, 1); + LITERAL_LONG(opline->op2, 1); opline->op2_type = IS_CONST; } } @@ -5505,11 +5505,11 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name return; } - lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + lcname = zend_string_alloc(Z_STRLEN(class_name->u.constant), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); if (!(strcmp(lcname->val, "self") && strcmp(lcname->val, "parent"))) { - STR_FREE(lcname); + zend_string_free(lcname); zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", Z_STRVAL(class_name->u.constant)); } @@ -5527,16 +5527,16 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name ZVAL_DUP(&tmp.u.constant, &CG(current_namespace)); zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; - STR_FREE(lcname); - lcname = STR_ALLOC(Z_STRSIZE(class_name->u.constant), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + zend_string_free(lcname); + lcname = zend_string_alloc(Z_STRLEN(class_name->u.constant), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); } if (error) { - char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name)); + char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name)); - if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(class_name->u.constant) || - memcmp(tmp, lcname->val, Z_STRSIZE(class_name->u.constant))) { + if (Z_STRLEN_P(ns_name) != Z_STRLEN(class_name->u.constant) || + memcmp(tmp, lcname->val, Z_STRLEN(class_name->u.constant))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); } efree(tmp); @@ -5686,7 +5686,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ CG(active_class_entry)->name->val); } - switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRSIZE(interface_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5718,7 +5718,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ } - switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRSIZE(trait_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRLEN(trait_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5745,7 +5745,7 @@ ZEND_API zend_string *zend_mangle_property_name(const char *src1, int src1_lengt int prop_name_length; prop_name_length = 1 + src1_length + 1 + src2_length; - prop_name = STR_ALLOC(prop_name_length, internal); + prop_name = zend_string_alloc(prop_name_length, internal); prop_name->val[0] = '\0'; memcpy(prop_name->val + 1, src1, src1_length+1); memcpy(prop_name->val + 1 + src1_length + 1, src2, src2_length+1); @@ -5840,7 +5840,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty 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); - STR_RELEASE(Z_STR(var_name->u.constant)); + zend_string_release(Z_STR(var_name->u.constant)); } /* }}} */ @@ -5864,7 +5864,7 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC) /* FREE_PNODE(var_name); if (CG(doc_comment)) { - STR_RELEASE(CG(doc_comment)); + zend_string_release(CG(doc_comment)); CG(doc_comment) = NULL; } } @@ -5953,8 +5953,8 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */ cfilename = zend_get_compiled_filename(TSRMLS_C); name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, cfilename->val, cfilename->len, 0); - zend_register_int_constant(name->val, name->len, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC); - STR_FREE(name); + zend_register_long_constant(name->val, name->len, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC); + zend_string_free(name); if (CG(in_namespace)) { zend_do_end_namespace(TSRMLS_C); @@ -6012,9 +6012,9 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal char *lookup_name; if (Z_STRVAL_P(const_name)[0] == '\\') { - if ((c = zend_hash_str_find_ptr(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1)) == NULL) { - lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name)-1)) != NULL) { + if ((c = zend_hash_str_find_ptr(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1)) == NULL) { + lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1); + if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)-1)) != NULL) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -6024,8 +6024,8 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal return NULL; } } else if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(const_name))) == NULL) { - lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name)); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name))) != NULL) { + lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)); + if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name))) != NULL) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -6068,13 +6068,13 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con zend_op *opline; int type; char *compound; - zend_uint_t fetch_type = 0; + zend_ulong fetch_type = 0; if (constant_container) { switch (mode) { case ZEND_CT: /* this is a class constant */ - type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant)); + type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant)); if (ZEND_FETCH_CLASS_STATIC == type) { zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); @@ -6091,7 +6091,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con break; case ZEND_RT: if (constant_container->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant))) { zend_resolve_class_name(constant_container TSRMLS_CC); } else { zend_do_fetch_class(&tmp, constant_container TSRMLS_CC); @@ -6122,7 +6122,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con /* only one that did not contain \ from the start can be converted to string if unknown */ switch (mode) { case ZEND_CT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); /* this is a namespace constant, or an unprefixed constant */ if (zend_constant_ct_subst(result, &constant_name->u.constant, 0 TSRMLS_CC)) { @@ -6143,7 +6143,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con Z_CONST_FLAGS(result->u.constant) = fetch_type; break; case ZEND_RT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); zend_resolve_const_name(constant_name, &check_namespace TSRMLS_CC); @@ -6185,7 +6185,7 @@ void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC) /* {{{ */ opline->extended_value = 1; SET_UNUSED(opline->op1); opline->op2_type = IS_CONST; - LITERAL_STR(opline->op2, STR_INIT("shell_exec", sizeof("shell_exec")-1, 0)); + LITERAL_STR(opline->op2, zend_string_init("shell_exec", sizeof("shell_exec")-1, 0)); GET_CACHE_SLOT(opline->op2.constant); opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -6232,12 +6232,12 @@ void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ if (offset) { SET_NODE(opline->op2, offset); if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) { - zend_uint_t index; + zend_ulong index; opline->extended_value |= ZEND_ARRAY_NOT_PACKED; if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline->op2.constant)), index)) { zval_dtor(&CONSTANT(opline->op2.constant)); - ZVAL_INT(&CONSTANT(opline->op2.constant), index); + ZVAL_LONG(&CONSTANT(opline->op2.constant), index); } } } else { @@ -6262,12 +6262,12 @@ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_b if (offset) { SET_NODE(opline->op2, offset); if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) { - zend_uint_t index; + zend_ulong index; init_opline->extended_value |= ZEND_ARRAY_NOT_PACKED; if (ZEND_HANDLE_NUMERIC(Z_STR(CONSTANT(opline->op2.constant)), index)) { zval_dtor(&CONSTANT(opline->op2.constant)); - ZVAL_INT(&CONSTANT(opline->op2.constant), index); + ZVAL_LONG(&CONSTANT(opline->op2.constant), index); } } } else { @@ -6312,7 +6312,7 @@ void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC) /* {{{ if (constant_array) { /* try to construct constant array */ zend_uint size; - zend_int_t num; + zend_long num; zend_string *str; if (init_opline->op1_type != IS_UNUSED) { @@ -6334,8 +6334,8 @@ void zend_do_end_array(znode *result, const znode *array_node TSRMLS_DC) /* {{{ while (i > 0 && constant_array) { if (opline->op2_type == IS_CONST) { switch (Z_TYPE(CONSTANT(opline->op2.constant))) { - case IS_INT: - num = Z_IVAL(CONSTANT(opline->op2.constant)); + case IS_LONG: + num = Z_LVAL(CONSTANT(opline->op2.constant)); num_index: zend_hash_index_update(Z_ARRVAL(array), num, &CONSTANT(opline->op1.constant)); if (Z_REFCOUNTED(CONSTANT(opline->op1.constant))) Z_ADDREF(CONSTANT(opline->op1.constant)); @@ -6347,7 +6347,7 @@ str_index: if (Z_REFCOUNTED(CONSTANT(opline->op1.constant))) Z_ADDREF(CONSTANT(opline->op1.constant)); break; case IS_DOUBLE: - num = zend_dval_to_ival(Z_DVAL(CONSTANT(opline->op2.constant))); + num = zend_dval_to_lval(Z_DVAL(CONSTANT(opline->op2.constant))); goto num_index; case IS_FALSE: num = 0; @@ -6483,7 +6483,7 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC) /* {{{ */ opline->result.var = get_temporary_variable(CG(active_op_array)); SET_NODE(opline->op1, &last_container); opline->op2_type = IS_CONST; - LITERAL_INT(opline->op2, *((int *) dimension->data)); + LITERAL_LONG(opline->op2, *((int *) dimension->data)); GET_NODE(&last_container, opline->result); dimension = dimension->next; } @@ -6600,7 +6600,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) { znode value; - if (Z_STRSIZE(varname->u.constant) == sizeof("this") - 1 && + if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 && memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); return; @@ -6629,7 +6629,7 @@ void zend_do_fetch_global_variable(znode *varname, const znode *static_assignmen if (varname->op_type == IS_CONST && !zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) && - !(Z_STRSIZE(varname->u.constant) == (sizeof("this")-1) && + !(Z_STRLEN(varname->u.constant) == (sizeof("this")-1) && !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1))) { opline->opcode = ZEND_BIND_GLOBAL; SET_NODE(opline->op2, varname); @@ -6693,7 +6693,7 @@ void zend_do_indirect_references(znode *result, const znode *num_references, zno int i; zend_do_end_variable_parse(variable, BP_VAR_R, 0 TSRMLS_CC); - for (i=1; i<Z_IVAL(num_references->u.constant); i++) { + for (i=1; i<Z_LVAL(num_references->u.constant); i++) { fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R TSRMLS_CC); *variable = *result; } @@ -6701,7 +6701,7 @@ void zend_do_indirect_references(znode *result, const znode *num_references, zno fetch_simple_variable(result, variable, 1 TSRMLS_CC); /* there is a chance someone is accessing $this */ if (CG(active_op_array)->scope && CG(active_op_array)->this_var == -1) { - zend_string *key = STR_INIT("this", sizeof("this")-1, 0); + zend_string *key = zend_string_init("this", sizeof("this")-1, 0); CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC); } } @@ -6997,10 +6997,10 @@ void zend_do_declare_begin(TSRMLS_D) /* {{{ */ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */ { - if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRSIZE(var->u.constant), "ticks", sizeof("ticks")-1)) { + if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRLEN(var->u.constant), "ticks", sizeof("ticks")-1)) { convert_to_int(&val->u.constant); CG(declarables).ticks = val->u.constant; - } else if (!zend_binary_strcasecmp(Z_STRVAL(var->u.constant), Z_STRSIZE(var->u.constant), "encoding", sizeof("encoding")-1)) { + } 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) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use constants as encoding"); } @@ -7062,7 +7062,7 @@ void zend_do_declare_end(const znode *declare_token TSRMLS_DC) /* {{{ */ { zend_declarables *declarables = zend_stack_top(&CG(declare_stack)); /* We should restore if there was more than (current - start) - (ticks?1:0) opcodes */ - if ((get_next_op_number(CG(active_op_array)) - declare_token->u.op.opline_num) - ((Z_IVAL(CG(declarables).ticks))?1:0)) { + if ((get_next_op_number(CG(active_op_array)) - declare_token->u.op.opline_num) - ((Z_LVAL(CG(declarables).ticks))?1:0)) { CG(declarables) = *declarables; } } @@ -7284,7 +7284,7 @@ void zend_do_ticks(TSRMLS_D) /* {{{ */ opline->opcode = ZEND_TICKS; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); - opline->extended_value = Z_IVAL(CG(declarables).ticks); + opline->extended_value = Z_LVAL(CG(declarables).ticks); } /* }}} */ @@ -7313,7 +7313,7 @@ int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global retval = zend_hash_add_mem(CG(auto_globals), name, &auto_global, sizeof(zend_auto_global)) != NULL ? SUCCESS : FAILURE; - STR_RELEASE(auto_global.name); + zend_string_release(auto_global.name); return retval; } /* }}} */ @@ -7344,7 +7344,7 @@ int zendlex(znode *zendlval TSRMLS_DC) /* {{{ */ } again: - Z_TYPE_INFO(zendlval->u.constant) = IS_INT; + Z_TYPE_INFO(zendlval->u.constant) = IS_LONG; retval = lex_scan(&zendlval->u.constant TSRMLS_CC); switch (retval) { case T_COMMENT: @@ -7472,7 +7472,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM if (prefix) { *result = *prefix; if (Z_TYPE(result->u.constant) == IS_STRING && - Z_STRSIZE(result->u.constant) == 0) { + Z_STRLEN(result->u.constant) == 0) { /* namespace\ */ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { znode tmp; @@ -7532,10 +7532,10 @@ void zend_do_begin_namespace(znode *name, zend_bool with_bracket TSRMLS_DC) /* { } if (name) { - lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant)); - if (((Z_STRSIZE(name->u.constant) == sizeof("self")-1) && + lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)); + if (((Z_STRLEN(name->u.constant) == sizeof("self")-1) && !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRSIZE(name->u.constant) == sizeof("parent")-1) && + ((Z_STRLEN(name->u.constant) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); } @@ -7571,7 +7571,7 @@ void zend_do_begin_namespace(znode *name, zend_bool with_bracket TSRMLS_DC) /* { } if (CG(doc_comment)) { - STR_RELEASE(CG(doc_comment)); + zend_string_release(CG(doc_comment)); CG(doc_comment) = NULL; } } @@ -7598,7 +7598,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ /* The form "use A\B" is eqivalent to "use A\B as B". So we extract the last part of compound name to use as a new_name */ name = &tmp; - p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRSIZE(ns)); + p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns)); if (p) { ZVAL_STRING(name, p+1); } else { @@ -7607,40 +7607,40 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ } } - lcname = STR_ALLOC(Z_STRSIZE_P(name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + lcname = zend_string_alloc(Z_STRLEN_P(name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRLEN_P(name)); - if (((Z_STRSIZE_P(name) == sizeof("self")-1) && + if (((Z_STRLEN_P(name) == sizeof("self")-1) && !memcmp(lcname->val, "self", sizeof("self")-1)) || - ((Z_STRSIZE_P(name) == sizeof("parent")-1) && + ((Z_STRLEN_P(name) == sizeof("parent")-1) && !memcmp(lcname->val, "parent", sizeof("parent")-1))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { /* Prefix import name with current namespace name to avoid conflicts with classes */ - zend_string *c_ns_name = STR_ALLOC(Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name), 0); + zend_string *c_ns_name = zend_string_alloc(Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name), 0); - zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace))); - c_ns_name->val[Z_STRSIZE(CG(current_namespace))] = '\\'; - memcpy(c_ns_name->val+Z_STRSIZE(CG(current_namespace))+1, lcname->val, Z_STRSIZE_P(name)+1); + zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace))); + c_ns_name->val[Z_STRLEN(CG(current_namespace))] = '\\'; + memcpy(c_ns_name->val+Z_STRLEN(CG(current_namespace))+1, lcname->val, Z_STRLEN_P(name)+1); if (zend_hash_exists(CG(class_table), c_ns_name)) { - char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns)); + char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns)); - if (Z_STRSIZE(ns) != Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) || - memcmp(tmp2, c_ns_name->val, Z_STRSIZE(ns))) { + if (Z_STRLEN(ns) != Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp2, c_ns_name->val, Z_STRLEN(ns))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name)); } efree(tmp2); } - STR_FREE(c_ns_name); + zend_string_free(c_ns_name); } else if ((ce = zend_hash_find_ptr(CG(class_table), lcname)) != NULL && ce->type == ZEND_USER_CLASS && ce->info.user.filename == CG(compiled_filename)) { - char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns)); + char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns)); - if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) || - memcmp(c_tmp, lcname->val, Z_STRSIZE(ns))) { + if (Z_STRLEN(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lcname->val, Z_STRLEN(ns))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name)); } efree(c_tmp); @@ -7655,7 +7655,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ } zend_error(E_WARNING, "The use statement with non-compound name '%s' has no effect", Z_STRVAL_P(name)); } - STR_RELEASE(lcname); + zend_string_release(lcname); zval_dtor(name); } /* }}} */ @@ -7675,7 +7675,7 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i /* The form "use A\B" is eqivalent to "use A\B as B". So we extract the last part of compound name to use as a new_name */ name = &tmp; - p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRSIZE(ns)); + p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns)); if (p) { ZVAL_STRING(name, p+1); } else { @@ -7685,37 +7685,37 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i } if (case_sensitive) { - lookup_name = STR_COPY(Z_STR_P(name)); + lookup_name = zend_string_copy(Z_STR_P(name)); } else { - lookup_name = STR_ALLOC(Z_STRSIZE_P(name), 0); - zend_str_tolower_copy(lookup_name->val, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + lookup_name = zend_string_alloc(Z_STRLEN_P(name), 0); + zend_str_tolower_copy(lookup_name->val, Z_STRVAL_P(name), Z_STRLEN_P(name)); } if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) { /* Prefix import name with current namespace name to avoid conflicts with functions/consts */ - zend_string *c_ns_name = STR_ALLOC(Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name), 0); + zend_string *c_ns_name = zend_string_alloc(Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name), 0); - zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace))); - c_ns_name->val[Z_STRSIZE(CG(current_namespace))] = '\\'; - memcpy(c_ns_name->val+Z_STRSIZE(CG(current_namespace))+1, lookup_name, Z_STRSIZE_P(name)+1); + zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace))); + c_ns_name->val[Z_STRLEN(CG(current_namespace))] = '\\'; + memcpy(c_ns_name->val+Z_STRLEN(CG(current_namespace))+1, lookup_name, Z_STRLEN_P(name)+1); if (zend_hash_exists(lookup_table, c_ns_name)) { - char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns)); + char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns)); - if (Z_STRSIZE(ns) != Z_STRSIZE(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) || - memcmp(tmp2, c_ns_name->val, Z_STRSIZE(ns))) { + if (Z_STRLEN(ns) != Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp2, c_ns_name->val, Z_STRLEN(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL(ns), Z_STRVAL_P(name)); } efree(tmp2); } - STR_FREE(c_ns_name); + zend_string_free(c_ns_name); } else if (is_function) { zend_function *function; if ((function = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename->val, CG(compiled_filename)->val) == 0) { - char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns)); + char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns)); - if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) || - memcmp(c_tmp, lookup_name->val, Z_STRSIZE(ns))) { + if (Z_STRLEN(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name->val, Z_STRLEN(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name)); } efree(c_tmp); @@ -7724,10 +7724,10 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i zend_string *filename; if ((filename = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && strcmp(filename->val, CG(compiled_filename)->val) == 0) { - char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRSIZE(ns)); + char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns)); - if (Z_STRSIZE(ns) != Z_STRSIZE_P(name) || - memcmp(c_tmp, lookup_name->val, Z_STRSIZE(ns))) { + if (Z_STRLEN(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lookup_name->val, Z_STRLEN(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name)); } efree(c_tmp); @@ -7740,7 +7740,7 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i if (warn) { zend_error(E_WARNING, "The use %s statement with non-compound name '%s' has no effect", is_function ? "function" : "const", Z_STRVAL_P(name)); } - STR_RELEASE(lookup_name); + zend_string_release(lookup_name); zval_dtor(name); } /* }}} */ @@ -7781,8 +7781,8 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ znode tmp; tmp.op_type = IS_CONST; - ZVAL_NEW_STR(&tmp.u.constant, STR_ALLOC(Z_STRSIZE(CG(current_namespace)), 0)); - zend_str_tolower_copy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRSIZE(CG(current_namespace))); + ZVAL_NEW_STR(&tmp.u.constant, zend_string_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; } @@ -7791,10 +7791,10 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ if (CG(current_import_const) && (ns_name = zend_hash_find(CG(current_import_const), Z_STR(name->u.constant))) != NULL) { - char *tmp = estrndup(Z_STRVAL_P(ns_name), Z_STRSIZE_P(ns_name)); + char *tmp = estrndup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name)); - if (Z_STRSIZE_P(ns_name) != Z_STRSIZE(name->u.constant) || - memcmp(tmp, Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant))) { + if (Z_STRLEN_P(ns_name) != Z_STRLEN(name->u.constant) || + memcmp(tmp, Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant))) { zend_error(E_COMPILE_ERROR, "Cannot declare const %s because the name is already in use", Z_STRVAL(name->u.constant)); } efree(tmp); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 6317ceb7cb..6d56a5bda3 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -40,12 +40,12 @@ #define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); } #define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); } #define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); } -#define DO_TICKS() if (Z_IVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); } +#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); } #define RESET_DOC_COMMENT() \ { \ if (CG(doc_comment)) { \ - STR_RELEASE(CG(doc_comment)); \ + zend_string_release(CG(doc_comment)); \ CG(doc_comment) = NULL; \ } \ } @@ -67,7 +67,7 @@ typedef union _znode_op { zend_uint constant; zend_uint var; zend_uint num; - zend_uint_t hash; + zend_ulong hash; zend_uint opline_num; /* Needs to be signed */ zend_op *jmp_addr; zval *zv; @@ -100,7 +100,7 @@ struct _zend_op { znode_op op1; znode_op op2; znode_op result; - zend_uint_t extended_value; + zend_ulong extended_value; uint lineno; zend_uchar opcode; zend_uchar op1_type; @@ -214,7 +214,7 @@ char *zend_visibility_string(zend_uint fn_flags); typedef struct _zend_property_info { zend_uint flags; zend_string *name; - zend_uint_t h; + zend_ulong h; int offset; zend_string *doc_comment; zend_class_entry *ce; diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 9c52056d10..bca35cf591 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -37,7 +37,7 @@ void free_zend_constant(zval *zv) zval_internal_dtor(&c->value); } if (c->name) { - STR_RELEASE(c->name); + zend_string_release(c->name); } pefree(c, c->flags & CONST_PERSISTENT); } @@ -51,12 +51,12 @@ static void copy_zend_constant(zval *zv) memcpy(Z_PTR_P(zv), c, sizeof(zend_constant)); c = Z_PTR_P(zv); - c->name = STR_COPY(c->name); + c->name = zend_string_copy(c->name); if (!(c->flags & CONST_PERSISTENT)) { zval_copy_ctor(&c->value); } else { if (Z_TYPE(c->value) == IS_STRING) { - Z_STR(c->value) = STR_DUP(Z_STR(c->value), 1); + Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1); } } } @@ -113,26 +113,26 @@ int zend_startup_constants(TSRMLS_D) void zend_register_standard_constants(TSRMLS_D) { - REGISTER_MAIN_INT_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS); - - REGISTER_MAIN_INT_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); - - REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS); + + REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); + + REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS); /* true/false constants */ { REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST); @@ -167,7 +167,7 @@ ZEND_API void zend_register_null_constant(const char *name, uint name_len, int f ZVAL_NULL(&c.value); c.flags = flags; - c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); + c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); } @@ -178,18 +178,18 @@ ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_ ZVAL_BOOL(&c.value, bval); c.flags = flags; - c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); + c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); } -ZEND_API void zend_register_int_constant(const char *name, uint name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_long_constant(const char *name, uint name_len, zend_long lval, int flags, int module_number TSRMLS_DC) { zend_constant c; - ZVAL_INT(&c.value, lval); + ZVAL_LONG(&c.value, lval); c.flags = flags; - c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); + c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); } @@ -201,7 +201,7 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou ZVAL_DOUBLE(&c.value, dval); c.flags = flags; - c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); + c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); } @@ -211,9 +211,9 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch { zend_constant c; - ZVAL_NEW_STR(&c.value, STR_INIT(strval, strlen, flags & CONST_PERSISTENT)); + ZVAL_NEW_STR(&c.value, zend_string_init(strval, strlen, flags & CONST_PERSISTENT)); c.flags = flags; - c.name = STR_INIT(name, name_len, flags & CONST_PERSISTENT); + c.name = zend_string_init(name, name_len, flags & CONST_PERSISTENT); c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); } @@ -240,25 +240,25 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len zend_string *const_name; const_name_len = sizeof("\0__CLASS__") + EG(scope)->name->len; - const_name = STR_ALLOC(const_name_len, 0); + const_name = zend_string_alloc(const_name_len, 0); memcpy(const_name->val, "\0__CLASS__", sizeof("\0__CLASS__")-1); zend_str_tolower_copy(const_name->val + sizeof("\0__CLASS__")-1, EG(scope)->name->val, EG(scope)->name->len); if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) { c = emalloc(sizeof(zend_constant)); memset(c, 0, sizeof(zend_constant)); - ZVAL_STR(&c->value, STR_COPY(EG(scope)->name)); + ZVAL_STR(&c->value, zend_string_copy(EG(scope)->name)); zend_hash_add_ptr(EG(zend_constants), const_name, c); } - STR_RELEASE(const_name); + zend_string_release(const_name); } else { - zend_string *const_name = STR_INIT("\0__CLASS__", sizeof("\0__CLASS__")-1, 0); + zend_string *const_name = zend_string_init("\0__CLASS__", sizeof("\0__CLASS__")-1, 0); if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) { c = emalloc(sizeof(zend_constant)); memset(c, 0, sizeof(zend_constant)); ZVAL_EMPTY_STRING(&c->value); zend_hash_add_ptr(EG(zend_constants), const_name, c); } - STR_RELEASE(const_name); + zend_string_release(const_name); } return c; } else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 && @@ -273,7 +273,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len haltname = zend_mangle_property_name(haltoff, sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0); c = zend_hash_find_ptr(EG(zend_constants), haltname); - STR_FREE(haltname); + zend_string_free(haltname); return c; } else { return NULL; @@ -323,7 +323,7 @@ ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC) return c ? &c->value : NULL; } -ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC) +ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_ulong flags TSRMLS_DC) { zend_constant *c; const char *colon; @@ -343,12 +343,12 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, colon > name && (*(colon - 1) == ':')) { int class_name_len = colon - name - 1; int const_name_len = name_len - class_name_len - 2; - zend_string *constant_name = STR_INIT(colon + 1, const_name_len, 0); + zend_string *constant_name = zend_string_init(colon + 1, const_name_len, 0); char *lcname; zval *ret_constant = NULL; ALLOCA_FLAG(use_heap) - class_name = STR_INIT(name, class_name_len, 0); + class_name = zend_string_init(name, class_name_len, 0); lcname = do_alloca(class_name_len + 1, use_heap); zend_str_tolower_copy(lcname, name, class_name_len); if (!scope) { @@ -396,8 +396,8 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, ret_constant = Z_REFVAL_P(ret_constant); } } - STR_RELEASE(class_name); - STR_FREE(constant_name); + zend_string_release(class_name); + zend_string_free(constant_name); if (ret_constant && Z_CONSTANT_P(ret_constant)) { zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC); } @@ -449,7 +449,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, } } -zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS_DC) +zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC) { zend_constant *c; @@ -465,12 +465,12 @@ zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS (c->flags & CONST_CS) != 0) { key--; - c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRSIZE_P(key) TSRMLS_CC); + c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC); } } } else { key--; - c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRSIZE_P(key) TSRMLS_CC); + c = zend_get_special_constant(Z_STRVAL_P(key), Z_STRLEN_P(key) TSRMLS_CC); } } } @@ -501,14 +501,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) #endif if (!(c->flags & CONST_CS)) { - lowercase_name = STR_ALLOC(c->name->len, c->flags & CONST_PERSISTENT); + lowercase_name = zend_string_alloc(c->name->len, c->flags & CONST_PERSISTENT); zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); name = lowercase_name; } else { char *slash = strrchr(c->name->val, '\\'); if (slash) { - lowercase_name = STR_INIT(c->name->val, c->name->len, c->flags & CONST_PERSISTENT); + lowercase_name = zend_string_init(c->name->val, c->name->len, c->flags & CONST_PERSISTENT); zend_str_tolower(lowercase_name->val, slash - c->name->val); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); name = lowercase_name; @@ -527,14 +527,14 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) && memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) { } zend_error(E_NOTICE,"Constant %s already defined", name->val); - STR_RELEASE(c->name); + zend_string_release(c->name); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } ret = FAILURE; } if (lowercase_name) { - STR_RELEASE(lowercase_name); + zend_string_release(lowercase_name); } return ret; } diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index d36584d20f..f535632905 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -39,21 +39,21 @@ typedef struct _zend_constant { #define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), module_number TSRMLS_CC) #define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), module_number TSRMLS_CC) -#define REGISTER_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name)-1, (lval), (flags), module_number TSRMLS_CC) +#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number TSRMLS_CC) #define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), module_number TSRMLS_CC) #define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number TSRMLS_CC) #define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number TSRMLS_CC) #define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC) #define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC) -#define REGISTER_NS_INT_CONSTANT(ns, name, lval, flags) zend_register_int_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC) +#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC) #define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC) #define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC) #define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC) #define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name)-1, (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0 TSRMLS_CC) -#define REGISTER_MAIN_INT_CONSTANT(name, lval, flags) zend_register_int_constant((name), sizeof(name)-1, (lval), (flags), 0 TSRMLS_CC) +#define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name)-1, (dval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name)-1, (str), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), 0 TSRMLS_CC) @@ -67,16 +67,16 @@ void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC); ZEND_API zval *zend_get_constant_str(const char *name, uint name_len TSRMLS_DC); -ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_uint_t flags TSRMLS_DC); +ZEND_API zval *zend_get_constant_ex(zend_string *name, zend_class_entry *scope, zend_ulong flags TSRMLS_DC); ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_int_constant(const char *name, uint name_len, zend_int_t lval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_long_constant(const char *name, uint name_len, zend_long lval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC); void zend_copy_constants(HashTable *target, HashTable *sourc); -zend_constant *zend_quick_get_constant(const zval *key, zend_uint_t flags TSRMLS_DC); +zend_constant *zend_quick_get_constant(const zval *key, zend_ulong flags TSRMLS_DC); END_EXTERN_C() #define ZEND_CONSTANT_DTOR free_zend_constant diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 766cf7e210..efc5efae9f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -163,7 +163,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, Z_SET_REFCOUNT(trace, 0); zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); - zend_update_property_int(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); + zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC); return object; @@ -196,7 +196,7 @@ ZEND_METHOD(exception, __clone) ZEND_METHOD(exception, __construct) { zend_string *message = NULL; - long code = 0; + zend_long code = 0; zval *object, *previous = NULL; int argc = ZEND_NUM_ARGS(); @@ -211,7 +211,7 @@ ZEND_METHOD(exception, __construct) } if (code) { - zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } if (previous) { @@ -225,7 +225,7 @@ ZEND_METHOD(exception, __construct) ZEND_METHOD(error_exception, __construct) { char *message = NULL, *filename = NULL; - long code = 0, severity = E_ERROR, lineno; + zend_long code = 0, severity = E_ERROR, lineno; zval *object, *previous = NULL; int argc = ZEND_NUM_ARGS(), message_len, filename_len; @@ -240,21 +240,21 @@ ZEND_METHOD(error_exception, __construct) } if (code) { - zend_update_property_int(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "code", sizeof("code")-1, code TSRMLS_CC); } if (previous) { zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC); } - zend_update_property_int(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "severity", sizeof("severity")-1, severity TSRMLS_CC); if (argc >= 4) { zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC); if (argc < 5) { lineno = 0; /* invalidate lineno */ } - zend_update_property_int(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC); + zend_update_property_long(default_exception_ce, object, "line", sizeof("line")-1, lineno TSRMLS_CC); } } /* }}} */ @@ -335,12 +335,12 @@ ZEND_METHOD(error_exception, getSeverity) /* {{{ gettraceasstring() macros */ #define TRACE_APPEND_CHR(chr) \ - str = STR_REALLOC(str, str->len + 1, 0); \ + str = zend_string_realloc(str, str->len + 1, 0); \ str->val[str->len - 1] = chr #define TRACE_APPEND_STRL(v, l) \ { \ - str = STR_REALLOC(str, str->len + (l), 0); \ + str = zend_string_realloc(str, str->len + (l), 0); \ memcpy(str->val + str->len - (l), (v), (l)); \ } @@ -354,7 +354,7 @@ ZEND_METHOD(error_exception, getSeverity) zend_error(E_WARNING, "Value for %s is no string", key); \ TRACE_APPEND_STR("[unknown]"); \ } else { \ - TRACE_APPEND_STRL(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); \ + TRACE_APPEND_STRL(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); \ } \ } \ } while (0) @@ -362,7 +362,7 @@ ZEND_METHOD(error_exception, getSeverity) #define TRACE_ARG_APPEND(vallen) do { \ int len = str->len; \ - str = STR_REALLOC(str, len + vallen, 0); \ + str = zend_string_realloc(str, len + vallen, 0); \ memmove(str->val + len - l_added + 1 + vallen, str->val + len - l_added + 1, l_added); \ } while (0) @@ -386,12 +386,12 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ case IS_STRING: { int l_added; TRACE_APPEND_CHR('\''); - if (Z_STRSIZE_P(arg) > 15) { + if (Z_STRLEN_P(arg) > 15) { TRACE_APPEND_STRL(Z_STRVAL_P(arg), 15); TRACE_APPEND_STR("...', "); l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ } else { - l_added = Z_STRSIZE_P(arg); + l_added = Z_STRLEN_P(arg); TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added); TRACE_APPEND_STR("', "); l_added += 3 + 1; @@ -459,17 +459,17 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ TRACE_APPEND_STR("true, "); break; case IS_RESOURCE: { - zend_int_t lval = Z_RES_HANDLE_P(arg); - char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1]; + zend_long lval = Z_RES_HANDLE_P(arg); + char s_tmp[MAX_LENGTH_OF_LONG + 1]; int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ TRACE_APPEND_STR("Resource id #"); TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; } - case IS_INT: { - zend_int_t lval = Z_IVAL_P(arg); - char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1]; + case IS_LONG: { + zend_long lval = Z_LVAL_P(arg); + char s_tmp[MAX_LENGTH_OF_LONG + 1]; int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); @@ -509,7 +509,7 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ } /* }}} */ -static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **str_ptr, int *num TSRMLS_DC) /* {{{ */ +static void _build_trace_string(zval *frame, zend_ulong index, zend_string **str_ptr, int *num TSRMLS_DC) /* {{{ */ { char *s_tmp; int len; @@ -524,7 +524,7 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st } ht = Z_ARRVAL_P(frame); - s_tmp = emalloc(1 + MAX_LENGTH_OF_ZEND_INT + 1 + 1); + s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); len = sprintf(s_tmp, "#%d ", (*num)++); TRACE_APPEND_STRL(s_tmp, len); efree(s_tmp); @@ -536,8 +536,8 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st } else{ tmp = zend_hash_str_find(ht, "line", sizeof("line")-1); if (tmp) { - if (Z_TYPE_P(tmp) == IS_INT) { - line = Z_IVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_LONG) { + line = Z_LVAL_P(tmp); } else { zend_error(E_WARNING, "Line is no long"); line = 0; @@ -545,7 +545,7 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st } else { line = 0; } - s_tmp = emalloc(Z_STRSIZE_P(file) + MAX_LENGTH_OF_ZEND_INT + 4 + 1); + s_tmp = emalloc(Z_STRLEN_P(file) + MAX_LENGTH_OF_LONG + 4 + 1); len = sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_P(file), line); TRACE_APPEND_STRL(s_tmp, len); efree(s_tmp); @@ -584,14 +584,14 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st ZEND_METHOD(exception, getTraceAsString) { zval *trace, *frame; - zend_uint_t index; + zend_ulong index; zend_string *str, *key; int num = 0, len; - char s_tmp[MAX_LENGTH_OF_ZEND_INT + 7 + 1 + 1]; + char s_tmp[MAX_LENGTH_OF_LONG + 7 + 1 + 1]; DEFAULT_0_PARAMS; - str = STR_ALLOC(0, 0); + str = zend_string_alloc(0, 0); trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(trace), index, key, frame) { @@ -686,18 +686,18 @@ ZEND_METHOD(exception, __toString) ZVAL_UNDEF(&trace); } - if (Z_STRSIZE(message) > 0) { + if (Z_STRLEN(message) > 0) { str = zend_strpprintf(0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s", - Z_OBJCE_P(exception)->name->val, Z_STRVAL(message), Z_STRVAL(file), Z_IVAL(line), - (Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", + Z_OBJCE_P(exception)->name->val, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line), + (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", prev_str->len ? "\n\nNext " : "", prev_str->val); } else { str = zend_strpprintf(0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s", - Z_OBJCE_P(exception)->name->val, Z_STRVAL(file), Z_IVAL(line), - (Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", + Z_OBJCE_P(exception)->name->val, Z_STRVAL(file), Z_LVAL(line), + (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", prev_str->len ? "\n\nNext " : "", prev_str->val); } - STR_RELEASE(prev_str); + zend_string_release(prev_str); zval_dtor(&message); zval_dtor(&file); zval_dtor(&line); @@ -775,7 +775,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */ zend_declare_property_string(default_exception_ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(default_exception_ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); - zend_declare_property_int(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_long(default_exception_ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(default_exception_ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(default_exception_ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(default_exception_ce, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE TSRMLS_CC); @@ -784,7 +784,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions); error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC); error_exception_ce->create_object = zend_error_exception_new; - zend_declare_property_int(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC); } /* }}} */ @@ -819,7 +819,7 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { - zend_update_property_int(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC); + zend_update_property_long(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC); } zend_throw_exception_internal(&ex TSRMLS_CC); @@ -847,7 +847,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, zval ex; zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC); ZVAL_OBJ(&ex, obj); - zend_update_property_int(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); + zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); return obj; } /* }}} */ @@ -895,13 +895,13 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* { line = zend_read_property(default_exception_ce, &zv, "line", sizeof("line")-1, 1 TSRMLS_CC); convert_to_string_ex(file); - file = (Z_STRSIZE_P(file) > 0) ? file : NULL; - line = (Z_TYPE_P(line) == IS_INT) ? line : NULL; + file = (Z_STRLEN_P(file) > 0) ? file : NULL; + line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL; } else { file = NULL; line = NULL; } - zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_IVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE(zv)->name->val, ce_exception->name->val); + zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE(zv)->name->val, ce_exception->name->val); } str = zend_read_property(default_exception_ce, &exception, "string", sizeof("string")-1, 1 TSRMLS_CC); @@ -912,7 +912,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* { convert_to_string_ex(file); convert_to_int_ex(line); - zend_error_va(severity, (Z_STRSIZE_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_IVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); + zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); } else { zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7371a6ac7c..e23ee23458 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -516,7 +516,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC) if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { if (Z_TYPE_P(object) == IS_NULL || Z_TYPE_P(object) == IS_FALSE - || (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) { + || (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { zval_ptr_dtor_nogc(object); object_init(object); zend_error(E_WARNING, "Creating default object from empty value"); @@ -525,7 +525,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC) return object; } -ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC) +ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC) { zend_string *key; ALLOCA_FLAG(use_heap); @@ -574,7 +574,7 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, zen } } -static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, zend_uint_t fetch_type TSRMLS_DC) +static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, zend_ulong fetch_type TSRMLS_DC) { zend_arg_info *cur_arg_info; char *need_msg; @@ -623,7 +623,7 @@ static void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg } } -static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_num, zend_uint_t fetch_type TSRMLS_DC) +static inline int zend_verify_missing_arg_type(zend_function *zf, zend_uint arg_num, zend_ulong fetch_type TSRMLS_DC) { zend_arg_info *cur_arg_info; char *need_msg; @@ -695,7 +695,7 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p } if (Z_TYPE_P(object) == IS_NULL || Z_TYPE_P(object) == IS_FALSE || - (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) { + (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { zend_object *obj; zval_ptr_dtor(object); @@ -773,7 +773,7 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu if ((int)offset < 0) { zend_error(E_WARNING, "Illegal string offset: %d", offset); - STR_RELEASE(Z_STR_P(str)); + zend_string_release(Z_STR_P(str)); if (result) { ZVAL_NULL(result); } @@ -781,14 +781,14 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu } old_str = Z_STR_P(str); - if (offset >= Z_STRSIZE_P(str)) { - int old_len = Z_STRSIZE_P(str); - Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), offset + 1, 0); + if (offset >= Z_STRLEN_P(str)) { + int old_len = Z_STRLEN_P(str); + Z_STR_P(str) = zend_string_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_STRSIZE_P(str), 0); + Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0); Z_TYPE_INFO_P(str) = IS_STRING_EX; } @@ -796,7 +796,7 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu zend_string *tmp = zval_get_string(value); Z_STRVAL_P(str)[offset] = tmp->val[0]; - STR_RELEASE(tmp); + zend_string_release(tmp); } else { Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; if (value_type == IS_TMP_VAR) { @@ -811,14 +811,14 @@ static void zend_assign_to_string_offset(zval *str_offset, zval *value, int valu T(result->u.var).var = &T->str_offset.str; */ - STR_RELEASE(old_str); + zend_string_release(old_str); if (result) { zend_uchar c = (zend_uchar)Z_STRVAL_P(str)[offset]; if (CG(one_char_string)[c]) { - ZVAL_INT_STR(result, CG(one_char_string)[c]); + ZVAL_LONG_STR(result, CG(one_char_string)[c]); } else { - ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(str) + offset, 1, 0)); + ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(str) + offset, 1, 0)); } } } @@ -1015,10 +1015,10 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht { zval *retval; zend_string *offset_key; - zend_uint_t hval; + zend_ulong hval; - if (EXPECTED(Z_TYPE_P(dim) == IS_INT)) { - hval = Z_IVAL_P(dim); + if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) { + hval = Z_LVAL_P(dim); num_index: retval = zend_hash_index_find(ht, hval); if (retval == NULL) { @@ -1092,7 +1092,7 @@ str_index: offset_key = STR_EMPTY_ALLOC(); goto str_index; case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(dim)); + hval = zend_dval_to_lval(Z_DVAL_P(dim)); goto num_index; case IS_RESOURCE: zend_error(E_STRICT, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim)); @@ -1139,9 +1139,9 @@ fetch_from_array: ZVAL_INDIRECT(result, retval); } } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { - zend_int_t offset; + zend_long offset; - if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRSIZE_P(container) == 0)) { + if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRLEN_P(container) == 0)) { zval_dtor(container); convert_to_array: ZVAL_NEW_ARR(container); @@ -1156,10 +1156,10 @@ convert_to_array: SEPARATE_STRING(container); } - if (UNEXPECTED(Z_TYPE_P(dim) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { switch(Z_TYPE_P(dim)) { case IS_STRING: - if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_UNSET) { @@ -1177,12 +1177,12 @@ convert_to_array: break; } - offset = zval_get_int(dim); + offset = zval_get_long(dim); } else { - offset = Z_IVAL_P(dim); + offset = Z_LVAL_P(dim); } - if (!IS_INTERNED(Z_STR_P(container))) STR_ADDREF(Z_STR_P(container)); + if (!IS_INTERNED(Z_STR_P(container))) zend_string_addref(Z_STR_P(container)); ZVAL_STR_OFFSET(result, container, offset); } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { if (!Z_OBJ_HT_P(container)->read_dimension) { @@ -1279,13 +1279,13 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC); ZVAL_COPY(result, retval); } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { - zend_int_t offset; + zend_long offset; - if (UNEXPECTED(Z_TYPE_P(dim) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { switch(Z_TYPE_P(dim)) { - /* case IS_INT: */ + /* case IS_LONG: */ case IS_STRING: - if (IS_INT == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_IS) { @@ -1305,12 +1305,12 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z break; } - offset = zval_get_int(dim); + offset = zval_get_long(dim); } else { - offset = Z_IVAL_P(dim); + offset = Z_LVAL_P(dim); } - if (UNEXPECTED(offset < 0) || UNEXPECTED(Z_STRSIZE_P(container) <= offset)) { + if (UNEXPECTED(offset < 0) || UNEXPECTED(Z_STRLEN_P(container) <= offset)) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Uninitialized string offset: %ld", offset); } @@ -1319,9 +1319,9 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[offset]; if (CG(one_char_string)[c]) { - ZVAL_INT_STR(result, CG(one_char_string)[c]); + ZVAL_LONG_STR(result, CG(one_char_string)[c]); } else { - ZVAL_NEW_STR(result, STR_INIT(Z_STRVAL_P(container) + offset, 1, 0)); + ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(container) + offset, 1, 0)); } } } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { @@ -1375,7 +1375,7 @@ static void zend_fetch_property_address(zval *result, zval *container_ptr, zval if (type != BP_VAR_UNSET && ((Z_TYPE_P(container) == IS_NULL || Z_TYPE_P(container) == IS_FALSE || - (Z_TYPE_P(container) == IS_STRING && Z_STRSIZE_P(container)==0)))) { + (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) { zval_ptr_dtor_nogc(container); object_init(container); } else { diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 8ef2cb2f81..921ea1748c 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -48,7 +48,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); -ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_uint_t fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC); +ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC); ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC); static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC) @@ -87,8 +87,8 @@ again: case IS_TRUE: result = 1; break; - case IS_INT: - result = (Z_IVAL_P(op)?1:0); + case IS_LONG: + result = (Z_LVAL_P(op)?1:0); break; case IS_RESOURCE: result = (Z_RES_HANDLE_P(op)?1:0); @@ -97,8 +97,8 @@ again: result = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: - if (Z_STRSIZE_P(op) == 0 - || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { result = 0; } else { result = 1; @@ -279,7 +279,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D); ZEND_API uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); -ZEND_API void zend_set_timeout(zend_int_t seconds, int reset_signals); +ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index d2a704259b..c8a3c41afa 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -531,36 +531,36 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas if (!const_value) { char *actual = Z_STRVAL_P(p); - if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRSIZE_P(p)))) { + if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) { int len; zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); - len = Z_STRSIZE_P(p) - ((colon - Z_STRVAL_P(p)) + 1); + len = Z_STRLEN_P(p) - ((colon - Z_STRVAL_P(p)) + 1); if (inline_change) { - zend_string *tmp = STR_INIT(colon + 1, len, 0); - STR_RELEASE(Z_STR_P(p)); + zend_string *tmp = zend_string_init(colon + 1, len, 0); + zend_string_release(Z_STR_P(p)); Z_STR_P(p) = tmp; } else { - Z_STR_P(p) = STR_INIT(colon + 1, len, 0); + Z_STR_P(p) = zend_string_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_STRSIZE_P(p); + int actual_len = Z_STRLEN_P(p); 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); + zend_string *s = zend_string_init(actual, actual_len, 0); Z_STR_P(p) = s; Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; } } if (actual[0] == '\\') { if (inline_change) { - memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p)); - --Z_STRSIZE_P(p); + memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p)); + --Z_STRLEN_P(p); } else { ++actual; } @@ -573,7 +573,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas zend_error(E_ERROR, "Undefined constant '%s'", save->val); } if (inline_change) { - STR_RELEASE(save); + zend_string_release(save); } save = NULL; } @@ -584,13 +584,13 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas 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); + zend_string_release(save); } } } } else { if (inline_change) { - STR_RELEASE(Z_STR_P(p)); + zend_string_release(Z_STR_P(p)); } ZVAL_COPY_VALUE(p, const_value); if (Z_OPT_CONSTANT_P(p)) { @@ -724,7 +724,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS efree(error); } if (callable_name) { - STR_RELEASE(callable_name); + zend_string_release(callable_name); } if (EG(current_execute_data) == &dummy_execute_data) { EG(current_execute_data) = dummy_execute_data.prev_execute_data; @@ -738,7 +738,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS zend_error(E_STRICT, "%s", error); efree(error); } - STR_RELEASE(callable_name); + zend_string_release(callable_name); } func = fci_cache->function_handler; @@ -903,7 +903,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS zend_vm_stack_free_call_frame(call TSRMLS_CC); if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - STR_RELEASE(func->common.function_name); + zend_string_release(func->common.function_name); } efree(func); @@ -948,10 +948,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k } if (name->val[0] == '\\') { - lc_name = STR_ALLOC(name->len - 1, 0); + lc_name = zend_string_alloc(name->len - 1, 0); zend_str_tolower_copy(lc_name->val, name->val + 1, name->len - 1); } else { - lc_name = STR_ALLOC(name->len, 0); + lc_name = zend_string_alloc(name->len, 0); zend_str_tolower_copy(lc_name->val, name->val, name->len); } } @@ -959,7 +959,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k ce = zend_hash_find_ptr(EG(class_table), lc_name); if (ce) { if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return ce; } @@ -969,7 +969,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k */ if (!use_autoload || zend_is_compiling(TSRMLS_C)) { if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return NULL; } @@ -980,7 +980,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k EG(autoload_func) = func; } else { if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return NULL; } @@ -990,7 +990,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k /* Verify class name before passing it to __autoload() */ if (strspn(name->val, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name->len) { if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return NULL; } @@ -1002,7 +1002,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) { if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return NULL; } @@ -1012,12 +1012,12 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k if (name->val[0] == '\\') { ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1); } else { - ZVAL_STR(&args[0], STR_COPY(name)); + ZVAL_STR(&args[0], zend_string_copy(name)); } fcall_info.size = sizeof(fcall_info); fcall_info.function_table = EG(function_table); - ZVAL_STR(&fcall_info.function_name, STR_COPY(EG(autoload_func)->common.function_name)); + ZVAL_STR(&fcall_info.function_name, zend_string_copy(EG(autoload_func)->common.function_name)); fcall_info.symbol_table = NULL; fcall_info.retval = &local_retval; fcall_info.param_count = 1; @@ -1046,7 +1046,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k ce = zend_hash_find_ptr(EG(class_table), lc_name); } if (!key) { - STR_FREE(lc_name); + zend_string_free(lc_name); } return ce; } @@ -1066,11 +1066,11 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s int retval; if (retval_ptr) { - ZVAL_NEW_STR(&pv, STR_ALLOC(str_len + sizeof("return ;")-1, 1)); + ZVAL_NEW_STR(&pv, zend_string_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_STRSIZE(pv) - 1] = ';'; - Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0'; + Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; + Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; } else { ZVAL_STRINGL(&pv, str, str_len); } @@ -1183,7 +1183,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */ } switch (opline->opcode) { case ZEND_GOTO: - if (Z_TYPE_P(opline->op2.zv) != IS_INT) { + if (Z_TYPE_P(opline->op2.zv) != IS_LONG) { zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC); } /* break omitted intentionally */ @@ -1360,7 +1360,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */ #define SIGPROF 27 #endif -void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */ +void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */ { TSRMLS_FETCH(); @@ -1680,7 +1680,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS if (execute_data) { if (!execute_data->symbol_table) { - zend_uint_t h = STR_HASH_VAL(name); + zend_ulong h = zend_string_hash_val(name); zend_op_array *op_array = &execute_data->func->op_array; int i; @@ -1716,7 +1716,7 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int if (execute_data) { if (!execute_data->symbol_table) { - zend_uint_t h = zend_hash_func(name, len); + zend_ulong h = zend_hash_func(name, len); zend_op_array *op_array = &execute_data->func->op_array; int i; diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index ba6fe1b8ca..a85b8dd976 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -43,7 +43,7 @@ typedef struct _zend_generator { /* Variable to put sent value into */ zval *send_target; /* Largest used integer key for auto-incrementing keys */ - zend_int_t largest_used_integer_key; + zend_long largest_used_integer_key; /* ZEND_GENERATOR_* flags */ zend_uchar flags; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 81ddfb9396..8be149f767 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -112,7 +112,7 @@ struct _zend_compiler_globals { zend_llist open_files; - zend_int_t catch_begin; + zend_long catch_begin; struct _zend_ini_parser_param *ini_parser_param; @@ -188,7 +188,7 @@ struct _zend_executor_globals { zval This; - zend_int_t precision; + zend_long precision; int ticks_count; @@ -220,7 +220,7 @@ struct _zend_executor_globals { zend_class_entry *exception_class; /* timeout support */ - zend_int_t timeout_seconds; + zend_long timeout_seconds; int lambda_count; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 3fe499c0c4..469b8a82ce 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -183,12 +183,12 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zend_string *key) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; - h = STR_HASH_VAL(key); + h = zend_string_hash_val(key); nIndex = h & ht->nTableMask; idx = ht->arHash[nIndex]; while (idx != INVALID_IDX) { @@ -205,7 +205,7 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zen return NULL; } -static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, const char *str, int len, zend_uint_t h) +static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, const char *str, int len, zend_ulong h) { uint nIndex; uint idx; @@ -227,7 +227,7 @@ static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, return NULL; } -static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *ht, zend_uint_t h) +static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *ht, zend_ulong h) { uint nIndex; uint idx; @@ -248,7 +248,7 @@ static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *h static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -263,7 +263,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s zend_hash_packed_to_hash(ht); } - h = STR_HASH_VAL(key); + h = zend_string_hash_val(key); if ((flag & HASH_ADD_NEW) == 0) { p = zend_hash_find_bucket(ht, key); @@ -300,7 +300,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s p = ht->arData + idx; p->h = h; p->key = key; - STR_ADDREF(key); + zend_string_addref(key); ZVAL_COPY_VALUE(&p->val, pData); nIndex = h & ht->nTableMask; Z_NEXT(p->val) = ht->arHash[nIndex]; @@ -337,45 +337,45 @@ ZEND_API zval *_zend_hash_add_new(HashTable *ht, zend_string *key, zval *pData Z ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, int len, zval *pData, int flag ZEND_FILE_LINE_DC) { - zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); + zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, flag ZEND_FILE_LINE_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) { - zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); + zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_UPDATE ZEND_FILE_LINE_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) { - zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); + zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_UPDATE | HASH_UPDATE_INDIRECT ZEND_FILE_LINE_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) { - zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); + zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) { - zend_string *key = STR_INIT(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); + zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD_NEW ZEND_FILE_LINE_CC); - STR_RELEASE(key); + zend_string_release(key); return ret; } -ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_uint_t h) +ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_ulong h) { zval dummy; @@ -402,7 +402,7 @@ ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *str, i return zend_hash_str_add(ht, str, len, &dummy); } -static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC) +static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC) { uint nIndex; uint idx; @@ -430,7 +430,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab ht->pDestructor(&p->val); } ZVAL_COPY_VALUE(&p->val, pData); - if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) { + if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; } return &p->val; @@ -460,7 +460,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab if (ht->nInternalPointer == INVALID_IDX) { ht->nInternalPointer = h; } - if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) { + if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; } p->h = h; @@ -490,7 +490,7 @@ convert_to_hash: } ZVAL_COPY_VALUE(&p->val, pData); HANDLE_UNBLOCK_INTERRUPTIONS(); - if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) { + if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; } return &p->val; @@ -505,7 +505,7 @@ convert_to_hash: if (ht->nInternalPointer == INVALID_IDX) { ht->nInternalPointer = idx; } - if ((zend_int_t)h >= (zend_int_t)ht->nNextFreeElement) { + if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; } p = ht->arData + idx; @@ -520,22 +520,22 @@ convert_to_hash: return &p->val; } -ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC) +ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC) { return _zend_hash_index_update_or_next_insert_i(ht, h, pData, flag ZEND_FILE_LINE_RELAY_CC); } -ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC) +ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC) { return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_ADD ZEND_FILE_LINE_RELAY_CC); } -ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC) +ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC) { return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_ADD | HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC); } -ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC) +ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC) { return _zend_hash_index_update_or_next_insert_i(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_RELAY_CC); } @@ -634,7 +634,7 @@ static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Buc } } if (p->key) { - STR_RELEASE(p->key); + zend_string_release(p->key); } if (ht->pDestructor) { zval tmp; @@ -669,7 +669,7 @@ static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint idx, Bucket ZEND_API int zend_hash_del(HashTable *ht, zend_string *key) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -684,7 +684,7 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key) return FAILURE; } - h = STR_HASH_VAL(key); + h = zend_string_hash_val(key); nIndex = h & ht->nTableMask; idx = ht->arHash[nIndex]; @@ -708,7 +708,7 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key) ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -723,7 +723,7 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key) return FAILURE; } - h = STR_HASH_VAL(key); + h = zend_string_hash_val(key); nIndex = h & ht->nTableMask; idx = ht->arHash[nIndex]; @@ -760,7 +760,7 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key) ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -811,7 +811,7 @@ ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len) ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len) { - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -843,7 +843,7 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len) return FAILURE; } -ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h) +ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h) { uint nIndex; uint idx; @@ -900,7 +900,7 @@ ZEND_API void zend_hash_destroy(HashTable *ht) ht->pDestructor(&p->val); } if (p->key) { - STR_RELEASE(p->key); + zend_string_release(p->key); } } if (ht->nTableMask) { @@ -925,7 +925,7 @@ ZEND_API void zend_hash_clean(HashTable *ht) ht->pDestructor(&p->val); } if (p->key) { - STR_RELEASE(p->key); + zend_string_release(p->key); } } ht->nNumUsed = 0; @@ -1254,7 +1254,7 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source) q->h = p->h; q->key = p->key; if (q->key) { - STR_ADDREF(q->key); + zend_string_addref(q->key); } nIndex = q->h & target->nTableMask; Z_NEXT(q->val) = target->arHash[nIndex]; @@ -1383,7 +1383,7 @@ ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key) ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *str, int len) { - zend_uint_t h; + zend_ulong h; Bucket *p; IS_CONSISTENT(ht); @@ -1413,7 +1413,7 @@ ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key) ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len) { - zend_uint_t h; + zend_ulong h; Bucket *p; IS_CONSISTENT(ht); @@ -1427,7 +1427,7 @@ ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len) return p ? 1 : 0; } -ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h) +ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_ulong h) { Bucket *p; @@ -1448,7 +1448,7 @@ ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h) } -ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h) +ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_ulong h) { Bucket *p; @@ -1602,7 +1602,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, zend_bool duplicate, HashPosition *pos) { uint idx = *pos; Bucket *p; @@ -1612,14 +1612,14 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str p = ht->arData + idx; if (p->key) { if (duplicate) { - *str_index = STR_COPY(p->key); + *str_index = zend_string_copy(p->key); } else { *str_index = p->key; } return HASH_KEY_IS_STRING; } else { *num_index = p->h; - return HASH_KEY_IS_INT; + return HASH_KEY_IS_LONG; } } return HASH_KEY_NON_EXISTENT; @@ -1637,9 +1637,9 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, p = ht->arData + idx; if (p->key) { ZVAL_STR(key, p->key); - STR_ADDREF(p->key); + zend_string_addref(p->key); } else { - ZVAL_INT(key, p->h); + ZVAL_LONG(key, p->h); } } } @@ -1655,7 +1655,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) if (p->key) { return HASH_KEY_IS_STRING; } else { - return HASH_KEY_IS_INT; + return HASH_KEY_IS_LONG; } } return HASH_KEY_NON_EXISTENT; @@ -1712,7 +1712,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, p = ht->arData + j; p->h = j; if (p->key) { - STR_RELEASE(p->key); + zend_string_release(p->key); p->key = NULL; } } diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index f9c7f02efe..b0a7d12988 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -26,7 +26,7 @@ #include "zend.h" #define HASH_KEY_IS_STRING 1 -#define HASH_KEY_IS_INT 2 +#define HASH_KEY_IS_LONG 2 #define HASH_KEY_NON_EXISTENT 3 #define HASH_KEY_NON_EXISTANT HASH_KEY_NON_EXISTENT /* Keeping old define (with typo) for backward compatibility */ @@ -45,7 +45,7 @@ #define HASH_MASK_CONSISTENCY 0x60 typedef struct _zend_hash_key { - zend_uint_t h; + zend_ulong h; zend_string *key; } zend_hash_key; @@ -98,10 +98,10 @@ ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *key, int len, z #define zend_hash_str_add_new(ht, key, len, pData) \ _zend_hash_str_add_new(ht, key, len, pData ZEND_FILE_LINE_CC) -ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC); -ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC); -ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC); -ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_uint_t h, zval *pData ZEND_FILE_LINE_DC); +ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC); +ZEND_API zval *_zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC); +ZEND_API zval *_zend_hash_index_add_new(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC); +ZEND_API zval *_zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData ZEND_FILE_LINE_DC); ZEND_API zval *_zend_hash_next_index_insert(HashTable *ht, zval *pData ZEND_FILE_LINE_DC); ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_FILE_LINE_DC); @@ -116,7 +116,7 @@ ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_ #define zend_hash_next_index_insert_new(ht, pData) \ _zend_hash_next_index_insert_new(ht, pData ZEND_FILE_LINE_CC) -ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_uint_t h); +ZEND_API zval *zend_hash_index_add_empty_element(HashTable *ht, zend_ulong h); ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key); ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, int len); @@ -148,24 +148,24 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key); ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key); ZEND_API int zend_hash_str_del(HashTable *ht, const char *key, int len); ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *key, int len); -ZEND_API int zend_hash_index_del(HashTable *ht, zend_uint_t h); +ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h); /* Data retreival */ ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key); ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *key, int len); -ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_uint_t h); +ZEND_API zval *zend_hash_index_find(const HashTable *ht, zend_ulong h); /* Misc */ ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key); ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len); -ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_uint_t h); +ZEND_API int zend_hash_index_exists(const HashTable *ht, zend_ulong h); /* traversing */ #define zend_hash_has_more_elements_ex(ht, pos) \ (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_uint_t *num_index, zend_bool duplicate, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, zend_bool duplicate, HashPosition *pos); ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); @@ -175,7 +175,7 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos typedef struct _HashPointer { HashPosition pos; HashTable *ht; - zend_uint_t h; + zend_ulong h; } HashPointer; ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr); @@ -235,7 +235,7 @@ END_EXTERN_C() #define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \ zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, persistent) -static inline int _zend_handle_numeric_str(const char *key, zend_size_t length, zend_uint_t *idx) +static inline int _zend_handle_numeric_str(const char *key, size_t length, zend_ulong *idx) { register const char *tmp = key; const char *end; @@ -257,9 +257,9 @@ static inline int _zend_handle_numeric_str(const char *key, zend_size_t length, if ((*end != '\0') /* not a null terminated string */ || (*tmp == '0' && length > 1) /* numbers with leading zeros */ - || (end - tmp > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */ + || (end - tmp > MAX_LENGTH_OF_LONG - 1) /* number too long */ || (SIZEOF_ZEND_INT == 4 && - end - tmp == MAX_LENGTH_OF_ZEND_INT - 1 && + end - tmp == MAX_LENGTH_OF_LONG - 1 && *tmp > '2')) { /* overflow */ return 0; } @@ -322,7 +322,7 @@ static inline zval *zend_hash_str_find_ind(const HashTable *ht, const char *str, static inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_update(ht, idx, pData); @@ -334,7 +334,7 @@ static inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval * static inline zval *zend_symtable_update_ind(HashTable *ht, zend_string *key, zval *pData) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_update(ht, idx, pData); @@ -346,7 +346,7 @@ static inline zval *zend_symtable_update_ind(HashTable *ht, zend_string *key, zv static inline int zend_symtable_del(HashTable *ht, zend_string *key) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_del(ht, idx); @@ -358,7 +358,7 @@ static inline int zend_symtable_del(HashTable *ht, zend_string *key) static inline int zend_symtable_del_ind(HashTable *ht, zend_string *key) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_del(ht, idx); @@ -370,7 +370,7 @@ static inline int zend_symtable_del_ind(HashTable *ht, zend_string *key) static inline zval *zend_symtable_find(const HashTable *ht, zend_string *key) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_find(ht, idx); @@ -382,7 +382,7 @@ static inline zval *zend_symtable_find(const HashTable *ht, zend_string *key) static inline zval *zend_symtable_find_ind(const HashTable *ht, zend_string *key) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_find(ht, idx); @@ -394,7 +394,7 @@ static inline zval *zend_symtable_find_ind(const HashTable *ht, zend_string *key static inline int zend_symtable_exists(HashTable *ht, zend_string *key) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC(key, idx)) { return zend_hash_index_exists(ht, idx); @@ -406,7 +406,7 @@ static inline int zend_symtable_exists(HashTable *ht, zend_string *key) static inline zval *zend_symtable_str_update(HashTable *ht, const char *str, int len, zval *pData) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_update(ht, idx, pData); @@ -418,7 +418,7 @@ static inline zval *zend_symtable_str_update(HashTable *ht, const char *str, int static inline zval *zend_symtable_str_update_ind(HashTable *ht, const char *str, int len, zval *pData) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_update(ht, idx, pData); @@ -430,7 +430,7 @@ static inline zval *zend_symtable_str_update_ind(HashTable *ht, const char *str, static inline int zend_symtable_str_del(HashTable *ht, const char *str, int len) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_del(ht, idx); @@ -442,7 +442,7 @@ static inline int zend_symtable_str_del(HashTable *ht, const char *str, int len) static inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, int len) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_del(ht, idx); @@ -454,7 +454,7 @@ static inline int zend_symtable_str_del_ind(HashTable *ht, const char *str, int static inline zval *zend_symtable_str_find(HashTable *ht, const char *str, int len) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_find(ht, idx); @@ -466,7 +466,7 @@ static inline zval *zend_symtable_str_find(HashTable *ht, const char *str, int l static inline int zend_symtable_str_exists(HashTable *ht, const char *str, int len) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_exists(ht, idx); @@ -564,7 +564,7 @@ static inline void *zend_hash_str_update_mem(HashTable *ht, const char *str, int return zend_hash_str_update_ptr(ht, str, len, p); } -static inline void *zend_hash_index_update_ptr(HashTable *ht, zend_uint_t h, void *pData) +static inline void *zend_hash_index_update_ptr(HashTable *ht, zend_ulong h, void *pData) { zval tmp, *zv; @@ -582,7 +582,7 @@ static inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData) return zv ? Z_PTR_P(zv) : NULL; } -static inline void *zend_hash_index_update_mem(HashTable *ht, zend_uint_t h, void *pData, size_t size) +static inline void *zend_hash_index_update_mem(HashTable *ht, zend_ulong h, void *pData, size_t size) { void *p; @@ -620,7 +620,7 @@ static inline void *zend_hash_str_find_ptr(const HashTable *ht, const char *str, return zv ? Z_PTR_P(zv) : NULL; } -static inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_uint_t h) +static inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_ulong h) { zval *zv; @@ -630,7 +630,7 @@ static inline void *zend_hash_index_find_ptr(const HashTable *ht, zend_uint_t h) static inline void *zend_symtable_str_find_ptr(HashTable *ht, const char *str, int len) { - zend_uint_t idx; + zend_ulong idx; if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) { return zend_hash_index_find_ptr(ht, idx); diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 50a1edce38..dab9595d60 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -150,7 +150,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini case T_DOC_COMMENT: break; default: - STR_RELEASE(Z_STR(token)); + zend_string_release(Z_STR(token)); break; } } @@ -211,7 +211,7 @@ ZEND_API void zend_strip(TSRMLS_D) break; default: - STR_RELEASE(Z_STR(token)); + zend_string_release(Z_STR(token)); break; } } diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index 05254a30bc..5ebc4527e2 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -138,7 +138,7 @@ dflt_printout: case T_WHITESPACE: break; default: - STR_RELEASE(Z_STR(token)); + zend_string_release(Z_STR(token)); break; } } diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 52585005b9..1f07ac3d56 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -208,9 +208,9 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu hashed_ini_entry->module_number = module_number; if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRSIZE(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { + || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { hashed_ini_entry->value = Z_STRVAL(default_value); - hashed_ini_entry->value_length = Z_STRSIZE(default_value); + hashed_ini_entry->value_length = Z_STRLEN(default_value); config_directive_success = 1; } } @@ -352,7 +352,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di * Data retrieval */ -ZEND_API zend_int_t zend_ini_int(char *name, uint name_length, int orig) /* {{{ */ +ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -587,7 +587,7 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ { - zend_int_t *p; + zend_long *p; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -596,7 +596,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ base = (char *) ts_resource(*((int *) mh_arg2)); #endif - p = (zend_int_t *) (base+(size_t) mh_arg1); + p = (zend_long *) (base+(size_t) mh_arg1); *p = zend_atol(new_value, new_value_length); return SUCCESS; @@ -605,7 +605,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ { - zend_int_t *p, tmp; + zend_long *p, tmp; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -619,7 +619,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ return FAILURE; } - p = (zend_int_t *) (base+(size_t) mh_arg1); + p = (zend_long *) (base+(size_t) mh_arg1); *p = tmp; return SUCCESS; diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 4ed2b99387..68318612d0 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -69,7 +69,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint ne ZEND_API int zend_restore_ini_entry(zend_string *name, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); -ZEND_API zend_int_t zend_ini_int(char *name, uint name_length, int orig); +ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig); ZEND_API double zend_ini_double(char *name, uint name_length, int orig); ZEND_API char *zend_ini_string(char *name, uint name_length, int orig); ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists); @@ -124,12 +124,12 @@ END_EXTERN_C() ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, zend_ini_boolean_displayer_cb) #endif -#define INI_INT(name) zend_ini_int((name), sizeof(name)-1, 0) +#define INI_INT(name) zend_ini_long((name), sizeof(name)-1, 0) #define INI_FLT(name) zend_ini_double((name), sizeof(name)-1, 0) #define INI_STR(name) zend_ini_string_ex((name), sizeof(name)-1, 0, NULL) #define INI_BOOL(name) ((zend_bool) INI_INT(name)) -#define INI_ORIG_INT(name) zend_ini_int((name), sizeof(name)-1, 1) +#define INI_ORIG_INT(name) zend_ini_long((name), sizeof(name)-1, 1) #define INI_ORIG_FLT(name) zend_ini_double((name), sizeof(name)-1, 1) #define INI_ORIG_STR(name) zend_ini_string((name), sizeof(name)-1, 1) #define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 7981cff3d4..8093458308 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -50,13 +50,13 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) int i_result; int i_op1, i_op2; int str_len; - char str_result[MAX_LENGTH_OF_ZEND_INT]; + char str_result[MAX_LENGTH_OF_LONG]; i_op1 = atoi(Z_STRVAL_P(op1)); - STR_FREE(Z_STR_P(op1)); + zend_string_free(Z_STR_P(op1)); if (op2) { i_op2 = atoi(Z_STRVAL_P(op2)); - STR_FREE(Z_STR_P(op2)); + zend_string_free(Z_STR_P(op2)); } else { i_op2 = 0; } @@ -99,11 +99,11 @@ static void zend_ini_init_string(zval *result) */ static void zend_ini_add_string(zval *result, zval *op1, zval *op2) { - int op1_len = Z_STRSIZE_P(op1); - int length = op1_len + Z_STRSIZE_P(op2); + int op1_len = Z_STRLEN_P(op1); + int length = op1_len + Z_STRLEN_P(op2); - ZVAL_NEW_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1)); - memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + ZVAL_NEW_STR(result, zend_string_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; } /* }}} */ @@ -115,7 +115,7 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) zval *c, tmp; /* If name contains ':' it is not a constant. Bug #26893. */ - if (!memchr(Z_STRVAL_P(name), ':', Z_STRSIZE_P(name)) + if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) && (c = zend_get_constant(Z_STR_P(name) TSRMLS_CC)) != 0) { if (Z_TYPE_P(c) != IS_STRING) { ZVAL_COPY_VALUE(&tmp, c); @@ -126,11 +126,11 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) convert_to_string(&tmp); c = &tmp; } - ZVAL_PSTRINGL(result, Z_STRVAL_P(c), Z_STRSIZE_P(c)); + ZVAL_PSTRINGL(result, Z_STRVAL_P(c), Z_STRLEN_P(c)); if (c == &tmp) { zval_dtor(&tmp); } - STR_FREE(Z_STR_P(name)); + zend_string_free(Z_STR_P(name)); } else { *result = *name; } @@ -145,10 +145,10 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) char *envvar; /* Fetch configuration option value */ - if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name), &curval) == SUCCESS) { - ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRSIZE(curval)); + if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name), &curval) == SUCCESS) { + ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRLEN(curval)); /* ..or if not found, try ENV */ - } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRSIZE_P(name) TSRMLS_CC)) != NULL || + } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL || (envvar = getenv(Z_STRVAL_P(name))) != NULL) { ZVAL_PSTRING(result, envvar); } else { @@ -282,26 +282,26 @@ statement: printf("SECTION: [%s]\n", Z_STRVAL($2)); #endif ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC); - STR_RELEASE(Z_STR($2)); + zend_string_release(Z_STR($2)); } | TC_LABEL '=' string_or_value { #if DEBUG_CFG_PARSER printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3)); #endif ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); - STR_RELEASE(Z_STR($1)); - STR_RELEASE(Z_STR($3)); + zend_string_release(Z_STR($1)); + zend_string_release(Z_STR($3)); } | TC_OFFSET option_offset ']' '=' string_or_value { #if DEBUG_CFG_PARSER printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5)); #endif ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); - STR_RELEASE(Z_STR($1)); - STR_RELEASE(Z_STR($2)); - STR_RELEASE(Z_STR($5)); + zend_string_release(Z_STR($1)); + zend_string_release(Z_STR($2)); + zend_string_release(Z_STR($5)); } - | TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); STR_RELEASE(Z_STR($1)); } + | TC_LABEL { ZEND_INI_PARSER_CB(&$1, NULL, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); zend_string_release(Z_STR($1)); } | END_OF_LINE ; @@ -323,8 +323,8 @@ option_offset: ; encapsed_list: - encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } - | encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } + encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } + | encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } | /* empty */ { zend_ini_init_string(&$$); } ; @@ -332,18 +332,18 @@ var_string_list_section: cfg_var_ref { $$ = $1; } | constant_literal { $$ = $1; } | '"' encapsed_list '"' { $$ = $2; } - | var_string_list_section cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } - | var_string_list_section constant_literal { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } - | var_string_list_section '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); STR_FREE(Z_STR($3)); } + | var_string_list_section cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } + | var_string_list_section constant_literal { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } + | var_string_list_section '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); } ; var_string_list: cfg_var_ref { $$ = $1; } | constant_string { $$ = $1; } | '"' encapsed_list '"' { $$ = $2; } - | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } - | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } - | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); STR_FREE(Z_STR($3)); } + | var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } + | var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); } + | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); } ; expr: @@ -357,7 +357,7 @@ expr: ; cfg_var_ref: - TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); STR_FREE(Z_STR($2)); } + TC_DOLLAR_CURLY TC_VARNAME '}' { zend_ini_get_var(&$$, &$2 TSRMLS_CC); zend_string_free(Z_STR($2)); } ; constant_literal: diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 981ab50100..0dcec0444b 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_NEW_STR(retval, STR_INIT(str, len, 1)) + ZVAL_NEW_STR(retval, zend_string_init(str, len, 1)) #define RETURN_TOKEN(type, str, len) { \ @@ -269,7 +269,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRSIZE_P(lval); + end = s + Z_STRLEN_P(lval); while (s < end) { if (*s == '\\') { @@ -288,7 +288,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(lval)--; + Z_STRLEN_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 0bd303f54a..605d511f4f 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_NEW_STR(retval, STR_INIT(str, len, 1)) + ZVAL_NEW_STR(retval, zend_string_init(str, len, 1)) #define RETURN_TOKEN(type, str, len) { \ @@ -267,7 +267,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRSIZE_P(lval); + end = s + Z_STRLEN_P(lval); while (s < end) { if (*s == '\\') { @@ -286,7 +286,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(lval)--; + Z_STRLEN_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_int.h b/Zend/zend_int.h index de48718365..dbeb144e54 100644 --- a/Zend/zend_int.h +++ b/Zend/zend_int.h @@ -22,14 +22,10 @@ #ifndef ZEND_INT_H #define ZEND_INT_H -#ifndef ZEND_WIN32 -/* this probably needs more on non windows, like for C++ and C99*/ -# include <stdint.h> -# include <inttypes.h> -#endif +#include "main/php_stdint.h" /* This is the heart of the whole int64 enablement in zval. Based on this - macros the zend_size_t datatype is handled, see zend_types.h */ + macros the size_t datatype is handled, see zend_types.h */ #if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) # define ZEND_ENABLE_INT64 1 #endif @@ -38,8 +34,8 @@ #ifdef ZEND_ENABLE_INT64 # ifdef ZEND_WIN32 # ifdef _WIN64 -typedef __int64 zend_int_t; -typedef unsigned __int64 zend_uint_t; +typedef __int64 zend_long; +typedef unsigned __int64 zend_ulong; typedef __int64 zend_off_t; # define ZEND_INT_MAX _I64_MAX # define ZEND_INT_MIN _I64_MIN @@ -51,8 +47,8 @@ typedef __int64 zend_off_t; # endif # else # if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) -typedef int64_t zend_int_t; -typedef uint64_t zend_uint_t; +typedef int64_t zend_long; +typedef uint64_t zend_ulong; typedef off_t zend_off_t; # define ZEND_INT_MAX INT64_MAX # define ZEND_INT_MIN INT64_MIN @@ -65,8 +61,8 @@ typedef off_t zend_off_t; # endif # define SIZEOF_ZEND_INT 8 #else -typedef long zend_int_t; -typedef unsigned long zend_uint_t; +typedef long zend_long; +typedef unsigned long zend_ulong; typedef long zend_off_t; # define ZEND_INT_MAX LONG_MAX # define ZEND_INT_MIN LONG_MIN diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 8d1b2e3652..d5420dae76 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -195,7 +195,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_ static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { *int_key = _iter->index; - return HASH_KEY_IS_INT; + return HASH_KEY_IS_LONG; } #endif /* }}} */ @@ -216,7 +216,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name->val); } - ZVAL_INT(key, 0); + ZVAL_LONG(key, 0); } } /* }}} */ @@ -424,8 +424,8 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint zval_ptr_dtor(&retval); return FAILURE; case IS_STRING: - *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); - *buf_len = Z_STRSIZE(retval); + *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); + *buf_len = Z_STRLEN(retval); result = SUCCESS; break; default: /* failure */ diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h index 468223d47c..b0105d52e2 100644 --- a/Zend/zend_iterators.h +++ b/Zend/zend_iterators.h @@ -58,7 +58,7 @@ struct _zend_object_iterator { zend_object std; zval data; zend_object_iterator_funcs *funcs; - zend_uint_t index; /* private to fe_reset/fe_fetch opcodes */ + zend_ulong index; /* private to fe_reset/fe_fetch opcodes */ }; typedef struct _zend_class_iterator_funcs { diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 0d40b73e4d..a6e3182d96 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -578,7 +578,7 @@ optional_class_type: function_call_parameter_list: - '(' ')' { Z_IVAL($$.u.constant) = 0; } + '(' ')' { Z_LVAL($$.u.constant) = 0; } | '(' non_empty_function_call_parameter_list ')' { $$ = $2; } | '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); } ; @@ -625,7 +625,7 @@ class_statement_list: class_statement: - variable_modifiers { CG(access_type) = Z_IVAL($1.u.constant); } class_variable_declaration ';' + variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';' | class_constant_declaration ';' | trait_use_statement | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } @@ -686,37 +686,37 @@ trait_alias: ; trait_modifiers: - /* empty */ { Z_IVAL($$.u.constant) = 0x0; } /* No change of methods visibility */ + /* empty */ { Z_LVAL($$.u.constant) = 0x0; } /* No change of methods visibility */ | member_modifier { $$ = $1; } /* REM: Keep in mind, there are not only visibility modifiers */ ; method_body: - ';' /* abstract method */ { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } - | '{' inner_statement_list '}' { Z_IVAL($$.u.constant) = 0; } + ';' /* abstract method */ { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } + | '{' inner_statement_list '}' { Z_LVAL($$.u.constant) = 0; } ; variable_modifiers: non_empty_member_modifiers { $$ = $1; } - | T_VAR { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; } + | T_VAR { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } ; method_modifiers: - /* empty */ { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; } - | non_empty_member_modifiers { $$ = $1; if (!(Z_IVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_IVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } } + /* empty */ { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } + | non_empty_member_modifiers { $$ = $1; if (!(Z_LVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } } ; non_empty_member_modifiers: member_modifier { $$ = $1; } - | non_empty_member_modifiers member_modifier { Z_IVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); } + | non_empty_member_modifiers member_modifier { Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); } ; member_modifier: - T_PUBLIC { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; } - | T_PROTECTED { Z_IVAL($$.u.constant) = ZEND_ACC_PROTECTED; } - | T_PRIVATE { Z_IVAL($$.u.constant) = ZEND_ACC_PRIVATE; } - | T_STATIC { Z_IVAL($$.u.constant) = ZEND_ACC_STATIC; } - | T_ABSTRACT { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } - | T_FINAL { Z_IVAL($$.u.constant) = ZEND_ACC_FINAL; } + T_PUBLIC { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; } + | T_PROTECTED { Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; } + | T_PRIVATE { Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; } + | T_STATIC { Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; } + | T_ABSTRACT { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } + | T_FINAL { Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; } ; class_variable_declaration: @@ -812,8 +812,8 @@ expr_without_variable: | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); } - | '+' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } } - | '-' expr %prec T_INC { ZVAL_INT(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } } + | '+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } } + | '-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } } | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); } | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); } | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); } @@ -834,7 +834,7 @@ expr_without_variable: | expr '?' ':' { zend_do_jmp_set(&$1, &$2, &$3 TSRMLS_CC); } expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); } | internal_functions_in_yacc { $$ = $1; } - | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_INT TSRMLS_CC); } + | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); } | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); } | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); } | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); } @@ -915,13 +915,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_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($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, zend_string_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_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($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, zend_string_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; } ; @@ -964,7 +964,7 @@ backticks_expr: ctor_arguments: - /* empty */ { Z_IVAL($$.u.constant) = 0; } + /* empty */ { Z_LVAL($$.u.constant) = 0; } | function_call_parameter_list { $$ = $1; } ; @@ -997,7 +997,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_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($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, zend_string_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_ARRAY '(' static_array_pair_list ')' { $$ = $3; } | '[' static_array_pair_list ']' { $$ = $2; } | static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); } @@ -1045,7 +1045,7 @@ general_constant: 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_NEW_STR(&tmp, STR_ALLOC(Z_STRSIZE($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRSIZE($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, zend_string_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); } ; scalar: @@ -1203,8 +1203,8 @@ variable_name: ; simple_indirect_reference: - '$' { Z_IVAL($$.u.constant) = 1; } - | simple_indirect_reference '$' { Z_IVAL($$.u.constant)++; } + '$' { Z_LVAL($$.u.constant) = 1; } + | simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; } ; assignment_list: diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index ffde058e0b..78be159db3 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -535,9 +535,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) file_path = file_handle->filename; } - compiled_filename = STR_INIT(file_path, strlen(file_path), 0); + compiled_filename = zend_string_init(file_path, strlen(file_path), 0); zend_set_compiled_filename(compiled_filename TSRMLS_CC); - STR_RELEASE(compiled_filename); + zend_string_release(compiled_filename); if (CG(start_lineno)) { CG(zend_lineno) = CG(start_lineno); @@ -565,7 +565,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR zend_bool original_in_compilation = CG(in_compilation); retval_znode.op_type = IS_CONST; - ZVAL_INT(&retval_znode.u.constant, 1); + ZVAL_LONG(&retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -631,7 +631,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) retval = zend_compile_file(&file_handle, type TSRMLS_CC); if (retval && file_handle.handle.stream.handle) { if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRSIZE_P(filename)); + file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename)); } zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)); @@ -655,8 +655,8 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D zend_string *new_compiled_filename; /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ - old_len = Z_STRSIZE_P(str); - Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); + old_len = Z_STRLEN_P(str); + Z_STR_P(str) = zend_string_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); @@ -685,9 +685,9 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D yy_scan_buffer(buf, size TSRMLS_CC); - new_compiled_filename = STR_INIT(filename, strlen(filename), 0); + new_compiled_filename = zend_string_init(filename, strlen(filename), 0); zend_set_compiled_filename(new_compiled_filename TSRMLS_CC); - STR_RELEASE(new_compiled_filename); + zend_string_release(new_compiled_filename); CG(zend_lineno) = 1; CG(increment_lineno) = 0; RESET_DOC_COMMENT(); @@ -727,7 +727,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) int compiler_result; zend_bool original_in_compilation = CG(in_compilation); - if (Z_STRSIZE_P(source_string)==0) { + if (Z_STRLEN_P(source_string)==0) { efree(op_array); return NULL; } @@ -894,7 +894,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo /* convert escape sequences */ s = t = Z_STRVAL_P(zendlval); - end = s+Z_STRSIZE_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (s<end) { if (*s=='\\') { s++; @@ -906,23 +906,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo switch(*s) { case 'n': *t++ = '\n'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'r': *t++ = '\r'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 't': *t++ = '\t'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'f': *t++ = '\f'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'v': *t++ = '\v'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'e': #ifdef PHP_WIN32 @@ -930,7 +930,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo #else *t++ = '\e'; #endif - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case '"': case '`': @@ -942,20 +942,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'x': case 'X': if (ZEND_IS_HEX(*(s+1))) { char hex_buf[3] = { 0, 0, 0 }; - Z_STRSIZE_P(zendlval)--; /* for the 'x' */ + Z_STRLEN_P(zendlval)--; /* for the 'x' */ hex_buf[0] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_HEX(*(s+1))) { hex_buf[1] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; } *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); } else { @@ -969,13 +969,13 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo char octal_buf[4] = { 0, 0, 0, 0 }; octal_buf[0] = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[1] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[2] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; } } *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); @@ -1000,7 +1000,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo unsigned char *str; // TODO: avoid realocation ??? s = Z_STRVAL_P(zendlval); - SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC); + SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); zval_ptr_dtor(zendlval); ZVAL_STRINGL(zendlval, str, sz); efree(str); @@ -1645,7 +1645,7 @@ yy61: yyleng = YYCURSOR - SCNG(yy_text); #line 2153 "Zend/zend_language_scanner.l" { - Z_IVAL_P(zendlval) = (zend_int_t) '{'; + Z_LVAL_P(zendlval) = (zend_long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; @@ -1873,7 +1873,7 @@ yy83: yyleng = YYCURSOR - SCNG(yy_text); #line 2153 "Zend/zend_language_scanner.l" { - Z_IVAL_P(zendlval) = (zend_int_t) '{'; + Z_LVAL_P(zendlval) = (zend_long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; @@ -2132,7 +2132,7 @@ yy107: yyleng = YYCURSOR - SCNG(yy_text); #line 2153 "Zend/zend_language_scanner.l" { - Z_IVAL_P(zendlval) = (zend_int_t) '{'; + Z_LVAL_P(zendlval) = (zend_long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; @@ -2952,11 +2952,11 @@ yy173: yyleng = YYCURSOR - SCNG(yy_text); #line 1537 "Zend/zend_language_scanner.l" { - if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */ - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); } else { errno = 0; - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); @@ -3067,7 +3067,7 @@ yy179: /* convert escape sequences */ s = t = Z_STRVAL_P(zendlval); - end = s+Z_STRSIZE_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (s<end) { if (*s=='\\') { s++; @@ -3076,7 +3076,7 @@ yy179: case '\\': case '\'': *t++ = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; default: *t++ = '\\'; @@ -3099,7 +3099,7 @@ yy179: char *str = NULL; s = Z_STRVAL_P(zendlval); // TODO: avoid reallocation ??? - SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC); + SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); ZVAL_STRINGL(zendlval, str, sz); efree(s); } @@ -3316,9 +3316,9 @@ yy200: if (len < SIZEOF_ZEND_INT * 8) { if (len == 0) { - ZVAL_INT(zendlval, 0); + ZVAL_LONG(zendlval, 0); } else { - ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2)); + ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2)); } return T_LNUMBER; } else { @@ -3351,9 +3351,9 @@ yy203: if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) { if (len == 0) { - ZVAL_INT(zendlval, 0); + ZVAL_LONG(zendlval, 0); } else { - ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16)); + ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16)); } return T_LNUMBER; } else { @@ -3571,7 +3571,7 @@ yy235: HANDLE_NEWLINES(yytext, yyleng); if (doc_com) { - CG(doc_comment) = STR_INIT(yytext, yyleng, 0); + CG(doc_comment) = zend_string_init(yytext, yyleng, 0); return T_DOC_COMMENT; } @@ -4205,11 +4205,11 @@ yy322: filename = STR_EMPTY_ALLOC(); } - dirname = STR_INIT(filename->val, filename->len, 0); + dirname = zend_string_init(filename->val, filename->len, 0); zend_dirname(dirname->val, dirname->len); if (strcmp(dirname->val, ".") == 0) { - dirname = STR_REALLOC(dirname, MAXPATHLEN, 0); + dirname = zend_string_realloc(dirname, MAXPATHLEN, 0); #if HAVE_GETCWD VCWD_GETCWD(dirname->val, MAXPATHLEN); #elif HAVE_GETWD @@ -4248,7 +4248,7 @@ yy328: yyleng = YYCURSOR - SCNG(yy_text); #line 1666 "Zend/zend_language_scanner.l" { - ZVAL_INT(zendlval, CG(zend_lineno)); + ZVAL_LONG(zendlval, CG(zend_lineno)); return T_LINE; } #line 4255 "Zend/zend_language_scanner.c" @@ -4298,7 +4298,7 @@ yy336: len += sizeof("::")-1; len += CG(active_op_array)->function_name->len; } - ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0)); + ZVAL_NEW_STR(zendlval, zend_string_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); @@ -4312,7 +4312,7 @@ yy336: } Z_STRVAL_P(zendlval)[len] = 0; } else if (CG(active_op_array) && CG(active_op_array)->function_name) { - ZVAL_STR(zendlval, STR_COPY(CG(active_op_array)->function_name)); + ZVAL_STR(zendlval, zend_string_copy(CG(active_op_array)->function_name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -4373,7 +4373,7 @@ yy347: { zend_op_array *op_array = CG(active_op_array); if (op_array && op_array->function_name) { - ZVAL_STR(zendlval, STR_COPY(op_array->function_name)); + ZVAL_STR(zendlval, zend_string_copy(op_array->function_name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -4406,7 +4406,7 @@ yy352: if (!filename) { ZVAL_EMPTY_STRING(zendlval); } else { - ZVAL_STR(zendlval, STR_COPY(filename)); + ZVAL_STR(zendlval, zend_string_copy(filename)); } return T_FILE; } @@ -4444,7 +4444,7 @@ yy359: { zend_class_entry *ce = CG(active_class_entry); if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { - ZVAL_STR(zendlval, STR_COPY(ce->name)); + ZVAL_STR(zendlval, zend_string_copy(ce->name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -4490,7 +4490,7 @@ yy366: Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; } else { if (ce && ce->name) { - ZVAL_STR(zendlval, STR_COPY(ce->name)); + ZVAL_STR(zendlval, zend_string_copy(ce->name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -7672,8 +7672,8 @@ yy839: yyleng = YYCURSOR - SCNG(yy_text); #line 1578 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ - if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1 || (yyleng == MAX_LENGTH_OF_ZEND_INT - 1 && strcmp(yytext, int_min_digits) < 0)) { - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10)); + if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10)); } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index b6cad8f217..b3462e7062 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -533,9 +533,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC) file_path = file_handle->filename; } - compiled_filename = STR_INIT(file_path, strlen(file_path), 0); + compiled_filename = zend_string_init(file_path, strlen(file_path), 0); zend_set_compiled_filename(compiled_filename TSRMLS_CC); - STR_RELEASE(compiled_filename); + zend_string_release(compiled_filename); if (CG(start_lineno)) { CG(zend_lineno) = CG(start_lineno); @@ -563,7 +563,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR zend_bool original_in_compilation = CG(in_compilation); retval_znode.op_type = IS_CONST; - ZVAL_INT(&retval_znode.u.constant, 1); + ZVAL_LONG(&retval_znode.u.constant, 1); zend_save_lexical_state(&original_lex_state TSRMLS_CC); @@ -629,7 +629,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) retval = zend_compile_file(&file_handle, type TSRMLS_CC); if (retval && file_handle.handle.stream.handle) { if (!file_handle.opened_path) { - file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRSIZE_P(filename)); + file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename)); } zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)); @@ -653,8 +653,8 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D zend_string *new_compiled_filename; /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ - old_len = Z_STRSIZE_P(str); - Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); + old_len = Z_STRLEN_P(str); + Z_STR_P(str) = zend_string_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); @@ -683,9 +683,9 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D yy_scan_buffer(buf, size TSRMLS_CC); - new_compiled_filename = STR_INIT(filename, strlen(filename), 0); + new_compiled_filename = zend_string_init(filename, strlen(filename), 0); zend_set_compiled_filename(new_compiled_filename TSRMLS_CC); - STR_RELEASE(new_compiled_filename); + zend_string_release(new_compiled_filename); CG(zend_lineno) = 1; CG(increment_lineno) = 0; RESET_DOC_COMMENT(); @@ -725,7 +725,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC) int compiler_result; zend_bool original_in_compilation = CG(in_compilation); - if (Z_STRSIZE_P(source_string)==0) { + if (Z_STRLEN_P(source_string)==0) { efree(op_array); return NULL; } @@ -892,7 +892,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo /* convert escape sequences */ s = t = Z_STRVAL_P(zendlval); - end = s+Z_STRSIZE_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (s<end) { if (*s=='\\') { s++; @@ -904,23 +904,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo switch(*s) { case 'n': *t++ = '\n'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'r': *t++ = '\r'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 't': *t++ = '\t'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'f': *t++ = '\f'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'v': *t++ = '\v'; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'e': #ifdef PHP_WIN32 @@ -928,7 +928,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo #else *t++ = '\e'; #endif - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case '"': case '`': @@ -940,20 +940,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; case 'x': case 'X': if (ZEND_IS_HEX(*(s+1))) { char hex_buf[3] = { 0, 0, 0 }; - Z_STRSIZE_P(zendlval)--; /* for the 'x' */ + Z_STRLEN_P(zendlval)--; /* for the 'x' */ hex_buf[0] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_HEX(*(s+1))) { hex_buf[1] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; } *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); } else { @@ -967,13 +967,13 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo char octal_buf[4] = { 0, 0, 0, 0 }; octal_buf[0] = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[1] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; if (ZEND_IS_OCT(*(s+1))) { octal_buf[2] = *(++s); - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; } } *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); @@ -998,7 +998,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo unsigned char *str; // TODO: avoid realocation ??? s = Z_STRVAL_P(zendlval); - SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC); + SCNG(output_filter)(&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); zval_ptr_dtor(zendlval); ZVAL_STRINGL(zendlval, str, sz); efree(str); @@ -1523,9 +1523,9 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_ZEND_INT * 8) { if (len == 0) { - ZVAL_INT(zendlval, 0); + ZVAL_LONG(zendlval, 0); } else { - ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2)); + ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2)); } return T_LNUMBER; } else { @@ -1535,11 +1535,11 @@ NEWLINE ("\r"|"\n"|"\r\n") } <ST_IN_SCRIPTING>{LNUM} { - if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */ - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); } else { errno = 0; - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); @@ -1564,9 +1564,9 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) { if (len == 0) { - ZVAL_INT(zendlval, 0); + ZVAL_LONG(zendlval, 0); } else { - ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16)); + ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16)); } return T_LNUMBER; } else { @@ -1576,8 +1576,8 @@ NEWLINE ("\r"|"\n"|"\r\n") } <ST_VAR_OFFSET>[0]|([1-9][0-9]*) { /* Offset could be treated as a long */ - if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1 || (yyleng == MAX_LENGTH_OF_ZEND_INT - 1 && strcmp(yytext, int_min_digits) < 0)) { - ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10)); + if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { + ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10)); } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } @@ -1603,7 +1603,7 @@ NEWLINE ("\r"|"\n"|"\r\n") Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; } else { if (ce && ce->name) { - ZVAL_STR(zendlval, STR_COPY(ce->name)); + ZVAL_STR(zendlval, zend_string_copy(ce->name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -1614,7 +1614,7 @@ NEWLINE ("\r"|"\n"|"\r\n") <ST_IN_SCRIPTING>"__TRAIT__" { zend_class_entry *ce = CG(active_class_entry); if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { - ZVAL_STR(zendlval, STR_COPY(ce->name)); + ZVAL_STR(zendlval, zend_string_copy(ce->name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -1624,7 +1624,7 @@ NEWLINE ("\r"|"\n"|"\r\n") <ST_IN_SCRIPTING>"__FUNCTION__" { zend_op_array *op_array = CG(active_op_array); if (op_array && op_array->function_name) { - ZVAL_STR(zendlval, STR_COPY(op_array->function_name)); + ZVAL_STR(zendlval, zend_string_copy(op_array->function_name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -1642,7 +1642,7 @@ NEWLINE ("\r"|"\n"|"\r\n") len += sizeof("::")-1; len += CG(active_op_array)->function_name->len; } - ZVAL_NEW_STR(zendlval, STR_ALLOC(len, 0)); + ZVAL_NEW_STR(zendlval, zend_string_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); @@ -1656,7 +1656,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } Z_STRVAL_P(zendlval)[len] = 0; } else if (CG(active_op_array) && CG(active_op_array)->function_name) { - ZVAL_STR(zendlval, STR_COPY(CG(active_op_array)->function_name)); + ZVAL_STR(zendlval, zend_string_copy(CG(active_op_array)->function_name)); } else { ZVAL_EMPTY_STRING(zendlval); } @@ -1664,7 +1664,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } <ST_IN_SCRIPTING>"__LINE__" { - ZVAL_INT(zendlval, CG(zend_lineno)); + ZVAL_LONG(zendlval, CG(zend_lineno)); return T_LINE; } @@ -1674,7 +1674,7 @@ NEWLINE ("\r"|"\n"|"\r\n") if (!filename) { ZVAL_EMPTY_STRING(zendlval); } else { - ZVAL_STR(zendlval, STR_COPY(filename)); + ZVAL_STR(zendlval, zend_string_copy(filename)); } return T_FILE; } @@ -1687,11 +1687,11 @@ NEWLINE ("\r"|"\n"|"\r\n") filename = STR_EMPTY_ALLOC(); } - dirname = STR_INIT(filename->val, filename->len, 0); + dirname = zend_string_init(filename->val, filename->len, 0); zend_dirname(dirname->val, dirname->len); if (strcmp(dirname->val, ".") == 0) { - dirname = STR_REALLOC(dirname, MAXPATHLEN, 0); + dirname = zend_string_realloc(dirname, MAXPATHLEN, 0); #if HAVE_GETCWD VCWD_GETCWD(dirname->val, MAXPATHLEN); #elif HAVE_GETWD @@ -1945,7 +1945,7 @@ inline_html: HANDLE_NEWLINES(yytext, yyleng); if (doc_com) { - CG(doc_comment) = STR_INIT(yytext, yyleng, 0); + CG(doc_comment) = zend_string_init(yytext, yyleng, 0); return T_DOC_COMMENT; } @@ -2000,7 +2000,7 @@ inline_html: /* convert escape sequences */ s = t = Z_STRVAL_P(zendlval); - end = s+Z_STRSIZE_P(zendlval); + end = s+Z_STRLEN_P(zendlval); while (s<end) { if (*s=='\\') { s++; @@ -2009,7 +2009,7 @@ inline_html: case '\\': case '\'': *t++ = *s; - Z_STRSIZE_P(zendlval)--; + Z_STRLEN_P(zendlval)--; break; default: *t++ = '\\'; @@ -2032,7 +2032,7 @@ inline_html: char *str = NULL; s = Z_STRVAL_P(zendlval); // TODO: avoid reallocation ??? - SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRSIZE_P(zendlval) TSRMLS_CC); + SCNG(output_filter)((unsigned char **)&str, &sz, (unsigned char *)s, (size_t)Z_STRLEN_P(zendlval) TSRMLS_CC); ZVAL_STRINGL(zendlval, str, sz); efree(s); } @@ -2151,7 +2151,7 @@ inline_html: <ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" { - Z_IVAL_P(zendlval) = (zend_int_t) '{'; + Z_LVAL_P(zendlval) = (zend_long) '{'; yy_push_state(ST_IN_SCRIPTING TSRMLS_CC); yyless(1); return T_CURLY_OPEN; diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h index 7f1c6c18ec..71223ad117 100644 --- a/Zend/zend_multiply.h +++ b/Zend/zend_multiply.h @@ -21,8 +21,8 @@ #if defined(__i386__) && defined(__GNUC__) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ - zend_int_t __tmpvar; \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long __tmpvar; \ __asm__ ("imul %3,%0\n" \ "adc $0,%1" \ : "=r"(__tmpvar),"=r"(usedval) \ @@ -33,8 +33,8 @@ #elif defined(__x86_64__) && defined(__GNUC__) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ - zend_int_t __tmpvar; \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long __tmpvar; \ __asm__ ("imul %3,%0\n" \ "adc $0,%1" \ : "=r"(__tmpvar),"=r"(usedval) \ @@ -45,8 +45,8 @@ #elif defined(__arm__) && defined(__GNUC__) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ - zend_int_t __tmpvar; \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long __tmpvar; \ __asm__("smull %0, %1, %2, %3\n" \ "sub %1, %1, %0, asr #31" \ : "=r"(__tmpvar), "=r"(usedval) \ @@ -57,8 +57,8 @@ #elif defined(__aarch64__) && defined(__GNUC__) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ - zend_int_t __tmpvar; \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long __tmpvar; \ __asm__("mul %0, %2, %3\n" \ "smulh %1, %2, %3\n" \ "sub %1, %1, %0, asr #63\n" \ @@ -70,8 +70,8 @@ #elif defined(ZEND_WIN32) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ - zend_int_t __lres = (a) * (b); \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + zend_long __lres = (a) * (b); \ long double __dres = (long double)(a) * (long double)(b); \ long double __delta = (long double) __lres - __dres; \ if ( ((usedval) = (( __dres + __delta ) != __dres))) { \ @@ -83,7 +83,7 @@ #elif SIZEOF_ZEND_INT == 4 && defined(HAVE_ZEND_LONG64) -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \ if (__result > ZEND_INT_MAX || __result < ZEND_INT_MIN) { \ (dval) = (double) __result; \ @@ -96,7 +96,7 @@ #else -#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ long __lres = (a) * (b); \ long double __dres = (long double)(a) * (long double)(b); \ long double __delta = (long double) __lres - __dres; \ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index a0ff59b292..a91f60c7e4 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -401,12 +401,12 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf if (prop_info_name->val[0] == 0) { zend_unmangle_property_name_ex(prop_info_name->val, prop_info_name->len, &class_name, &prop_name, &prop_name_len); - member = STR_INIT(prop_name, prop_name_len, 0); + member = zend_string_init(prop_name, prop_name_len, 0); } else { - member = STR_COPY(prop_info_name); + member = zend_string_copy(prop_info_name); } property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC); - STR_RELEASE(member); + zend_string_release(member); if (!property_info) { return FAILURE; } @@ -423,7 +423,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf } /* }}} */ -static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */ +static zend_long *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */ { zend_property_info info; zval stub, *guard; @@ -437,7 +437,7 @@ static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name); if (class_name) { /* use unmangled name for protected properties */ - str = info.name = STR_INIT(prop_name, strlen(prop_name), 0); + str = info.name = zend_string_init(prop_name, strlen(prop_name), 0); property_info = &info; } } @@ -446,17 +446,17 @@ static zend_int_t *zend_get_property_guard(zend_object *zobj, zend_property_info zend_hash_init(zobj->guards, 8, NULL, NULL, 0); } else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) { if (str) { - STR_RELEASE(str); + zend_string_release(str); } - return &Z_IVAL_P(guard); + return &Z_LVAL_P(guard); } - ZVAL_INT(&stub, 0); + ZVAL_LONG(&stub, 0); guard = zend_hash_add_new(zobj->guards, property_info->name, &stub); if (str) { - STR_RELEASE(str); + zend_string_release(str); } - return &Z_IVAL_P(guard); + return &Z_LVAL_P(guard); } /* }}} */ @@ -501,7 +501,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_ /* magic get */ if (zobj->ce->__get) { - zend_int_t *guard = zend_get_property_guard(zobj, property_info, member); + zend_long *guard = zend_get_property_guard(zobj, property_info, member); if (!((*guard) & IN_GET)) { zval tmp_object; @@ -526,7 +526,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_ zval_ptr_dtor(&tmp_object); } else { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -635,7 +635,7 @@ found: /* magic set */ if (zobj->ce->__set) { - zend_int_t *guard = zend_get_property_guard(zobj, property_info, member); + zend_long *guard = zend_get_property_guard(zobj, property_info, member); if (!((*guard) & IN_SET)) { zval tmp_object; @@ -651,7 +651,7 @@ found: goto write_std_property; } else { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -778,7 +778,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, zval tmp_member; zval *retval, tmp; zend_property_info *property_info; - zend_int_t *guard; + zend_long *guard; zobj = Z_OBJ_P(object); @@ -875,7 +875,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo /* magic unset */ if (zobj->ce->__unset) { - zend_int_t *guard = zend_get_property_guard(zobj, property_info, member); + zend_long *guard = zend_get_property_guard(zobj, property_info, member); if (!((*guard) & IN_UNSET)) { zval tmp_object; @@ -887,7 +887,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo zval_ptr_dtor(&tmp_object); } else { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -1046,9 +1046,9 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry //??? keep compatibility for "\0" characters //??? see: Zend/tests/bug46238.phpt if (UNEXPECTED(strlen(method_name->val) != method_name->len)) { - call_user_call->function_name = STR_INIT(method_name->val, strlen(method_name->val), 0); + call_user_call->function_name = zend_string_init(method_name->val, strlen(method_name->val), 0); } else { - call_user_call->function_name = STR_COPY(method_name); + call_user_call->function_name = zend_string_copy(method_name); } return (union _zend_function *)call_user_call; @@ -1185,9 +1185,9 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class //??? keep compatibility for "\0" characters //??? see: Zend/tests/bug46238.phpt if (UNEXPECTED(strlen(method_name->val) != method_name->len)) { - callstatic_user_call->function_name = STR_INIT(method_name->val, strlen(method_name->val), 0); + callstatic_user_call->function_name = zend_string_init(method_name->val, strlen(method_name->val), 0); } else { - callstatic_user_call->function_name = STR_COPY(method_name); + callstatic_user_call->function_name = zend_string_copy(method_name); } return (zend_function *)callstatic_user_call; @@ -1205,7 +1205,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st if (EXPECTED(key != NULL)) { lc_function_name = Z_STR_P(key); } else { - lc_function_name = STR_ALLOC(function_name->len, 0); + lc_function_name = zend_string_alloc(function_name->len, 0); zend_str_tolower_copy(lc_function_name->val, function_name->val, function_name->len); } @@ -1226,7 +1226,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st fbc = Z_FUNC_P(func); } else { if (UNEXPECTED(!key)) { - STR_FREE(lc_function_name); + zend_string_free(lc_function_name); } if (ce->__call && Z_OBJ(EG(This)) && @@ -1278,7 +1278,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st } if (UNEXPECTED(!key)) { - STR_FREE(lc_function_name); + zend_string_free(lc_function_name); } return fbc; @@ -1404,10 +1404,10 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ Z_OBJ_UNPROTECT_RECURSION(o2); return 1; } - if (Z_IVAL(result) != 0) { + if (Z_LVAL(result) != 0) { Z_OBJ_UNPROTECT_RECURSION(o1); Z_OBJ_UNPROTECT_RECURSION(o2); - return Z_IVAL(result); + return Z_LVAL(result); } } else { Z_OBJ_UNPROTECT_RECURSION(o1); @@ -1485,7 +1485,7 @@ found: result = 0; if ((has_set_exists != 2) && zobj->ce->__isset) { - zend_int_t *guard = zend_get_property_guard(zobj, property_info, member); + zend_long *guard = zend_get_property_guard(zobj, property_info, member); if (!((*guard) & IN_ISSET)) { zval rv; @@ -1546,7 +1546,7 @@ zend_string* zend_std_object_get_class_name(const zend_object *zobj, int parent ce = zobj->ce; } - return STR_COPY(ce->name); + return zend_string_copy(ce->name); } /* }}} */ @@ -1586,13 +1586,13 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty case _IS_BOOL: ZVAL_BOOL(writeobj, 1); return SUCCESS; - case IS_INT: + case IS_LONG: ce = Z_OBJCE_P(readobj); zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val); if (readobj == writeobj) { zval_dtor(readobj); } - ZVAL_INT(writeobj, 1); + ZVAL_LONG(writeobj, 1); return SUCCESS; case IS_DOUBLE: ce = Z_OBJCE_P(readobj); diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index a11269c925..ee6c9d9e5b 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -106,7 +106,7 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_D /* updates *count to hold the number of elements present and returns SUCCESS. * Returns FAILURE if the object does not have any sense of overloaded dimensions */ -typedef int (*zend_object_count_elements_t)(zval *object, zend_int_t *count TSRMLS_DC); +typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count TSRMLS_DC); typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zend_object **obj_ptr TSRMLS_DC); diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index c254b33fb2..9eea73deaf 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -149,7 +149,7 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o } if (old_object->properties) { zval *prop, new_prop; - zend_uint_t num_key; + zend_ulong num_key; zend_string *key; if (!new_object->properties) { diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 1c0b06fa8c..b08dd9acf2 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -113,7 +113,7 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC) break; case ZEND_INTERNAL_FUNCTION: if (function->common.function_name) { - STR_RELEASE(function->common.function_name); + zend_string_release(function->common.function_name); } /* do nothing */ break; @@ -198,16 +198,16 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce) while (ce->trait_aliases[i]) { if (ce->trait_aliases[i]->trait_method) { if (ce->trait_aliases[i]->trait_method->method_name) { - STR_RELEASE(ce->trait_aliases[i]->trait_method->method_name); + zend_string_release(ce->trait_aliases[i]->trait_method->method_name); } if (ce->trait_aliases[i]->trait_method->class_name) { - STR_RELEASE(ce->trait_aliases[i]->trait_method->class_name); + zend_string_release(ce->trait_aliases[i]->trait_method->class_name); } efree(ce->trait_aliases[i]->trait_method); } if (ce->trait_aliases[i]->alias) { - STR_RELEASE(ce->trait_aliases[i]->alias); + zend_string_release(ce->trait_aliases[i]->alias); } efree(ce->trait_aliases[i]); @@ -221,8 +221,8 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce) size_t i = 0; while (ce->trait_precedences[i]) { - STR_RELEASE(ce->trait_precedences[i]->trait_method->method_name); - STR_RELEASE(ce->trait_precedences[i]->trait_method->class_name); + zend_string_release(ce->trait_precedences[i]->trait_method->method_name); + zend_string_release(ce->trait_precedences[i]->trait_method->class_name); efree(ce->trait_precedences[i]->trait_method); if (ce->trait_precedences[i]->exclude_from_classes) { @@ -266,14 +266,14 @@ ZEND_API void destroy_zend_class(zval *zv) efree(ce->default_static_members_table); } zend_hash_destroy(&ce->properties_info); - STR_RELEASE(ce->name); + zend_string_release(ce->name); zend_hash_destroy(&ce->function_table); zend_hash_destroy(&ce->constants_table); if (ce->num_interfaces > 0 && ce->interfaces) { efree(ce->interfaces); } if (ce->info.user.doc_comment) { - STR_RELEASE(ce->info.user.doc_comment); + zend_string_release(ce->info.user.doc_comment); } _destroy_zend_class_traits_info(ce); @@ -299,7 +299,7 @@ ZEND_API void destroy_zend_class(zval *zv) free(ce->default_static_members_table); } zend_hash_destroy(&ce->properties_info); - STR_RELEASE(ce->name); + zend_string_release(ce->name); zend_hash_destroy(&ce->function_table); zend_hash_destroy(&ce->constants_table); if (ce->num_interfaces > 0) { @@ -342,7 +342,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) i = op_array->last_var; while (i > 0) { i--; - STR_RELEASE(op_array->vars[i]); + zend_string_release(op_array->vars[i]); } efree(op_array->vars); } @@ -358,10 +358,10 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC) efree(op_array->opcodes); if (op_array->function_name) { - STR_RELEASE(op_array->function_name); + zend_string_release(op_array->function_name); } if (op_array->doc_comment) { - STR_RELEASE(op_array->doc_comment); + zend_string_release(op_array->doc_comment); } if (op_array->brk_cont_array) { efree(op_array->brk_cont_array); @@ -648,7 +648,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) int nest_levels, array_offset; zend_brk_cont_element *jmp_to; - nest_levels = Z_IVAL(op_array->literals[opline->op2.constant]); + nest_levels = Z_LVAL(op_array->literals[opline->op2.constant]); if ((array_offset = opline->op1.opline_num) != -1) { do { jmp_to = &op_array->brk_cont_array[array_offset]; @@ -661,7 +661,7 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC) } } case ZEND_GOTO: - if (Z_TYPE(op_array->literals[opline->op2.constant]) != IS_INT) { + if (Z_TYPE(op_array->literals[opline->op2.constant]) != IS_LONG) { zend_uint num = opline->op2.constant; opline->op2.zv = &op_array->literals[opline->op2.constant]; zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC); @@ -734,7 +734,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC) opline->extended_value = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->extended_value); break; case ZEND_GOTO: - if (Z_TYPE_P(opline->op2.zv) != IS_INT) { + if (Z_TYPE_P(opline->op2.zv) != IS_LONG) { zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC); } /* break omitted intentionally */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 423a9e614d..31127f8e4f 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -107,9 +107,9 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ } /* }}} */ -ZEND_API zend_int_t zend_atol(const char *str, int str_len) /* {{{ */ +ZEND_API zend_long zend_atol(const char *str, int str_len) /* {{{ */ { - zend_int_t retval; + zend_long retval; if (!str_len) { str_len = strlen(str); @@ -198,24 +198,24 @@ try_again: zend_string *str; str = Z_STR_P(op); - if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_IVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { - ZVAL_INT(op, 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); + zend_string_release(str); break; } case IS_NULL: case IS_FALSE: - ZVAL_INT(op, 0); + ZVAL_LONG(op, 0); break; case IS_TRUE: - ZVAL_INT(op, 1); + ZVAL_LONG(op, 1); break; case IS_RESOURCE: { - zend_int_t l = Z_RES_HANDLE_P(op); + zend_long l = Z_RES_HANDLE_P(op); zval_ptr_dtor(op); - ZVAL_INT(op, l); + ZVAL_LONG(op, l); } break; case IS_OBJECT: @@ -228,36 +228,36 @@ try_again: /* {{{ zendi_convert_scalar_to_number */ #define zendi_convert_scalar_to_number(op, holder, result) \ if (op==result) { \ - if (Z_TYPE_P(op) != IS_INT) { \ + if (Z_TYPE_P(op) != IS_LONG) { \ convert_scalar_to_number(op TSRMLS_CC); \ } \ } else { \ switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRSIZE_P(op), &Z_IVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ - ZVAL_INT(&(holder), 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); \ break; \ } \ case IS_NULL: \ case IS_FALSE: \ - ZVAL_INT(&(holder), 0); \ + ZVAL_LONG(&(holder), 0); \ (op) = &(holder); \ break; \ case IS_TRUE: \ - ZVAL_INT(&(holder), 1); \ + ZVAL_LONG(&(holder), 1); \ (op) = &(holder); \ break; \ case IS_RESOURCE: \ - ZVAL_INT(&(holder), Z_RES_HANDLE_P(op)); \ + ZVAL_LONG(&(holder), Z_RES_HANDLE_P(op)); \ (op) = &(holder); \ break; \ case IS_OBJECT: \ ZVAL_DUP(&(holder), op); \ convert_to_int_base(&(holder), 10); \ - if (Z_TYPE(holder) == IS_INT) { \ + if (Z_TYPE(holder) == IS_LONG) { \ (op) = &(holder); \ } \ break; \ @@ -270,34 +270,34 @@ try_again: #define zendi_convert_to_int(op, holder, result) \ if (op == result) { \ convert_to_int(op); \ - } else if (Z_TYPE_P(op) != IS_INT) { \ + } else if (Z_TYPE_P(op) != IS_LONG) { \ switch (Z_TYPE_P(op)) { \ case IS_NULL: \ case IS_FALSE: \ - ZVAL_INT(&(holder), 0); \ + ZVAL_LONG(&(holder), 0); \ break; \ case IS_TRUE: \ - ZVAL_INT(&(holder), 1); \ + ZVAL_LONG(&(holder), 1); \ break; \ case IS_DOUBLE: \ - ZVAL_INT(&holder, zend_dval_to_ival(Z_DVAL_P(op)));\ + ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\ break; \ case IS_STRING: \ - ZVAL_INT(&holder, ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10));\ + ZVAL_LONG(&holder, ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10));\ break; \ case IS_ARRAY: \ - ZVAL_INT(&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_int_base(&(holder), 10); \ break; \ case IS_RESOURCE: \ - ZVAL_INT(&holder, Z_RES_HANDLE_P(op)); \ + ZVAL_LONG(&holder, Z_RES_HANDLE_P(op)); \ break; \ default: \ zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - ZVAL_INT(&holder, 0); \ + ZVAL_LONG(&holder, 0); \ break; \ } \ (op) = &(holder); \ @@ -318,15 +318,15 @@ try_again: case IS_RESOURCE: \ ZVAL_BOOL(&holder, Z_RES_HANDLE_P(op) ? 1 : 0); \ break; \ - case IS_INT: \ - ZVAL_BOOL(&holder, Z_IVAL_P(op) ? 1 : 0); \ + case IS_LONG: \ + ZVAL_BOOL(&holder, Z_LVAL_P(op) ? 1 : 0); \ break; \ case IS_DOUBLE: \ ZVAL_BOOL(&holder, Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ - if (Z_STRSIZE_P(op) == 0 \ - || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ + if (Z_STRLEN_P(op) == 0 \ + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ ZVAL_BOOL(&holder, 0); \ } else { \ ZVAL_BOOL(&holder, 1); \ @@ -370,7 +370,7 @@ try_again: ZEND_API void convert_to_int(zval *op) /* {{{ */ { - if (Z_TYPE_P(op) != IS_INT) { + if (Z_TYPE_P(op) != IS_LONG) { convert_to_int_base(op, 10); } } @@ -378,56 +378,56 @@ ZEND_API void convert_to_int(zval *op) /* {{{ */ ZEND_API void convert_to_int_base(zval *op, int base) /* {{{ */ { - zend_int_t tmp; + zend_long tmp; switch (Z_TYPE_P(op)) { case IS_NULL: case IS_FALSE: - ZVAL_INT(op, 0); + ZVAL_LONG(op, 0); break; case IS_TRUE: - ZVAL_INT(op, 1); + ZVAL_LONG(op, 1); break; case IS_RESOURCE: { - zend_int_t l = Z_RES_HANDLE_P(op); + zend_long l = Z_RES_HANDLE_P(op); zval_ptr_dtor(op); - ZVAL_INT(op, l); + ZVAL_LONG(op, l); } /* break missing intentionally */ - Z_TYPE_INFO_P(op) = IS_INT; + Z_TYPE_INFO_P(op) = IS_LONG; break; - case IS_INT: + case IS_LONG: break; case IS_DOUBLE: - ZVAL_INT(op, zend_dval_to_ival(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); - ZVAL_INT(op, strtol(str->val, NULL, base)); - STR_RELEASE(str); + ZVAL_LONG(op, strtol(str->val, NULL, base)); + zend_string_release(str); } break; case IS_ARRAY: tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); zval_dtor(op); - ZVAL_INT(op, tmp); + ZVAL_LONG(op, tmp); break; case IS_OBJECT: { zval dst; TSRMLS_FETCH(); - convert_object_to_type(op, &dst, IS_INT, convert_to_int); + convert_object_to_type(op, &dst, IS_LONG, convert_to_int); zval_dtor(op); - if (Z_TYPE(dst) == IS_INT) { + if (Z_TYPE(dst) == IS_LONG) { ZVAL_COPY_VALUE(op, &dst); } else { zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val); - ZVAL_INT(op, 1); + ZVAL_LONG(op, 1); } return; } @@ -454,8 +454,8 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ ZVAL_DOUBLE(op, d); } break; - case IS_INT: - ZVAL_DOUBLE(op, (double) Z_IVAL_P(op)); + case IS_LONG: + ZVAL_DOUBLE(op, (double) Z_LVAL_P(op)); break; case IS_DOUBLE: break; @@ -464,7 +464,7 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */ zend_string *str = Z_STR_P(op); ZVAL_DOUBLE(op, zend_strtod(str->val, NULL)); - STR_RELEASE(str); + zend_string_release(str); } break; case IS_ARRAY: @@ -527,14 +527,14 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ ZVAL_BOOL(op, 0); break; case IS_RESOURCE: { - zend_int_t l = (Z_RES_HANDLE_P(op) ? 1 : 0); + zend_long l = (Z_RES_HANDLE_P(op) ? 1 : 0); zval_ptr_dtor(op); ZVAL_BOOL(op, l); } break; - case IS_INT: - ZVAL_BOOL(op, Z_IVAL_P(op) ? 1 : 0); + case IS_LONG: + ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0); break; case IS_DOUBLE: ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0); @@ -549,7 +549,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } else { ZVAL_BOOL(op, 1); } - STR_RELEASE(str); + zend_string_release(str); } break; case IS_ARRAY: @@ -593,18 +593,18 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ break; } case IS_TRUE: - ZVAL_NEW_STR(op, STR_INIT("1", 1, 0)); + ZVAL_NEW_STR(op, zend_string_init("1", 1, 0)); break; case IS_STRING: break; case IS_RESOURCE: { - char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT]; + char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; int len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(op)); - ZVAL_NEW_STR(op, STR_INIT(buf, len, 0)); + ZVAL_NEW_STR(op, zend_string_init(buf, len, 0)); break; } - case IS_INT: { - ZVAL_NEW_STR(op, zend_int_to_str(Z_IVAL_P(op))); + case IS_LONG: { + ZVAL_NEW_STR(op, zend_longo_str(Z_LVAL_P(op))); break; } case IS_DOUBLE: { @@ -620,7 +620,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); - ZVAL_NEW_STR(op, STR_INIT("Array", sizeof("Array")-1, 0)); + ZVAL_NEW_STR(op, zend_string_init("Array", sizeof("Array")-1, 0)); break; case IS_OBJECT: { zval dst; @@ -634,7 +634,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ } else { zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val); zval_dtor(op); - ZVAL_NEW_STR(op, STR_INIT("Object", sizeof("Object")-1, 0)); + ZVAL_NEW_STR(op, zend_string_init("Object", sizeof("Object")-1, 0)); } break; } @@ -784,7 +784,7 @@ ZEND_API void multi_convert_to_string_ex(int argc, ...) /* {{{ */ } /* }}} */ -ZEND_API zend_int_t _zval_get_int_func(zval *op TSRMLS_DC) /* {{{ */ +ZEND_API zend_long _zval_get_long_func(zval *op TSRMLS_DC) /* {{{ */ { try_again: switch (Z_TYPE_P(op)) { @@ -795,10 +795,10 @@ try_again: return 1; case IS_RESOURCE: return Z_RES_HANDLE_P(op); - case IS_INT: - return Z_IVAL_P(op); + case IS_LONG: + return Z_LVAL_P(op); case IS_DOUBLE: - return zend_dval_to_ival(Z_DVAL_P(op)); + return zend_dval_to_lval(Z_DVAL_P(op)); case IS_STRING: return ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10); case IS_ARRAY: @@ -806,9 +806,9 @@ try_again: case IS_OBJECT: { zval dst; - convert_object_to_type(op, &dst, IS_INT, convert_to_int); - if (Z_TYPE(dst) == IS_INT) { - return Z_IVAL(dst); + convert_object_to_type(op, &dst, IS_LONG, convert_to_int); + if (Z_TYPE(dst) == IS_LONG) { + return Z_LVAL(dst); } else { zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val); return 1; @@ -834,8 +834,8 @@ try_again: return 1.0; case IS_RESOURCE: return (double) Z_RES_HANDLE_P(op); - case IS_INT: - return (double) Z_IVAL_P(op); + case IS_LONG: + return (double) Z_LVAL_P(op); case IS_DOUBLE: return Z_DVAL_P(op); case IS_STRING: @@ -872,25 +872,25 @@ try_again: case IS_FALSE: return STR_EMPTY_ALLOC(); case IS_STRING: - return STR_COPY(Z_STR_P(op)); + return zend_string_copy(Z_STR_P(op)); case IS_TRUE: - return STR_INIT("1", 1, 0); + return zend_string_init("1", 1, 0); case IS_RESOURCE: { - char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT]; + char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; int len; len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(op)); - return STR_INIT(buf, len, 0); + return zend_string_init(buf, len, 0); } - case IS_INT: { - return zend_int_to_str(Z_IVAL_P(op)); + case IS_LONG: { + return zend_longo_str(Z_LVAL_P(op)); } case IS_DOUBLE: { return zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op)); } case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); - return STR_INIT("Array", sizeof("Array")-1, 0); + return zend_string_init("Array", sizeof("Array")-1, 0); case IS_OBJECT: { zval tmp; if (Z_OBJ_HT_P(op)->cast_object) { @@ -925,26 +925,26 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): { - zend_int_t lval = Z_IVAL_P(op1) + Z_IVAL_P(op2); + case TYPE_PAIR(IS_LONG, IS_LONG): { + zend_long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); /* check for overflow by comparing sign bits */ - if ((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK) - && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { - ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) + (double) Z_IVAL_P(op2)); + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); } else { - ZVAL_INT(result, lval); + ZVAL_LONG(result, lval); } return SUCCESS; } - case TYPE_PAIR(IS_INT, IS_DOUBLE): - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) + Z_DVAL_P(op2)); + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_IVAL_P(op2))); + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): @@ -989,26 +989,26 @@ ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): { - zend_int_t lval = Z_IVAL_P(op1) - Z_IVAL_P(op2); + case TYPE_PAIR(IS_LONG, IS_LONG): { + zend_long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); /* check for overflow by comparing sign bits */ - if ((Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(op2) & LONG_SIGN_MASK) - && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { + if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) + && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { - ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) - (double) Z_IVAL_P(op2)); + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); } else { - ZVAL_INT(result, lval); + ZVAL_LONG(result, lval); } return SUCCESS; } - case TYPE_PAIR(IS_INT, IS_DOUBLE): - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) - Z_DVAL_P(op2)); + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_IVAL_P(op2))); + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): @@ -1042,20 +1042,20 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): { - zend_int_t overflow; + case TYPE_PAIR(IS_LONG, IS_LONG): { + zend_long overflow; - ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1),Z_IVAL_P(op2), Z_IVAL_P(result),Z_DVAL_P(result),overflow); - Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_INT; + ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); + Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG; return SUCCESS; } - case TYPE_PAIR(IS_INT, IS_DOUBLE): - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) * Z_DVAL_P(op2)); + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_IVAL_P(op2))); + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): @@ -1089,32 +1089,32 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): - if (Z_IVAL_P(op2) >= 0) { - zend_int_t l1 = 1, l2 = Z_IVAL_P(op1), i = Z_IVAL_P(op2); + case TYPE_PAIR(IS_LONG, IS_LONG): + if (Z_LVAL_P(op2) >= 0) { + zend_long l1 = 1, l2 = Z_LVAL_P(op1), i = Z_LVAL_P(op2); if (i == 0) { - ZVAL_INT(result, 1L); + ZVAL_LONG(result, 1L); return SUCCESS; } else if (l2 == 0) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } while (i >= 1) { - zend_int_t overflow; + zend_long overflow; double dval = 0.0; if (i % 2) { --i; - ZEND_SIGNED_MULTIPLY_INT(l1, l2, l1, dval, overflow); + ZEND_SIGNED_MULTIPLY_LONG(l1, l2, l1, dval, overflow); if (overflow) { ZVAL_DOUBLE(result, dval * pow(l2, i)); return SUCCESS; } } else { i /= 2; - ZEND_SIGNED_MULTIPLY_INT(l2, l2, l2, dval, overflow); + ZEND_SIGNED_MULTIPLY_LONG(l2, l2, l2, dval, overflow); if (overflow) { ZVAL_DOUBLE(result, (double)l1 * pow(dval, i)); return SUCCESS; @@ -1122,18 +1122,18 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * } } /* i == 0 */ - ZVAL_INT(result, l1); + ZVAL_LONG(result, l1); } else { - ZVAL_DOUBLE(result, pow((double)Z_IVAL_P(op1), (double)Z_IVAL_P(op2))); + ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), (double)Z_LVAL_P(op2))); } return SUCCESS; - case TYPE_PAIR(IS_INT, IS_DOUBLE): - ZVAL_DOUBLE(result, pow((double)Z_IVAL_P(op1), Z_DVAL_P(op2))); + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), Z_DVAL_P(op2))); return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_IVAL_P(op2))); + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_LVAL_P(op2))); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): @@ -1149,13 +1149,13 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW); if (Z_TYPE_P(op1) == IS_ARRAY) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } else { zendi_convert_scalar_to_number(op1, op1_copy, result); } if (Z_TYPE_P(op2) == IS_ARRAY) { - ZVAL_INT(result, 1L); + ZVAL_LONG(result, 1L); return SUCCESS; } else { zendi_convert_scalar_to_number(op2, op2_copy, result); @@ -1177,39 +1177,39 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): - if (Z_IVAL_P(op2) == 0) { + case TYPE_PAIR(IS_LONG, IS_LONG): + if (Z_LVAL_P(op2) == 0) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ - } else if (Z_IVAL_P(op2) == -1 && Z_IVAL_P(op1) == ZEND_INT_MIN) { + } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_INT_MIN) { /* Prevent overflow error/crash */ ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1); return SUCCESS; } - if (Z_IVAL_P(op1) % Z_IVAL_P(op2) == 0) { /* integer */ - ZVAL_INT(result, Z_IVAL_P(op1) / Z_IVAL_P(op2)); + if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ + ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); } else { - ZVAL_DOUBLE(result, ((double) Z_IVAL_P(op1)) / Z_IVAL_P(op2)); + ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); } return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - if (Z_IVAL_P(op2) == 0) { + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + if (Z_LVAL_P(op2) == 0) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ } - ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_IVAL_P(op2)); + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); return SUCCESS; - case TYPE_PAIR(IS_INT, IS_DOUBLE): + case TYPE_PAIR(IS_LONG, IS_DOUBLE): if (Z_DVAL_P(op2) == 0) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ } - ZVAL_DOUBLE(result, (double)Z_IVAL_P(op1) / Z_DVAL_P(op2)); + ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): @@ -1244,31 +1244,31 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_MOD); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - if (Z_IVAL_P(op2) == 0) { + if (Z_LVAL_P(op2) == 0) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* modulus by zero */ } - if (Z_IVAL_P(op2) == -1) { + if (Z_LVAL_P(op2) == -1) { /* Prevent overflow error/crash if op1==LONG_MIN */ - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } - ZVAL_INT(result, op1_lval % Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval % Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1276,7 +1276,7 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; if ((Z_TYPE_P(op1) != IS_FALSE && Z_TYPE_P(op1) != IS_TRUE) || (Z_TYPE_P(op2) != IS_FALSE && Z_TYPE_P(op2) != IS_TRUE)) { @@ -1317,18 +1317,18 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ { switch (Z_TYPE_P(op1)) { - case IS_INT: - ZVAL_INT(result, ~Z_IVAL_P(op1)); + case IS_LONG: + ZVAL_LONG(result, ~Z_LVAL_P(op1)); return SUCCESS; case IS_DOUBLE: - ZVAL_INT(result, ~zend_dval_to_ival(Z_DVAL_P(op1))); + ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); return SUCCESS; case IS_STRING: { - zend_size_t i; + size_t i; zval op1_copy = *op1; - ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE(op1_copy), 0)); - for (i = 0; i < Z_STRSIZE(op1_copy); i++) { + ZVAL_NEW_STR(result, zend_string_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]; } Z_STRVAL_P(result)[i] = 0; @@ -1346,14 +1346,14 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; zend_string *str; - zend_size_t i; + size_t i; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1361,29 +1361,29 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / shorter = op1; } - str = STR_ALLOC(Z_STRSIZE_P(longer), 0); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + str = zend_string_alloc(Z_STRLEN_P(longer), 0); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { str->val[i] = Z_STRVAL_P(longer)[i] | Z_STRVAL_P(shorter)[i]; } - memcpy(str->val + i, Z_STRVAL_P(longer) + i, Z_STRSIZE_P(longer) - i + 1); + memcpy(str->val + i, Z_STRVAL_P(longer) + i, Z_STRLEN_P(longer) - i + 1); if (result==op1) { - STR_RELEASE(Z_STR_P(result)); + zend_string_release(Z_STR_P(result)); } ZVAL_NEW_STR(result, str); return SUCCESS; } - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_OR); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - ZVAL_INT(result, op1_lval | Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval | Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1391,14 +1391,14 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; zend_string *str; - zend_size_t i; + size_t i; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1406,29 +1406,29 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - str = STR_ALLOC(Z_STRSIZE_P(shorter), 0); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + str = zend_string_alloc(Z_STRLEN_P(shorter), 0); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { str->val[i] = Z_STRVAL_P(shorter)[i] & Z_STRVAL_P(longer)[i]; } str->val[i] = 0; if (result==op1) { - STR_RELEASE(Z_STR_P(result)); + zend_string_release(Z_STR_P(result)); } ZVAL_NEW_STR(result, str); return SUCCESS; } - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_AND); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - ZVAL_INT(result, op1_lval & Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval & Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1436,14 +1436,14 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; zend_string *str; - zend_size_t i; + size_t i; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1451,29 +1451,29 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) shorter = op1; } - str = STR_ALLOC(Z_STRSIZE_P(shorter), 0); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + str = zend_string_alloc(Z_STRLEN_P(shorter), 0); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { str->val[i] = Z_STRVAL_P(shorter)[i] ^ Z_STRVAL_P(longer)[i]; } str->val[i] = 0; if (result==op1) { - STR_RELEASE(Z_STR_P(result)); + zend_string_release(Z_STR_P(result)); } ZVAL_NEW_STR(result, str); return SUCCESS; } - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_BW_XOR); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - ZVAL_INT(result, op1_lval ^ Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval ^ Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1481,19 +1481,19 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SL); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - ZVAL_INT(result, op1_lval << Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval << Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1501,19 +1501,19 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; - zend_int_t op1_lval; + zend_long op1_lval; - if (Z_TYPE_P(op1) != IS_INT || Z_TYPE_P(op2) != IS_INT) { + if (Z_TYPE_P(op1) != IS_LONG || Z_TYPE_P(op2) != IS_LONG) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SR); zendi_convert_to_int(op1, op1_copy, result); - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); zendi_convert_to_int(op2, op2_copy, result); } else { - op1_lval = Z_IVAL_P(op1); + op1_lval = Z_LVAL_P(op1); } - ZVAL_INT(result, op1_lval >> Z_IVAL_P(op2)); + ZVAL_LONG(result, op1_lval >> Z_LVAL_P(op2)); return SUCCESS; } /* }}} */ @@ -1521,10 +1521,10 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* must support result==op1 */ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_size_t length = Z_STRSIZE_P(op1) + 1; - zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0); + size_t length = Z_STRLEN_P(op1) + 1; + zend_string *buf = zend_string_realloc(Z_STR_P(op1), length, 0); - buf->val[length - 1] = (char) Z_IVAL_P(op2); + buf->val[length - 1] = (char) Z_LVAL_P(op2); buf->val[length] = 0; ZVAL_NEW_STR(result, buf); return SUCCESS; @@ -1534,11 +1534,11 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* must support result==op1 */ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_size_t op1_len = Z_STRSIZE_P(op1); - zend_size_t length = op1_len + Z_STRSIZE_P(op2); - zend_string *buf = STR_REALLOC(Z_STR_P(op1), length, 0); + size_t op1_len = Z_STRLEN_P(op1); + size_t length = op1_len + Z_STRLEN_P(op2); + zend_string *buf = zend_string_realloc(Z_STR_P(op1), length, 0); - memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + memcpy(buf->val + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf->val[length] = 0; ZVAL_NEW_STR(result, buf); return SUCCESS; @@ -1576,25 +1576,25 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ } if (result==op1 && !IS_INTERNED(Z_STR_P(op1))) { /* special case, perform operations on result */ - zend_size_t op1_len = Z_STRSIZE_P(op1); - zend_size_t op2_len = Z_STRSIZE_P(op2); - zend_size_t res_len = op1_len + op2_len; + size_t op1_len = Z_STRLEN_P(op1); + size_t op2_len = Z_STRLEN_P(op2); + size_t res_len = op1_len + op2_len; - if (Z_STRSIZE_P(result) < 0 || (zend_size_t) (op1_len + op2_len) < 0) { + if (Z_STRLEN_P(result) < 0 || (size_t) (op1_len + op2_len) < 0) { ZVAL_EMPTY_STRING(result); zend_error(E_ERROR, "String size overflow"); } - Z_STR_P(result) = STR_REALLOC(Z_STR_P(result), res_len, 0 ); + Z_STR_P(result) = zend_string_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 { - zend_size_t length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); - zend_string *buf = STR_ALLOC(length, 0); + size_t length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_string *buf = zend_string_alloc(length, 0); - memcpy(buf->val, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); - memcpy(buf->val + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + 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_NEW_STR(result, buf); } @@ -1614,13 +1614,13 @@ ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend zend_string *str2 = zval_get_string(op2); if (case_insensitive) { - ZVAL_INT(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); + ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); } else { - ZVAL_INT(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); + ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); } - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); return SUCCESS; } /* }}} */ @@ -1630,18 +1630,18 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { if (Z_STR_P(op1) == Z_STR_P(op2)) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); } else { - ZVAL_INT(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2))); + ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2))); } } else { zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_INT(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); + ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); } return SUCCESS; } @@ -1652,18 +1652,18 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { if (Z_STR_P(op1) == Z_STR_P(op2)) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); } else { - ZVAL_INT(result, zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2))); + ZVAL_LONG(result, zend_binary_strcasecmp_l(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2))); } } else { zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_INT(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); + ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); } return SUCCESS; } @@ -1675,10 +1675,10 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 T zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_INT(result, strcoll(str1->val, str2->val)); + ZVAL_LONG(result, strcoll(str1->val, str2->val)); - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); return SUCCESS; } /* }}} */ @@ -1691,7 +1691,7 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_ d1 = zval_get_double(op1); d2 = zval_get_double(op2); - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(d1 - d2)); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(d1 - d2)); return SUCCESS; } @@ -1718,26 +1718,26 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { - case TYPE_PAIR(IS_INT, IS_INT): - ZVAL_INT(result, Z_IVAL_P(op1)>Z_IVAL_P(op2)?1:(Z_IVAL_P(op1)<Z_IVAL_P(op2)?-1:0)); + case TYPE_PAIR(IS_LONG, IS_LONG): + ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0)); return SUCCESS; - case TYPE_PAIR(IS_DOUBLE, IS_INT): - Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_IVAL_P(op2); - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); + case TYPE_PAIR(IS_DOUBLE, IS_LONG): + Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); return SUCCESS; - case TYPE_PAIR(IS_INT, IS_DOUBLE): - Z_DVAL_P(result) = (double)Z_IVAL_P(op1) - Z_DVAL_P(op2); - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); + case TYPE_PAIR(IS_LONG, IS_DOUBLE): + Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); return SUCCESS; case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE): if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); } else { Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); } return SUCCESS; @@ -1750,39 +1750,39 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { case TYPE_PAIR(IS_FALSE, IS_NULL): case TYPE_PAIR(IS_FALSE, IS_FALSE): case TYPE_PAIR(IS_TRUE, IS_TRUE): - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; case TYPE_PAIR(IS_NULL, IS_TRUE): - ZVAL_INT(result, -1); + ZVAL_LONG(result, -1); return SUCCESS; case TYPE_PAIR(IS_TRUE, IS_NULL): - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); return SUCCESS; case TYPE_PAIR(IS_STRING, IS_STRING): if (Z_STR_P(op1) == Z_STR_P(op2)) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } zendi_smart_strcmp(result, op1, op2); return SUCCESS; case TYPE_PAIR(IS_NULL, IS_STRING): - ZVAL_INT(result, Z_STRSIZE_P(op2) == 0 ? 0 : -1); + ZVAL_LONG(result, Z_STRLEN_P(op2) == 0 ? 0 : -1); return SUCCESS; case TYPE_PAIR(IS_STRING, IS_NULL): - ZVAL_INT(result, Z_STRSIZE_P(op1) == 0 ? 0 : 1); + ZVAL_LONG(result, Z_STRLEN_P(op1) == 0 ? 0 : 1); return SUCCESS; case TYPE_PAIR(IS_OBJECT, IS_NULL): - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); return SUCCESS; case TYPE_PAIR(IS_NULL, IS_OBJECT): - ZVAL_INT(result, -1); + ZVAL_LONG(result, -1); return SUCCESS; default: @@ -1803,11 +1803,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { if (Z_TYPE_P(op1) == IS_OBJECT && Z_TYPE_P(op2) == IS_OBJECT) { if (Z_OBJ_P(op1) == Z_OBJ_P(op2)) { /* object handles are identical, apparently this is the same object */ - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } if (Z_OBJ_HANDLER_P(op1, compare_objects) == Z_OBJ_HANDLER_P(op2, compare_objects)) { - ZVAL_INT(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2 TSRMLS_CC)); + ZVAL_LONG(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2 TSRMLS_CC)); return SUCCESS; } } @@ -1821,7 +1821,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) { ZVAL_UNDEF(&tmp_free); if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2)) TSRMLS_CC) == FAILURE) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); zend_free_obj_get_result(&tmp_free TSRMLS_CC); return SUCCESS; } @@ -1840,7 +1840,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) { ZVAL_UNDEF(&tmp_free); if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1)) TSRMLS_CC) == FAILURE) { - ZVAL_INT(result, -1); + ZVAL_LONG(result, -1); zend_free_obj_get_result(&tmp_free TSRMLS_CC); return SUCCESS; } @@ -1848,26 +1848,26 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { zend_free_obj_get_result(&tmp_free TSRMLS_CC); return ret; } else if (Z_TYPE_P(op1) == IS_OBJECT) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); return SUCCESS; } } if (!converted) { if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) { zendi_convert_to_boolean(op2, op2_copy, result); - ZVAL_INT(result, (Z_TYPE_P(op2) == IS_TRUE) ? -1 : 0); + ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? -1 : 0); return SUCCESS; } else if (Z_TYPE_P(op2) == IS_NULL || Z_TYPE_P(op2) == IS_FALSE) { zendi_convert_to_boolean(op1, op1_copy, result); - ZVAL_INT(result, (Z_TYPE_P(op1) == IS_TRUE) ? 1 : 0); + ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 1 : 0); return SUCCESS; } else if (Z_TYPE_P(op1) == IS_TRUE) { zendi_convert_to_boolean(op2, op2_copy, result); - ZVAL_INT(result, (Z_TYPE_P(op2) == IS_TRUE) ? 0 : 1); + ZVAL_LONG(result, (Z_TYPE_P(op2) == IS_TRUE) ? 0 : 1); return SUCCESS; } else if (Z_TYPE_P(op2) == IS_TRUE) { zendi_convert_to_boolean(op1, op1_copy, result); - ZVAL_INT(result, (Z_TYPE_P(op1) == IS_TRUE) ? 0 : -1); + ZVAL_LONG(result, (Z_TYPE_P(op1) == IS_TRUE) ? 0 : -1); return SUCCESS; } else { zendi_convert_scalar_to_number(op1, op1_copy, result); @@ -1875,19 +1875,19 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { converted = 1; } } else if (Z_TYPE_P(op1)==IS_ARRAY) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); return SUCCESS; } else if (Z_TYPE_P(op2)==IS_ARRAY) { - ZVAL_INT(result, -1); + ZVAL_LONG(result, -1); return SUCCESS; } else if (Z_TYPE_P(op1)==IS_OBJECT) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); return SUCCESS; } else if (Z_TYPE_P(op2)==IS_OBJECT) { - ZVAL_INT(result, -1); + ZVAL_LONG(result, -1); return SUCCESS; } else { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return FAILURE; } } @@ -1925,8 +1925,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) case IS_TRUE: ZVAL_BOOL(result, 1); break; - case IS_INT: - ZVAL_BOOL(result, Z_IVAL_P(op1) == Z_IVAL_P(op2)); + case IS_LONG: + ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2)); break; case IS_RESOURCE: ZVAL_BOOL(result, Z_RES_P(op1) == Z_RES_P(op2)); @@ -1938,8 +1938,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (Z_STR_P(op1) == Z_STR_P(op2)) { ZVAL_BOOL(result, 1); } else { - ZVAL_BOOL(result, (Z_STRSIZE_P(op1) == Z_STRSIZE_P(op2)) - && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)))); + 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: @@ -1976,7 +1976,7 @@ ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - ZVAL_BOOL(result, (Z_IVAL_P(result) == 0)); + ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); return SUCCESS; } /* }}} */ @@ -1986,7 +1986,7 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - ZVAL_BOOL(result, (Z_IVAL_P(result) != 0)); + ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); return SUCCESS; } /* }}} */ @@ -1996,7 +1996,7 @@ ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - ZVAL_BOOL(result, (Z_IVAL_P(result) < 0)); + ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); return SUCCESS; } /* }}} */ @@ -2006,7 +2006,7 @@ ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSR if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { return FAILURE; } - ZVAL_BOOL(result, (Z_IVAL_P(result) <= 0)); + ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); return SUCCESS; } /* }}} */ @@ -2046,27 +2046,27 @@ ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, cons static void increment_string(zval *str) /* {{{ */ { int carry=0; - zend_size_t pos=Z_STRSIZE_P(str)-1; + size_t pos=Z_STRLEN_P(str)-1; char *s; zend_string *t; int last=0; /* Shut up the compiler warning */ int ch; - if (Z_STRSIZE_P(str) == 0) { - STR_RELEASE(Z_STR_P(str)); - Z_STR_P(str) = STR_INIT("1", sizeof("1")-1, 0); + if (Z_STRLEN_P(str) == 0) { + zend_string_release(Z_STR_P(str)); + Z_STR_P(str) = zend_string_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_STRSIZE_P(str), 0); + Z_STR_P(str) = zend_string_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_STRSIZE_P(str), 0); + Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0); } else { - STR_FORGET_HASH_VAL(Z_STR_P(str)); + zend_string_forget_hash_val(Z_STR_P(str)); } s = Z_STRVAL_P(str); @@ -2110,9 +2110,9 @@ static void increment_string(zval *str) /* {{{ */ } if (carry) { - t = STR_ALLOC(Z_STRSIZE_P(str)+1, 0); - memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRSIZE_P(str)); - t->val[Z_STRSIZE_P(str) + 1] = '\0'; + t = zend_string_alloc(Z_STRLEN_P(str)+1, 0); + memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRLEN_P(str)); + t->val[Z_STRLEN_P(str) + 1] = '\0'; switch (last) { case NUMERIC: t->val[0] = '1'; @@ -2124,7 +2124,7 @@ static void increment_string(zval *str) /* {{{ */ t->val[0] = 'a'; break; } - STR_FREE(Z_STR_P(str)); + zend_string_free(Z_STR_P(str)); ZVAL_NEW_STR(str, t); } } @@ -2134,38 +2134,38 @@ ZEND_API int increment_function(zval *op1) /* {{{ */ { try_again: switch (Z_TYPE_P(op1)) { - case IS_INT: - if (Z_IVAL_P(op1) == ZEND_INT_MAX) { + case IS_LONG: + if (Z_LVAL_P(op1) == ZEND_INT_MAX) { /* switch to double */ - double d = (double)Z_IVAL_P(op1); + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d+1); } else { - Z_IVAL_P(op1)++; + Z_LVAL_P(op1)++; } break; case IS_DOUBLE: Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; break; case IS_NULL: - ZVAL_INT(op1, 1); + ZVAL_LONG(op1, 1); break; case IS_STRING: { - zend_int_t lval; + zend_long lval; double dval; - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { - case IS_INT: - STR_RELEASE(Z_STR_P(op1)); + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { + case IS_LONG: + zend_string_release(Z_STR_P(op1)); if (lval == ZEND_INT_MAX) { /* switch to double */ double d = (double)lval; ZVAL_DOUBLE(op1, d+1); } else { - ZVAL_INT(op1, lval+1); + ZVAL_LONG(op1, lval+1); } break; case IS_DOUBLE: - STR_RELEASE(Z_STR_P(op1)); + zend_string_release(Z_STR_P(op1)); ZVAL_DOUBLE(op1, dval+1); break; default: @@ -2181,7 +2181,7 @@ try_again: int res; TSRMLS_FETCH(); - ZVAL_INT(&op2, 1); + ZVAL_LONG(&op2, 1); res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, &op2 TSRMLS_CC); zval_ptr_dtor(&op2); @@ -2200,40 +2200,40 @@ try_again: ZEND_API int decrement_function(zval *op1) /* {{{ */ { - zend_int_t lval; + zend_long lval; double dval; try_again: switch (Z_TYPE_P(op1)) { - case IS_INT: - if (Z_IVAL_P(op1) == ZEND_INT_MIN) { - double d = (double)Z_IVAL_P(op1); + case IS_LONG: + if (Z_LVAL_P(op1) == ZEND_INT_MIN) { + double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d-1); } else { - Z_IVAL_P(op1)--; + Z_LVAL_P(op1)--; } break; case IS_DOUBLE: Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; break; case IS_STRING: /* Like perl we only support string increment */ - if (Z_STRSIZE_P(op1) == 0) { /* consider as 0 */ - STR_RELEASE(Z_STR_P(op1)); - ZVAL_INT(op1, -1); + if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ + zend_string_release(Z_STR_P(op1)); + ZVAL_LONG(op1, -1); break; } - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { - case IS_INT: - STR_RELEASE(Z_STR_P(op1)); + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { + case IS_LONG: + zend_string_release(Z_STR_P(op1)); if (lval == ZEND_INT_MIN) { double d = (double)lval; ZVAL_DOUBLE(op1, d-1); } else { - ZVAL_INT(op1, lval-1); + ZVAL_LONG(op1, lval-1); } break; case IS_DOUBLE: - STR_RELEASE(Z_STR_P(op1)); + zend_string_release(Z_STR_P(op1)); ZVAL_DOUBLE(op1, dval - 1); break; } @@ -2244,7 +2244,7 @@ try_again: int res; TSRMLS_FETCH(); - ZVAL_INT(&op2, 1); + ZVAL_LONG(&op2, 1); res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, &op2 TSRMLS_CC); zval_ptr_dtor(&op2); @@ -2277,7 +2277,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */ /* }}} */ #endif -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t length) /* {{{ */ +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, size_t length) /* {{{ */ { register unsigned char *str = (unsigned char*)source; register unsigned char *result = (unsigned char*)dest; @@ -2292,13 +2292,13 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t } /* }}} */ -ZEND_API char *zend_str_tolower_dup(const char *source, zend_size_t length) /* {{{ */ +ZEND_API char *zend_str_tolower_dup(const char *source, size_t length) /* {{{ */ { return zend_str_tolower_copy((char *)emalloc(length+1), source, length); } /* }}} */ -ZEND_API void zend_str_tolower(char *str, zend_size_t length) /* {{{ */ +ZEND_API void zend_str_tolower(char *str, size_t length) /* {{{ */ { register unsigned char *p = (unsigned char*)str; register unsigned char *end = p + length; @@ -2310,7 +2310,7 @@ ZEND_API void zend_str_tolower(char *str, zend_size_t length) /* {{{ */ } /* }}} */ -ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */ +ZEND_API int zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */ { int retval; @@ -2326,7 +2326,7 @@ ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2 } /* }}} */ -ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */ +ZEND_API int zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */ { int retval; @@ -2342,9 +2342,9 @@ ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s } /* }}} */ -ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */ { - zend_size_t len; + size_t len; int c1, c2; if (s1 == s2) { @@ -2364,9 +2364,9 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char } /* }}} */ -ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */ { - zend_size_t len; + size_t len; int c1, c2; if (s1 == s2) { @@ -2385,9 +2385,9 @@ ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const cha } /* }}} */ -ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2) /* {{{ */ { - zend_size_t len; + size_t len; int c1, c2; if (s1 == s2) { @@ -2407,9 +2407,9 @@ ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const ch } /* }}} */ -ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length) /* {{{ */ { - zend_size_t len; + size_t len; int c1, c2; if (s1 == s2) { @@ -2430,25 +2430,25 @@ ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const c ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); + return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_IVAL_P(s3)); + return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); + return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_IVAL_P(s3)); + return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ @@ -2456,11 +2456,11 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ { int ret1, ret2; int oflow1, oflow2; - zend_int_t lval1 = 0, lval2 = 0; + zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; - if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), &lval1, &dval1, 0, &oflow1)) && - (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRSIZE_P(s2), &lval2, &dval2, 0, &oflow2))) { + if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && + (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { #if ZEND_UINT_MAX == 0xFFFFFFFF if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) @@ -2476,13 +2476,13 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ if (ret1!=IS_DOUBLE) { if (oflow2) { /* 2nd operand is integer > LONG_MAX (oflow2==1) or < LONG_MIN (-1) */ - ZVAL_INT(result, -1 * oflow2); + ZVAL_LONG(result, -1 * oflow2); return; } dval1 = (double) lval1; } else if (ret2!=IS_DOUBLE) { if (oflow1) { - ZVAL_INT(result, oflow1); + ZVAL_LONG(result, oflow1); return; } dval2 = (double) lval2; @@ -2492,14 +2492,14 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ goto string_cmp; } Z_DVAL_P(result) = dval1 - dval2; - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result))); } else { /* they both have to be long's */ - ZVAL_INT(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0)); + ZVAL_LONG(result, lval1 > lval2 ? 1 : (lval1 < lval2 ? -1 : 0)); } } else { string_cmp: - Z_IVAL_P(result) = zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); - ZVAL_INT(result, ZEND_NORMALIZE_BOOL(Z_IVAL_P(result))); + Z_LVAL_P(result) = zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); + ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(result))); } } /* }}} */ @@ -2511,7 +2511,7 @@ static int hash_zval_compare_function(zval *z1, zval *z2 TSRMLS_DC) /* {{{ */ if (compare_function(&result, z1, z2 TSRMLS_CC)==FAILURE) { return 1; } - return Z_IVAL(result); + return Z_LVAL(result); } /* }}} */ @@ -2523,7 +2523,7 @@ ZEND_API int zend_compare_symbol_tables_i(HashTable *ht1, HashTable *ht2 TSRMLS_ ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC) /* {{{ */ { - ZVAL_INT(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); + ZVAL_LONG(result, ht1 == ht2 ? 0 : zend_hash_compare(ht1, ht2, (compare_func_t) hash_zval_compare_function, 0 TSRMLS_CC)); } /* }}} */ @@ -2536,14 +2536,14 @@ 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) /* {{{ */ { if (Z_OBJ_P(o1) == Z_OBJ_P(o2)) { - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return; } if (Z_OBJ_HT_P(o1)->compare_objects == NULL) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); } else { - ZVAL_INT(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)); } } /* }}} */ @@ -2558,16 +2558,16 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */ } /* }}} */ -ZEND_API zend_string *zend_int_to_str(zend_int_t num) /* {{{ */ +ZEND_API zend_string *zend_longo_str(zend_long num) /* {{{ */ { - char buf[MAX_LENGTH_OF_ZEND_INT + 1]; + char buf[MAX_LENGTH_OF_LONG + 1]; char *res; - _zend_print_signed_to_buf(buf + sizeof(buf) - 1, num, zend_uint_t, res); - return STR_INIT(res, buf + sizeof(buf) - 1 - res, 0); + _zend_print_signed_to_buf(buf + sizeof(buf) - 1, num, zend_ulong, res); + return zend_string_init(res, buf + sizeof(buf) - 1 - res, 0); } /* }}} */ -ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_int_t *lval, double *dval) { +ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) { return is_numeric_string_ex(str->val, str->len, lval, dval, -1, NULL); } diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 3ed9b9fb4d..6eba27a9e4 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -41,7 +41,7 @@ #include "ext/bcmath/libbcmath/src/bcmath.h" #endif -#define LONG_SIGN_MASK (((zend_int_t)1) << (8*sizeof(zend_int_t)-1)) +#define LONG_SIGN_MASK (((zend_long)1) << (8*sizeof(zend_long)-1)) BEGIN_EXTERN_C() ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); @@ -71,10 +71,10 @@ ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, c ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC); END_EXTERN_C() -#if ZEND_DVAL_TO_IVAL_CAST_OK -# define zend_dval_to_ival(d) ((zend_int_t) (d)) +#if ZEND_DVAL_TO_LVAL_CAST_OK +# define zend_dval_to_lval(d) ((zend_long) (d)) #elif SIZEOF_ZEND_INT == 4 -static zend_always_inline zend_int_t zend_dval_to_ival(double d) +static zend_always_inline zend_long zend_dval_to_lval(double d) { if (d > ZEND_INT_MAX || d < ZEND_INT_MIN) { double two_pow_32 = pow(2., 32.), @@ -86,12 +86,12 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d) * to simulate rounding towards 0 of the negative number */ dmod = ceil(dmod) + two_pow_32; } - return (zend_int_t)(zend_uint_t)dmod; + return (zend_long)(zend_ulong)dmod; } - return (zend_int_t)d; + return (zend_long)d; } #else -static zend_always_inline zend_int_t zend_dval_to_ival(double d) +static zend_always_inline zend_long zend_dval_to_lval(double d) { /* >= as (double)ZEND_INT_MAX is outside signed range */ if (d >= ZEND_INT_MAX || d < ZEND_INT_MIN) { @@ -104,9 +104,9 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d) * fractional part, hence dmod does not have one either */ dmod += two_pow_64; } - return (zend_int_t)(zend_uint_t)dmod; + return (zend_long)(zend_ulong)dmod; } - return (zend_int_t)d; + return (zend_long)d; } #endif /* }}} */ @@ -119,7 +119,7 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d) * of allow_errors determines whether it's required to be entirely numeric, or * just its prefix. Leading whitespace is allowed. * - * The function returns 0 if the string did not contain a valid number; IS_INT + * The function returns 0 if the string did not contain a valid number; IS_LONG * if it contained a number that fits within the range of a long; or IS_DOUBLE * if the number was out of long range or contained a decimal point/exponent. * The number's value is returned into the respective pointer, *lval or *dval, @@ -129,7 +129,7 @@ static zend_always_inline zend_int_t zend_dval_to_ival(double d) * could not be represented as such due to overflow. It writes 1 to oflow_info * if the integer is larger than ZEND_INT_MAX and -1 if it's smaller than ZEND_INT_MIN. */ -static inline zend_uchar is_numeric_string_ex(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors, int *oflow_info) +static inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info) { const char *ptr; int base = 10, digits = 0, dp_or_e = 0; @@ -172,7 +172,7 @@ static inline zend_uchar is_numeric_string_ex(const char *str, zend_size_t lengt /* Count the number of digits. If a decimal point/exponent is found, * it's a double. Otherwise, if there's a dval or no need to check for * a full match, stop when there are too many digits for a long */ - for (type = IS_INT; !(digits >= MAX_LENGTH_OF_ZEND_INT && (dval || allow_errors == 1)); digits++, ptr++) { + for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) { check_digits: if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) { continue; @@ -195,7 +195,7 @@ check_digits: } if (base == 10) { - if (digits >= MAX_LENGTH_OF_ZEND_INT) { + if (digits >= MAX_LENGTH_OF_LONG) { if (oflow_info != NULL) { *oflow_info = *str == '-' ? -1 : 1; } @@ -236,9 +236,9 @@ process_double: } } - if (type == IS_INT) { - if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strcmp(&ptr[-digits], int_min_digits); + if (type == IS_LONG) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strcmp(&ptr[-digits], long_min_digits); if (!(cmp < 0 || (cmp == 0 && *str == '-'))) { if (dval) { @@ -256,7 +256,7 @@ process_double: *lval = ZEND_STRTOI(str, NULL, base); } - return IS_INT; + return IS_LONG; } else { if (dval) { *dval = local_dval; @@ -266,26 +266,26 @@ process_double: } } -static inline zend_uchar is_numeric_string(const char *str, zend_size_t length, zend_int_t *lval, double *dval, int allow_errors) { +static inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors) { return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL); } -ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_int_t *lval, double *dval); +ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval); static inline const char * -zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, char *end) +zend_memnstr(const char *haystack, const char *needle, size_t needle_len, char *end) { const char *p = haystack; const char ne = needle[needle_len-1]; ptrdiff_t off_p; - zend_size_t off_s; + size_t off_s; if (needle_len == 1) { return (char *)memchr(p, *needle, (end-p)); } off_p = end - haystack; - off_s = (off_p > 0) ? (zend_size_t)off_p : 0; + off_s = (off_p > 0) ? (size_t)off_p : 0; if (needle_len > off_s) { return NULL; } @@ -309,7 +309,7 @@ zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, c return NULL; } -static inline const void *zend_memrchr(const void *s, int c, zend_size_t n) +static inline const void *zend_memrchr(const void *s, int c, size_t n) { register const unsigned char *e; @@ -344,21 +344,21 @@ ZEND_API void multi_convert_to_int_ex(int argc, ...); ZEND_API void multi_convert_to_double_ex(int argc, ...); ZEND_API void multi_convert_to_string_ex(int argc, ...); -ZEND_API zend_int_t _zval_get_int_func(zval *op TSRMLS_DC); +ZEND_API zend_long _zval_get_long_func(zval *op TSRMLS_DC); ZEND_API double _zval_get_double_func(zval *op TSRMLS_DC); ZEND_API zend_string *_zval_get_string_func(zval *op TSRMLS_DC); -static zend_always_inline zend_int_t _zval_get_int(zval *op TSRMLS_DC) { - return Z_TYPE_P(op) == IS_INT ? Z_IVAL_P(op) : _zval_get_int_func(op TSRMLS_CC); +static zend_always_inline zend_long _zval_get_long(zval *op TSRMLS_DC) { + return Z_TYPE_P(op) == IS_LONG ? Z_LVAL_P(op) : _zval_get_long_func(op TSRMLS_CC); } static zend_always_inline double _zval_get_double(zval *op TSRMLS_DC) { return Z_TYPE_P(op) == IS_DOUBLE ? Z_DVAL_P(op) : _zval_get_double_func(op TSRMLS_CC); } static zend_always_inline zend_string *_zval_get_string(zval *op TSRMLS_DC) { - return Z_TYPE_P(op) == IS_STRING ? STR_COPY(Z_STR_P(op)) : _zval_get_string_func(op TSRMLS_CC); + return Z_TYPE_P(op) == IS_STRING ? zend_string_copy(Z_STR_P(op)) : _zval_get_string_func(op TSRMLS_CC); } -#define zval_get_int(op) _zval_get_int((op) TSRMLS_CC) +#define zval_get_long(op) _zval_get_long((op) TSRMLS_CC) #define zval_get_double(op) _zval_get_double((op) TSRMLS_CC) #define zval_get_string(op) _zval_get_string((op) TSRMLS_CC) @@ -379,20 +379,20 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #endif -ZEND_API void zend_str_tolower(char *str, zend_size_t length); -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_size_t length); -ZEND_API char *zend_str_tolower_dup(const char *source, zend_size_t length); +ZEND_API void zend_str_tolower(char *str, size_t length); +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, size_t length); +ZEND_API char *zend_str_tolower_dup(const char *source, size_t length); ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_strcmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2); -ZEND_API int zend_binary_strncmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length); -ZEND_API int zend_binary_strcasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2); -ZEND_API int zend_binary_strncasecmp(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length); -ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2); -ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_size_t len1, const char *s2, zend_size_t len2, zend_size_t length); +ZEND_API int zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2); +ZEND_API int zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); +ZEND_API int zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2); +ZEND_API int zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); +ZEND_API int zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2); +ZEND_API int zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); @@ -400,7 +400,7 @@ 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); ZEND_API int zend_atoi(const char *str, int str_len); -ZEND_API zend_int_t zend_atol(const char *str, int str_len); +ZEND_API zend_long zend_atol(const char *str, int str_len); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() @@ -417,7 +417,7 @@ END_EXTERN_C() case IS_NULL: \ convert_to_null(pzv); \ break; \ - case IS_INT: \ + case IS_LONG: \ convert_to_int(pzv); \ break; \ case IS_DOUBLE: \ @@ -448,7 +448,7 @@ END_EXTERN_C() } #define convert_to_boolean_ex(pzv) convert_to_ex_master(pzv, boolean, _IS_BOOL) -#define convert_to_int_ex(pzv) convert_to_ex_master(pzv, int, IS_INT) +#define convert_to_int_ex(pzv) convert_to_ex_master(pzv, int, IS_LONG) #define convert_to_double_ex(pzv) convert_to_ex_master(pzv, double, IS_DOUBLE) #define convert_to_string_ex(pzv) convert_to_ex_master(pzv, string, IS_STRING) #define convert_to_array_ex(pzv) convert_to_ex_master(pzv, array, IS_ARRAY) @@ -456,7 +456,7 @@ END_EXTERN_C() #define convert_to_null_ex(pzv) convert_to_ex_master(pzv, null, IS_NULL) #define convert_scalar_to_number_ex(pzv) \ - if (Z_TYPE_P(pzv)!=IS_INT && Z_TYPE_P(pzv)!=IS_DOUBLE) { \ + if (Z_TYPE_P(pzv)!=IS_LONG && Z_TYPE_P(pzv)!=IS_DOUBLE) { \ SEPARATE_ZVAL_IF_NOT_REF(pzv); \ convert_scalar_to_number(pzv TSRMLS_CC); \ } @@ -480,7 +480,7 @@ ZEND_API void zend_update_current_locale(void); static zend_always_inline int fast_increment_function(zval *op1) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { #if defined(__GNUC__) && defined(__i386__) __asm__( "incl (%0)\n\t" @@ -508,11 +508,11 @@ static zend_always_inline int fast_increment_function(zval *op1) "n"(ZVAL_OFFSETOF_TYPE) : "cc"); #else - if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MAX)) { + if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MAX)) { /* switch to double */ ZVAL_DOUBLE(op1, (double)ZEND_INT_MAX + 1.0); } else { - Z_IVAL_P(op1)++; + Z_LVAL_P(op1)++; } #endif return SUCCESS; @@ -522,7 +522,7 @@ static zend_always_inline int fast_increment_function(zval *op1) static zend_always_inline int fast_decrement_function(zval *op1) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { #if defined(__GNUC__) && defined(__i386__) __asm__( "decl (%0)\n\t" @@ -550,11 +550,11 @@ static zend_always_inline int fast_decrement_function(zval *op1) "n"(ZVAL_OFFSETOF_TYPE) : "cc"); #else - if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MIN)) { + if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MIN)) { /* switch to double */ ZVAL_DOUBLE(op1, (double)ZEND_INT_MIN - 1.0); } else { - Z_IVAL_P(op1)--; + Z_LVAL_P(op1)--; } #endif return SUCCESS; @@ -564,8 +564,8 @@ static zend_always_inline int fast_decrement_function(zval *op1) static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { #if defined(__GNUC__) && defined(__i386__) __asm__( "movl (%1), %%eax\n\t" @@ -585,7 +585,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o : "r"(&result->value), "r"(&op1->value), "r"(&op2->value), - "n"(IS_INT), + "n"(IS_LONG), "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "eax","cc"); @@ -608,7 +608,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o : "r"(&result->value), "r"(&op1->value), "r"(&op2->value), - "n"(IS_INT), + "n"(IS_LONG), "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "rax","cc"); @@ -619,24 +619,24 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o * have read the values of op1 and op2. */ - if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK) - && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != ((Z_IVAL_P(op1) + Z_IVAL_P(op2)) & LONG_SIGN_MASK))) { - ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) + (double) Z_IVAL_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(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) { + ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); } else { - ZVAL_INT(result, Z_IVAL_P(op1) + Z_IVAL_P(op2)); + ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2)); } #endif return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) + Z_DVAL_P(op2)); + 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)) { ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); return SUCCESS; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -645,8 +645,8 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { #if defined(__GNUC__) && defined(__i386__) __asm__( "movl (%1), %%eax\n\t" @@ -670,7 +670,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o : "r"(&result->value), "r"(&op1->value), "r"(&op2->value), - "n"(IS_INT), + "n"(IS_LONG), "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "eax","cc"); @@ -697,29 +697,29 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o : "r"(&result->value), "r"(&op1->value), "r"(&op2->value), - "n"(IS_INT), + "n"(IS_LONG), "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "rax","cc"); #else - ZVAL_INT(result, Z_IVAL_P(op1) - Z_IVAL_P(op2)); + ZVAL_LONG(result, Z_LVAL_P(op1) - Z_LVAL_P(op2)); - if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(op2) & LONG_SIGN_MASK) - && (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(result) & LONG_SIGN_MASK))) { - ZVAL_DOUBLE(result, (double) Z_IVAL_P(op1) - (double) Z_IVAL_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))) { + 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)) { - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) - Z_DVAL_P(op2)); + 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)) { ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); return SUCCESS; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -728,23 +728,23 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - zend_int_t overflow; + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + zend_long overflow; - ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1), Z_IVAL_P(op2), Z_IVAL_P(result), Z_DVAL_P(result), overflow); - Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_INT; + ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow); + Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG; return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) * Z_DVAL_P(op2)); + 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)) { ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); return SUCCESS; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -754,20 +754,20 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { #if 0 - if (EXPECTED(Z_TYPE_P(op1) == IS_INT) && 0) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; - } else if (UNEXPECTED(Z_IVAL_P(op2) == -1 && Z_IVAL_P(op1) == ZEND_INT_MIN)) { + } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_INT_MIN)) { /* Prevent overflow error/crash */ ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1); - } else if (EXPECTED(Z_IVAL_P(op1) % Z_IVAL_P(op2) == 0)) { + } else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) { /* integer */ - ZVAL_INT(result, Z_IVAL_P(op1) / Z_IVAL_P(op2)); + ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); } else { - ZVAL_DOUBLE(result, ((double) Z_IVAL_P(op1)) / ((double)Z_IVAL_P(op2))); + ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2))); } return SUCCESS; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { @@ -776,7 +776,7 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o ZVAL_BOOL(result, 0); return FAILURE; } - ZVAL_DOUBLE(result, ((double)Z_IVAL_P(op1)) / Z_DVAL_P(op2)); + ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2)); return SUCCESS; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) { @@ -788,13 +788,13 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o } ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); return SUCCESS; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; } - ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_IVAL_P(op2))); + ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2))); return SUCCESS; } } @@ -804,18 +804,18 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + if (UNEXPECTED(Z_LVAL_P(op2) == 0)) { zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; - } else if (UNEXPECTED(Z_IVAL_P(op2) == -1)) { + } else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) { /* Prevent overflow error/crash if op1==ZEND_INT_MIN */ - ZVAL_INT(result, 0); + ZVAL_LONG(result, 0); return SUCCESS; } - ZVAL_INT(result, Z_IVAL_P(op1) % Z_IVAL_P(op2)); + ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2)); return SUCCESS; } } @@ -824,54 +824,54 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o static zend_always_inline int fast_equal_check_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - return Z_IVAL_P(op1) == Z_IVAL_P(op2); + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + return Z_LVAL_P(op1) == Z_LVAL_P(op2); } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - return ((double)Z_IVAL_P(op1)) == Z_DVAL_P(op2); + return ((double)Z_LVAL_P(op1)) == Z_DVAL_P(op2); } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { return Z_DVAL_P(op1) == Z_DVAL_P(op2); - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - return Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2)); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)); } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { if (Z_STR_P(op1) == Z_STR_P(op2)) { return 1; } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { - if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) { return 0; } else { - return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) == 0; + return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0; } } else { zendi_smart_strcmp(result, op1, op2); - return Z_IVAL_P(result) == 0; + return Z_LVAL_P(result) == 0; } } } compare_function(result, op1, op2 TSRMLS_CC); - return Z_IVAL_P(result) == 0; + return Z_LVAL_P(result) == 0; } static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_IVAL_P(op1) == Z_IVAL_P(op2)); + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2)); return; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_BOOL(result, (double)Z_IVAL_P(op1) == Z_DVAL_P(op2)); + ZVAL_BOOL(result, (double)Z_LVAL_P(op1) == Z_DVAL_P(op2)); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2)); return; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2))); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { @@ -880,40 +880,40 @@ static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval ZVAL_TRUE(result); return; } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { - if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) { ZVAL_FALSE(result); return; } else { - ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) == 0); + ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0); return; } } else { zendi_smart_strcmp(result, op1, op2); - ZVAL_BOOL(result, Z_IVAL_P(result) == 0); + ZVAL_BOOL(result, Z_LVAL_P(result) == 0); return; } } } compare_function(result, op1, op2 TSRMLS_CC); - ZVAL_BOOL(result, Z_IVAL_P(result) == 0); + ZVAL_BOOL(result, Z_LVAL_P(result) == 0); } static zend_always_inline void fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_IVAL_P(op1) != Z_IVAL_P(op2)); + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_LVAL_P(op1) != Z_LVAL_P(op2)); return; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_BOOL(result, (double)Z_IVAL_P(op1) != Z_DVAL_P(op2)); + ZVAL_BOOL(result, (double)Z_LVAL_P(op1) != Z_DVAL_P(op2)); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2)); return; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2))); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { @@ -922,68 +922,68 @@ static zend_always_inline void fast_not_equal_function(zval *result, zval *op1, ZVAL_FALSE(result); return; } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { - if (Z_STRSIZE_P(op1) != Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) { ZVAL_TRUE(result); return; } else { - ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)) != 0); + ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0); return; } } else { zendi_smart_strcmp(result, op1, op2); - ZVAL_BOOL(result, Z_IVAL_P(result) != 0); + ZVAL_BOOL(result, Z_LVAL_P(result) != 0); return; } } } compare_function(result, op1, op2 TSRMLS_CC); - ZVAL_BOOL(result, Z_IVAL_P(result) != 0); + ZVAL_BOOL(result, Z_LVAL_P(result) != 0); } static zend_always_inline void fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_IVAL_P(op1) < Z_IVAL_P(op2)); + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_LVAL_P(op1) < Z_LVAL_P(op2)); return; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_BOOL(result, (double)Z_IVAL_P(op1) < Z_DVAL_P(op2)); + ZVAL_BOOL(result, (double)Z_LVAL_P(op1) < Z_DVAL_P(op2)); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2)); return; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2))); return; } } compare_function(result, op1, op2 TSRMLS_CC); - ZVAL_BOOL(result, Z_IVAL_P(result) < 0); + ZVAL_BOOL(result, Z_LVAL_P(result) < 0); } static zend_always_inline void fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) { - if (EXPECTED(Z_TYPE_P(op1) == IS_INT)) { - if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_IVAL_P(op1) <= Z_IVAL_P(op2)); + if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_LVAL_P(op1) <= Z_LVAL_P(op2)); return; } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { - ZVAL_BOOL(result, (double)Z_IVAL_P(op1) <= Z_DVAL_P(op2)); + ZVAL_BOOL(result, (double)Z_LVAL_P(op1) <= Z_DVAL_P(op2)); return; } } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2)); return; - } else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { - ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_IVAL_P(op2))); + } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2))); return; } } compare_function(result, op1, op2 TSRMLS_CC); - ZVAL_BOOL(result, Z_IVAL_P(result) <= 0); + ZVAL_BOOL(result, Z_LVAL_P(result) <= 0); } static zend_always_inline void fast_is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) @@ -1045,7 +1045,7 @@ static zend_always_inline void fast_is_not_identical_function(zval *result, zval } \ } while (0) -ZEND_API zend_string *zend_int_to_str(zend_int_t num); +ZEND_API zend_string *zend_longo_str(zend_long num); #endif diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index b144432db9..7824ee1f83 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -236,7 +236,7 @@ ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t /* *buf[size] is zeroed automatically by the kernel */ *buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0); if (*buf != MAP_FAILED) { - zend_int_t offset = ftell(file_handle->handle.fp); + zend_long offset = ftell(file_handle->handle.fp); file_handle->handle.stream.mmap.map = *buf; if (offset != -1) { diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 5a4f4e1fc5..132c98f740 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -29,7 +29,7 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC); static void zend_interned_strings_snapshot_int(TSRMLS_D); static void zend_interned_strings_restore_int(TSRMLS_D); -ZEND_API zend_uint_t zend_hash_func(const char *str, zend_size_t len) +ZEND_API zend_ulong zend_hash_func(const char *str, size_t len) { return zend_inline_hash_func(str, len); } @@ -54,13 +54,13 @@ void zend_interned_strings_init(TSRMLS_D) memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(zend_uint)); /* interned empty string */ - str = STR_ALLOC(sizeof("")-1, 1); + str = zend_string_alloc(sizeof("")-1, 1); str->val[0] = '\000'; CG(empty_string) = zend_new_interned_string_int(str TSRMLS_CC); #else - str = STR_ALLOC(sizeof("")-1, 1); + str = zend_string_alloc(sizeof("")-1, 1); str->val[0] = '\000'; - STR_HASH_VAL(str); + zend_string_hash_val(str); str->gc.u.v.flags |= IS_STR_INTERNED; CG(empty_string) = str; #endif @@ -85,7 +85,7 @@ void zend_interned_strings_dtor(TSRMLS_D) static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC) { #ifndef ZTS - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -94,14 +94,14 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC) return str; } - h = STR_HASH_VAL(str); + h = zend_string_hash_val(str); nIndex = h & CG(interned_strings).nTableMask; idx = CG(interned_strings).arHash[nIndex]; while (idx != INVALID_IDX) { p = CG(interned_strings).arData + idx; if ((p->h == h) && (p->key->len == str->len)) { if (!memcmp(p->key->val, str->val, str->len)) { - STR_RELEASE(str); + zend_string_release(str); return p->key; } } @@ -182,7 +182,7 @@ static void zend_interned_strings_restore_int(TSRMLS_D) GC_FLAGS(p->key) &= ~IS_STR_INTERNED; GC_REFCOUNT(p->key) = 1; - STR_FREE(p->key); + zend_string_free(p->key); nIndex = p->h & CG(interned_strings).nTableMask; if (CG(interned_strings).arHash[nIndex] == idx) { diff --git a/Zend/zend_string.h b/Zend/zend_string.h index f30ae29941..5655402661 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -29,7 +29,7 @@ ZEND_API extern zend_string *(*zend_new_interned_string)(zend_string *str TSRMLS ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); -ZEND_API zend_uint_t zend_hash_func(const char *str, zend_size_t len); +ZEND_API zend_ulong zend_hash_func(const char *str, size_t len); void zend_interned_strings_init(TSRMLS_D); void zend_interned_strings_dtor(TSRMLS_D); @@ -37,21 +37,6 @@ END_EXTERN_C() #define IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED) -#define STR_HASH_VAL(s) zend_str_hash_val(s) -#define STR_FORGET_HASH_VAL(s) zend_str_forget_hash_val(s) - -#define STR_REFCOUNT(s) zend_str_refcount(s) -#define STR_ADDREF(s) zend_str_addref(s) -#define STR_DELREF(s) zend_str_delref(s) -#define STR_ALLOC(len, persistent) zend_str_alloc(len, persistent) -#define STR_SAFE_ALLOC(n, m, l, p) zend_str_safe_alloc(n, m, l, p) -#define STR_INIT(str, len, persistent) zend_str_init(str, len, persistent) -#define STR_COPY(s) zend_str_copy(s) -#define STR_DUP(s, persistent) zend_str_dup(s, persistent) -#define STR_REALLOC(s, len, persistent) zend_str_realloc(s, len, persistent) -#define STR_SAFE_REALLOC(s, n, m, l, p) zend_str_safe_realloc(s, n, m, l, p) -#define STR_FREE(s) zend_str_free(s) -#define STR_RELEASE(s) zend_str_release(s) #define STR_EMPTY_ALLOC() CG(empty_string) #define _STR_HEADER_SIZE XtOffsetOf(zend_string, val) @@ -70,7 +55,7 @@ END_EXTERN_C() #define STR_ALLOCA_FREE(str, use_heap) free_alloca(str, use_heap) -static zend_always_inline zend_uint_t zend_str_hash_val(zend_string *s) +static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s) { if (!s->h) { s->h = zend_hash_func(s->val, s->len); @@ -78,12 +63,12 @@ static zend_always_inline zend_uint_t zend_str_hash_val(zend_string *s) return s->h; } -static zend_always_inline void zend_str_forget_hash_val(zend_string *s) +static zend_always_inline void zend_string_forget_hash_val(zend_string *s) { s->h = 0; } -static zend_always_inline zend_uint zend_str_refcount(zend_string *s) +static zend_always_inline zend_uint zend_string_refcount(zend_string *s) { if (!IS_INTERNED(s)) { return GC_REFCOUNT(s); @@ -91,7 +76,7 @@ static zend_always_inline zend_uint zend_str_refcount(zend_string *s) return 1; } -static zend_always_inline zend_uint zend_str_addref(zend_string *s) +static zend_always_inline zend_uint zend_string_addref(zend_string *s) { if (!IS_INTERNED(s)) { return ++GC_REFCOUNT(s); @@ -99,7 +84,7 @@ static zend_always_inline zend_uint zend_str_addref(zend_string *s) return 1; } -static zend_always_inline zend_uint zend_str_delref(zend_string *s) +static zend_always_inline zend_uint zend_string_delref(zend_string *s) { if (!IS_INTERNED(s)) { return --GC_REFCOUNT(s); @@ -107,7 +92,7 @@ static zend_always_inline zend_uint zend_str_delref(zend_string *s) return 1; } -static zend_always_inline zend_string *zend_str_alloc(zend_size_t len, int persistent) +static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent) { zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent); @@ -125,7 +110,7 @@ static zend_always_inline zend_string *zend_str_alloc(zend_size_t len, int persi return ret; } -static zend_always_inline zend_string *zend_str_safe_alloc(size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent) { zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + l + 1), persistent); @@ -143,82 +128,82 @@ static zend_always_inline zend_string *zend_str_safe_alloc(size_t n, size_t m, s return ret; } -static zend_always_inline zend_string *zend_str_init(const char *str, zend_size_t len, int persistent) +static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent) { - zend_string *ret = STR_ALLOC(len, persistent); + zend_string *ret = zend_string_alloc(len, persistent); memcpy(ret->val, str, len); ret->val[len] = '\0'; return ret; } -static zend_always_inline zend_string *zend_str_copy(zend_string *s) +static zend_always_inline zend_string *zend_string_copy(zend_string *s) { if (!IS_INTERNED(s)) { - STR_ADDREF(s); + zend_string_addref(s); } return s; } -static zend_always_inline zend_string *zend_str_dup(zend_string *s, int persistent) +static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) { if (IS_INTERNED(s)) { return s; } else { - return STR_INIT(s->val, s->len, persistent); + return zend_string_init(s->val, s->len, persistent); } } -static zend_always_inline zend_string *zend_str_realloc(zend_string *s, zend_size_t len, int persistent) +static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent) { zend_string *ret; if (IS_INTERNED(s)) { - ret = STR_ALLOC(len, persistent); + ret = zend_string_alloc(len, persistent); memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1); - } else if (EXPECTED(STR_REFCOUNT(s) == 1)) { + } else if (EXPECTED(zend_string_refcount(s) == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent); ret->len = len; - STR_FORGET_HASH_VAL(ret); + zend_string_forget_hash_val(ret); } else { - ret = STR_ALLOC(len, persistent); + ret = zend_string_alloc(len, persistent); memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1); - STR_DELREF(s); + zend_string_delref(s); } return ret; } -static zend_always_inline zend_string *zend_str_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent) +static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent) { zend_string *ret; if (IS_INTERNED(s)) { - ret = STR_SAFE_ALLOC(n, m, l, persistent); + ret = zend_string_safe_alloc(n, m, l, persistent); memcpy(ret->val, s->val, ((n * m) + l > (size_t)s->len ? (size_t)s->len : ((n * m) + l)) + 1); - } else if (STR_REFCOUNT(s) == 1) { + } else if (zend_string_refcount(s) == 1) { ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + l + 1), persistent); ret->len = (n * m) + l; - STR_FORGET_HASH_VAL(ret); + zend_string_forget_hash_val(ret); } else { - ret = STR_SAFE_ALLOC(n, m, l, persistent); + ret = zend_string_safe_alloc(n, m, l, persistent); memcpy(ret->val, s->val, ((n * m) + l > (size_t)s->len ? (size_t)s->len : ((n * m) + l)) + 1); - STR_DELREF(s); + zend_string_delref(s); } return ret; } -static zend_always_inline void zend_str_free(zend_string *s) +static zend_always_inline void zend_string_free(zend_string *s) { if (!IS_INTERNED(s)) { - ZEND_ASSERT(STR_REFCOUNT(s) <= 1); + ZEND_ASSERT(zend_string_refcount(s) <= 1); pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); } } -static zend_always_inline void zend_str_release(zend_string *s) +static zend_always_inline void zend_string_release(zend_string *s) { if (!IS_INTERNED(s)) { - if (STR_DELREF(s) == 0) { + if (zend_string_delref(s) == 0) { pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); } } @@ -257,9 +242,9 @@ static zend_always_inline void zend_str_release(zend_string *s) * -- Ralf S. Engelschall <rse@engelschall.com> */ -static inline zend_uint_t zend_inline_hash_func(const char *str, zend_size_t len) +static inline zend_ulong zend_inline_hash_func(const char *str, size_t len) { - register zend_uint_t hash = Z_UI(5381); + register zend_ulong hash = Z_UI(5381); /* variant with the hash unrolled eight times */ for (; len >= 8; len -= 8) { diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index 9d55933e0a..b289ae17c9 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -110,7 +110,7 @@ ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zv return retval; } -ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC) +ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC) { zval *retval; @@ -187,7 +187,7 @@ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_uint_t h) +ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h) { int retval; @@ -209,7 +209,7 @@ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t h) +ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong h) { zval *retval; @@ -231,7 +231,7 @@ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key) return retval; } -ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h) +ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h) { int retval; diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h index ceb7cbf1fe..45ac51495c 100644 --- a/Zend/zend_ts_hash.h +++ b/Zend/zend_ts_hash.h @@ -55,7 +55,7 @@ ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zv #define zend_ts_hash_add(ht, key, pData) \ _zend_ts_hash_add_or_update(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC) -ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_uint_t h, zval *pData, int flag ZEND_FILE_LINE_DC); +ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, zend_ulong h, zval *pData, int flag ZEND_FILE_LINE_DC); #define zend_ts_hash_index_update(ht, h, pData) \ _zend_ts_hash_index_update_or_next_insert(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_ts_hash_next_index_insert(ht, pData) \ @@ -73,15 +73,15 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun /* Deletes */ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key); -ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_uint_t h); +ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, zend_ulong h); /* Data retreival */ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key); -ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_uint_t); +ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, zend_ulong); /* Misc */ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key); -ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_uint_t h); +ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, zend_ulong h); /* Copying, merging and sorting */ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index f5d7a6ea7d..3927ba6f0c 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -42,8 +42,7 @@ typedef unsigned char zend_bool; typedef unsigned char zend_uchar; -typedef unsigned int zend_uint; -typedef unsigned long zend_ulong; +typedef uint32_t zend_uint; typedef unsigned short zend_ushort; #ifdef ZEND_ENABLE_INT64 @@ -59,7 +58,6 @@ typedef unsigned short zend_ushort; # define ZEND_SIZE_MAX SIZE_MAX # endif #endif -typedef size_t zend_size_t; #define HAVE_ZEND_LONG64 #ifdef ZEND_WIN32 @@ -104,7 +102,7 @@ typedef void (*dtor_func_t)(zval *pDest); typedef void (*copy_ctor_func_t)(zval *pElement); typedef union _zend_value { - zend_int_t lval; /* long value */ + zend_long lval; /* long value */ double dval; /* double value */ zend_refcounted *counted; zend_string *str; @@ -154,13 +152,13 @@ struct _zend_refcounted { struct _zend_string { zend_refcounted gc; - zend_uint_t h; /* hash value */ - zend_size_t len; + zend_ulong h; /* hash value */ + size_t len; char val[1]; }; typedef struct _Bucket { - zend_uint_t h; /* hash value (or numeric index) */ + zend_ulong h; /* hash value (or numeric index) */ zend_string *key; /* string key or NULL for numerics */ zval val; } Bucket; @@ -170,7 +168,7 @@ typedef struct _HashTable { zend_uint nTableMask; zend_uint nNumUsed; zend_uint nNumOfElements; - zend_int_t nNextFreeElement; + zend_long nNextFreeElement; Bucket *arData; zend_uint *arHash; dtor_func_t pDestructor; @@ -203,7 +201,7 @@ struct _zend_object { struct _zend_resource { zend_refcounted gc; - zend_int_t handle; // TODO: may be removed ??? + zend_long handle; // TODO: may be removed ??? int type; void *ptr; }; @@ -223,7 +221,7 @@ struct _zend_ast_ref { #define IS_NULL 1 #define IS_FALSE 2 #define IS_TRUE 3 -#define IS_INT 4 +#define IS_LONG 4 #define IS_DOUBLE 5 #define IS_STRING 6 #define IS_ARRAY 7 @@ -398,8 +396,8 @@ static inline zend_uchar zval_get_type(const zval* pz) { #define Z_ISNULL(zval) (Z_TYPE(zval) == IS_NULL) #define Z_ISNULL_P(zval_p) Z_ISNULL(*(zval_p)) -#define Z_IVAL(zval) (zval).value.lval -#define Z_IVAL_P(zval_p) Z_IVAL(*(zval_p)) +#define Z_LVAL(zval) (zval).value.lval +#define Z_LVAL_P(zval_p) Z_LVAL(*(zval_p)) #define Z_DVAL(zval) (zval).value.dval #define Z_DVAL_P(zval_p) Z_DVAL(*(zval_p)) @@ -410,8 +408,8 @@ static inline zend_uchar zval_get_type(const zval* pz) { #define Z_STRVAL(zval) Z_STR(zval)->val #define Z_STRVAL_P(zval_p) Z_STRVAL(*(zval_p)) -#define Z_STRSIZE(zval) Z_STR(zval)->len -#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*(zval_p)) +#define Z_STRLEN(zval) Z_STR(zval)->len +#define Z_STRLEN_P(zval_p) Z_STRLEN(*(zval_p)) #define Z_STRHASH(zval) Z_STR(zval)->h #define Z_STRHASH_P(zval_p) Z_STRHASH(*(zval_p)) @@ -500,10 +498,10 @@ static inline zend_uchar zval_get_type(const zval* pz) { (b) ? IS_TRUE : IS_FALSE; \ } while (0) -#define ZVAL_INT(z, l) { \ +#define ZVAL_LONG(z, l) { \ zval *__z = (z); \ - Z_IVAL_P(__z) = l; \ - Z_TYPE_INFO_P(__z) = IS_INT; \ + Z_LVAL_P(__z) = l; \ + Z_TYPE_INFO_P(__z) = IS_LONG; \ } #define ZVAL_DOUBLE(z, d) { \ @@ -522,7 +520,7 @@ static inline zend_uchar zval_get_type(const zval* pz) { IS_STRING_EX; \ } while (0) -#define ZVAL_INT_STR(z, s) do { \ +#define ZVAL_LONG_STR(z, s) do { \ zval *__z = (z); \ zend_string *__s = (s); \ Z_STR_P(__z) = __s; \ diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 1c10a1451f..1ec3ffb7ca 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -34,7 +34,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) case IS_CONSTANT: { zend_string *str = (zend_string*)p; CHECK_ZVAL_STRING_REL(str); - STR_RELEASE(str); + zend_string_release(str); break; } case IS_ARRAY: { @@ -94,7 +94,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) case IS_CONSTANT: { zend_string *str = (zend_string*)p; CHECK_ZVAL_STRING_REL(str); - STR_FREE(str); + zend_string_free(str); break; } case IS_ARRAY: { @@ -150,7 +150,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); break; case IS_ARRAY: case IS_CONSTANT_AST: @@ -165,7 +165,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) free(ref); break; } - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: @@ -181,7 +181,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC) case IS_STRING: case IS_CONSTANT: CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); - STR_FREE(Z_STR_P(zvalue)); + zend_string_free(Z_STR_P(zvalue)); break; case IS_ARRAY: case IS_CONSTANT_AST: @@ -196,7 +196,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC) free(ref); break; } - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: @@ -234,7 +234,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) case IS_CONSTANT: case IS_STRING: CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); - Z_STR_P(zvalue) = STR_DUP(Z_STR_P(zvalue), 0); + Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0); break; case IS_ARRAY: { HashTable *ht; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 1d56cb95f5..a31f40b128 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -178,7 +178,7 @@ static int php_check_dots(const char *element, int n) #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) typedef struct { - zend_uint_t ReparseTag; + zend_ulong ReparseTag; unsigned short ReparseDataLength; unsigned short Reserved; union { @@ -187,7 +187,7 @@ typedef struct { unsigned short SubstituteNameLength; unsigned short PrintNameOffset; unsigned short PrintNameLength; - zend_uint_t Flags; + zend_ulong Flags; wchar_t ReparseTarget[1]; } SymbolicLinkReparseBuffer; struct { @@ -582,9 +582,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */ /* }}} */ #ifdef PHP_WIN32 -static inline zend_uint_t realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ +static inline zend_ulong realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ { - register zend_uint_t h; + register zend_ulong h; char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); @@ -602,9 +602,9 @@ static inline zend_uint_t realpath_cache_key(const char *path, int path_len TSRM } /* }}} */ #else -static inline zend_uint_t realpath_cache_key(const char *path, int path_len) /* {{{ */ +static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* {{{ */ { - register zend_uint_t h; + register zend_ulong h; const char *e = path + path_len; for (h = Z_UI(2166136261); path < e;) { @@ -637,11 +637,11 @@ CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_ulong key = realpath_cache_key(path, path_len TSRMLS_CC); #else - zend_uint_t key = realpath_cache_key(path, path_len); + zend_ulong key = realpath_cache_key(path, path_len); #endif - zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -668,7 +668,7 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */ { - zend_int_t size = sizeof(realpath_cache_bucket) + path_len + 1; + zend_long size = sizeof(realpath_cache_bucket) + path_len + 1; int same = 1; if (realpath_len != path_len || @@ -679,7 +679,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) { realpath_cache_bucket *bucket = malloc(size); - zend_uint_t n; + zend_ulong n; if (bucket == NULL) { return; @@ -719,12 +719,12 @@ static inline void realpath_cache_add(const char *path, int path_len, const char static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_ulong key = realpath_cache_key(path, path_len TSRMLS_CC); #else - zend_uint_t key = realpath_cache_key(path, path_len); + zend_ulong key = realpath_cache_key(path, path_len); #endif - zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_ulong n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -756,12 +756,12 @@ CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_ } /* }}} */ -CWD_API zend_int_t realpath_cache_size(TSRMLS_D) +CWD_API zend_long realpath_cache_size(TSRMLS_D) { return CWDG(realpath_cache_size); } -CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D) +CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D) { return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); } diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 7c56686f2a..b439d3eaa7 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -211,7 +211,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC); #define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */ typedef struct _realpath_cache_bucket { - zend_uint_t key; + zend_ulong key; char *path; int path_len; char *realpath; @@ -229,9 +229,9 @@ typedef struct _realpath_cache_bucket { typedef struct _virtual_cwd_globals { cwd_state cwd; - zend_int_t realpath_cache_size; - zend_int_t realpath_cache_size_limit; - zend_int_t realpath_cache_ttl; + zend_long realpath_cache_size; + zend_long realpath_cache_size_limit; + zend_long realpath_cache_ttl; realpath_cache_bucket *realpath_cache[1024]; } virtual_cwd_globals; @@ -246,8 +246,8 @@ extern virtual_cwd_globals cwd_globals; CWD_API void realpath_cache_clean(TSRMLS_D); CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC); CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC); -CWD_API zend_int_t realpath_cache_size(TSRMLS_D); -CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D); +CWD_API zend_long realpath_cache_size(TSRMLS_D); +CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D); CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D); /* The actual macros to be used in programs using TSRM diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 6b61c58ef9..6fd4dba65d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -867,7 +867,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) SAVE_OPLINE(); var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_increment_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -922,7 +922,7 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) SAVE_OPLINE(); var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_decrement_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -977,7 +977,7 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY) SAVE_OPLINE(); var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_increment_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -1031,7 +1031,7 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY) SAVE_OPLINE(); var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_decrement_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -1096,7 +1096,7 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY) { USE_OPLINE - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO); } @@ -1116,7 +1116,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -1131,7 +1131,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } FREE_OP1(); CHECK_EXCEPTION(); @@ -1198,7 +1198,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } if (OP1_TYPE != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -2412,16 +2412,16 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) ZVAL_DEREF(function_name); if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (Z_STRVAL_P(function_name)[0] == '\\') { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); + lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name)); } - STR_FREE(lcname); + zend_string_free(lcname); FREE_OP2(); fbc = Z_FUNC_P(func); called_scope = NULL; @@ -2768,7 +2768,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY) zend_vm_stack_free_call_frame(call TSRMLS_CC); if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - STR_RELEASE(fbc->common.function_name); + zend_string_release(fbc->common.function_name); } efree(fbc); @@ -3630,7 +3630,7 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, &EX(func)->op_array, execute_data TSRMLS_CC); ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk); } @@ -3641,7 +3641,7 @@ ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, &EX(func)->op_array, execute_data TSRMLS_CC); ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont); } @@ -3653,7 +3653,7 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->extended_value, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value, &EX(func)->op_array, execute_data TSRMLS_CC); brk_opline = EX(func)->op_array.opcodes + el->brk; @@ -3815,7 +3815,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv)); } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3823,7 +3823,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); + ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3886,10 +3886,10 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value); } ZVAL_DUP(EX_VAR(opline->result.var), value); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STR(EX_VAR(opline->result.var), ce->name); - STR_ADDREF(ce->name); + zend_string_addref(ce->name); } else { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); } @@ -3938,15 +3938,15 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS zend_free_op free_op2; zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); zend_string *str; - zend_uint_t hval; + zend_ulong hval; ZEND_VM_C_LABEL(add_again): switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); ZEND_VM_C_GOTO(num_index); - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); ZEND_VM_C_LABEL(num_index): zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -4049,8 +4049,8 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) case _IS_BOOL: ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); break; - case IS_INT: - ZVAL_INT(result, zval_get_int(expr)); + case IS_LONG: + ZVAL_LONG(result, zval_get_long(expr)); break; case IS_DOUBLE: ZVAL_DOUBLE(result, zval_get_double(expr)); @@ -4146,7 +4146,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) inc_filename = &tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -4159,7 +4159,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); } else { @@ -4329,7 +4329,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) zend_free_op free_op1, free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); @@ -4345,11 +4345,11 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) ZEND_VM_C_LABEL(offset_again): switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); ZEND_VM_C_LABEL(num_index_dim): zend_hash_index_del(ht, hval); break; @@ -4610,12 +4610,12 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) zend_object *zobj = Z_OBJ_P(array_ptr); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); if (key_type != HASH_KEY_NON_EXISTENT && - (key_type == HASH_KEY_IS_INT || + (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) { break; } @@ -4674,7 +4674,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) zend_object *zobj = Z_OBJ_P(array); int key_type; zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var)); @@ -4695,15 +4695,15 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); zend_hash_move_forward(fe_ht); - if (key_type == HASH_KEY_IS_INT || + if (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } } if (key) { - if (key_type == HASH_KEY_IS_INT) { - ZVAL_INT(key, int_key); + if (key_type == HASH_KEY_IS_LONG) { + ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; int prop_name_len; @@ -4769,7 +4769,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) HANDLE_EXCEPTION(); } } else { - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } } break; @@ -4874,7 +4874,7 @@ ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV zend_free_op free_op1, free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -4896,14 +4896,14 @@ ZEND_VM_C_LABEL(isset_again): } ZEND_VM_C_LABEL(str_index_prop): value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); ZEND_VM_C_LABEL(num_index_prop): value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); ZEND_VM_C_GOTO(num_index_prop); case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -4948,20 +4948,20 @@ ZEND_VM_C_LABEL(num_index_prop): zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -5025,8 +5025,8 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY) zend_free_op free_op1; zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -5042,9 +5042,9 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) USE_OPLINE SAVE_OPLINE(); - ZVAL_INT(EX_VAR(opline->result.var), EG(error_reporting)); + ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting)); if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { - ZVAL_INT(&EX(old_error_reporting), EG(error_reporting)); + ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting)); } if (EG(error_reporting)) { @@ -5090,13 +5090,13 @@ ZEND_VM_HANDLER(142, ZEND_RAISE_ABSTRACT_ERROR, ANY, ANY) ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) { USE_OPLINE - char buf[MAX_LENGTH_OF_ZEND_INT + 1]; + char buf[MAX_LENGTH_OF_LONG + 1]; char *res; SAVE_OPLINE(); - if (!EG(error_reporting) && Z_IVAL_P(EX_VAR(opline->op1.var)) != 0) { - EG(error_reporting) = Z_IVAL_P(EX_VAR(opline->op1.var)); - _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_uint_t, res); + if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) { + EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var)); + _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_ulong, res); if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) { if (EXPECTED(EG(error_reporting_ini_entry)->modified && EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { @@ -5465,15 +5465,15 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } /* restore previous error_reporting value */ - if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_IVAL(EX(old_error_reporting)) != 0) { + if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) { zval restored_error_reporting; zend_string *key; - ZVAL_INT(&restored_error_reporting, Z_IVAL(EX(old_error_reporting))); + ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting))); convert_to_string(&restored_error_reporting); - key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0); - zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); - STR_FREE(key); + key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0); + zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_string_free(key); zval_dtor(&restored_error_reporting); } ZVAL_UNDEF(&EX(old_error_reporting)); @@ -5571,7 +5571,7 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) } } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = STR_DUP(Z_STR_P(name), 0); + c.name = zend_string_dup(Z_STR_P(name), 0); c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -5726,15 +5726,15 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -5873,24 +5873,24 @@ ZEND_VM_HANDLER(121, ZEND_STRLEN, CONST|TMP|VAR|CV, ANY) SAVE_OPLINE(); value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { - ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value)); + ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value)); } else { if (Z_TYPE_P(value) < IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 0); + ZVAL_LONG(EX_VAR(opline->result.var), 0); } else if (Z_TYPE_P(value) == IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); } else if (Z_TYPE_P(value) <= IS_DOUBLE) { zend_string *str = zval_get_string(value); - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else if (Z_TYPE_P(value) == IS_OBJECT) { zend_string *str; if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { ZEND_VM_C_GOTO(strlen_error); } - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else { ZEND_VM_C_LABEL(strlen_error): zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value))); @@ -5912,7 +5912,7 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY) value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); switch (opline->extended_value) { case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_ARRAY: diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 89b6c7e0d3..9885f2e3e4 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -661,7 +661,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_vm_stack_free_call_frame(call TSRMLS_CC); if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - STR_RELEASE(fbc->common.function_name); + zend_string_release(fbc->common.function_name); } efree(fbc); @@ -1110,9 +1110,9 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR USE_OPLINE SAVE_OPLINE(); - ZVAL_INT(EX_VAR(opline->result.var), EG(error_reporting)); + ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting)); if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { - ZVAL_INT(&EX(old_error_reporting), EG(error_reporting)); + ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting)); } if (EG(error_reporting)) { @@ -1367,15 +1367,15 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } /* restore previous error_reporting value */ - if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_IVAL(EX(old_error_reporting)) != 0) { + if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) { zval restored_error_reporting; zend_string *key; - ZVAL_INT(&restored_error_reporting, Z_IVAL(EX(old_error_reporting))); + ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting))); convert_to_string(&restored_error_reporting); - key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0); - zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); - STR_FREE(key); + key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0); + zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_string_free(key); zval_dtor(&restored_error_reporting); } ZVAL_UNDEF(&EX(old_error_reporting)); @@ -1583,16 +1583,16 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE ZVAL_DEREF(function_name); if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (Z_STRVAL_P(function_name)[0] == '\\') { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); + lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name)); } - STR_FREE(lcname); + zend_string_free(lcname); fbc = Z_FUNC_P(func); called_scope = NULL; @@ -1769,7 +1769,7 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, &EX(func)->op_array, execute_data TSRMLS_CC); ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk); } @@ -1780,7 +1780,7 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->op1.opline_num, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, &EX(func)->op_array, execute_data TSRMLS_CC); ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont); } @@ -1792,7 +1792,7 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_brk_cont_element *el; SAVE_OPLINE(); - el = zend_brk_cont(Z_IVAL_P(opline->op2.zv), opline->extended_value, + el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value, &EX(func)->op_array, execute_data TSRMLS_CC); brk_opline = EX(func)->op_array.opcodes + el->brk; @@ -1912,16 +1912,16 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H ZVAL_DEREF(function_name); if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (Z_STRVAL_P(function_name)[0] == '\\') { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); + lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name)); } - STR_FREE(lcname); + zend_string_free(lcname); zval_dtor(free_op2.var); fbc = Z_FUNC_P(func); called_scope = NULL; @@ -2086,16 +2086,16 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H ZVAL_DEREF(function_name); if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (Z_STRVAL_P(function_name)[0] == '\\') { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); + lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name)); } - STR_FREE(lcname); + zend_string_free(lcname); zval_ptr_dtor_nogc(free_op2.var); fbc = Z_FUNC_P(func); called_scope = NULL; @@ -2298,16 +2298,16 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA ZVAL_DEREF(function_name); if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (Z_STRVAL_P(function_name)[0] == '\\') { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); + lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { - lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); } if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name)); } - STR_FREE(lcname); + zend_string_free(lcname); fbc = Z_FUNC_P(func); called_scope = NULL; @@ -2441,7 +2441,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS { USE_OPLINE - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -2868,8 +2868,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case _IS_BOOL: ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); break; - case IS_INT: - ZVAL_INT(result, zval_get_int(expr)); + case IS_LONG: + ZVAL_LONG(result, zval_get_long(expr)); break; case IS_DOUBLE: ZVAL_DOUBLE(result, zval_get_double(expr)); @@ -2963,7 +2963,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA inc_filename = &tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -2976,7 +2976,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); } else { @@ -3227,12 +3227,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_object *zobj = Z_OBJ_P(array_ptr); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); if (key_type != HASH_KEY_NON_EXISTENT && - (key_type == HASH_KEY_IS_INT || + (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) { break; } @@ -3267,8 +3267,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *ptr = opline->op1.zv; - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -3378,24 +3378,24 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG SAVE_OPLINE(); value = opline->op1.zv; if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { - ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value)); + ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value)); } else { if (Z_TYPE_P(value) < IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 0); + ZVAL_LONG(EX_VAR(opline->result.var), 0); } else if (Z_TYPE_P(value) == IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); } else if (Z_TYPE_P(value) <= IS_DOUBLE) { zend_string *str = zval_get_string(value); - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else if (Z_TYPE_P(value) == IS_OBJECT) { zend_string *str; if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { goto strlen_error; } - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else { strlen_error: zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value))); @@ -3417,7 +3417,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER value = opline->op1.zv; switch (opline->extended_value) { case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_ARRAY: @@ -3769,7 +3769,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -3784,7 +3784,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -3851,7 +3851,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -4130,7 +4130,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv)); } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -4138,7 +4138,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); + ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -4201,10 +4201,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value); } ZVAL_DUP(EX_VAR(opline->result.var), value); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STR(EX_VAR(opline->result.var), ce->name); - STR_ADDREF(ce->name); + zend_string_addref(ce->name); } else { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); } @@ -4253,15 +4253,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O zval *offset = opline->op2.zv; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -4507,7 +4507,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD } } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = STR_DUP(Z_STR_P(name), 0); + c.name = zend_string_dup(Z_STR_P(name), 0); c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -4617,15 +4617,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -5168,15 +5168,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -5347,15 +5347,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -5684,7 +5684,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -5699,7 +5699,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -5766,7 +5766,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -6051,15 +6051,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC zend_free_op free_op2; zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -6382,15 +6382,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -6444,7 +6444,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -6459,7 +6459,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -6526,7 +6526,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } if (IS_CONST != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -6736,15 +6736,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ zval *offset = NULL; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -7092,15 +7092,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -7679,15 +7679,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -7858,15 +7858,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -7950,7 +7950,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -8392,8 +8392,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case _IS_BOOL: ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); break; - case IS_INT: - ZVAL_INT(result, zval_get_int(expr)); + case IS_LONG: + ZVAL_LONG(result, zval_get_long(expr)); break; case IS_DOUBLE: ZVAL_DOUBLE(result, zval_get_double(expr)); @@ -8488,7 +8488,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND inc_filename = &tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -8501,7 +8501,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); } else { @@ -8752,12 +8752,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = Z_OBJ_P(array_ptr); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); if (key_type != HASH_KEY_NON_EXISTENT && - (key_type == HASH_KEY_IS_INT || + (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) { break; } @@ -8792,8 +8792,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; zval *ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -8807,13 +8807,13 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - char buf[MAX_LENGTH_OF_ZEND_INT + 1]; + char buf[MAX_LENGTH_OF_LONG + 1]; char *res; SAVE_OPLINE(); - if (!EG(error_reporting) && Z_IVAL_P(EX_VAR(opline->op1.var)) != 0) { - EG(error_reporting) = Z_IVAL_P(EX_VAR(opline->op1.var)); - _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_uint_t, res); + if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) { + EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var)); + _zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_ulong, res); if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) { if (EXPECTED(EG(error_reporting_ini_entry)->modified && EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { @@ -8952,24 +8952,24 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { - ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value)); + ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value)); } else { if (Z_TYPE_P(value) < IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 0); + ZVAL_LONG(EX_VAR(opline->result.var), 0); } else if (Z_TYPE_P(value) == IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); } else if (Z_TYPE_P(value) <= IS_DOUBLE) { zend_string *str = zval_get_string(value); - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else if (Z_TYPE_P(value) == IS_OBJECT) { zend_string *str; if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { goto strlen_error; } - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else { strlen_error: zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value))); @@ -8991,7 +8991,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); switch (opline->extended_value) { case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_ARRAY: @@ -9323,7 +9323,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -9338,7 +9338,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_dtor(free_op1.var); CHECK_EXCEPTION(); @@ -9405,7 +9405,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -9661,15 +9661,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC zval *offset = opline->op2.zv; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -9992,15 +9992,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -10500,15 +10500,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -10679,15 +10679,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -11016,7 +11016,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -11031,7 +11031,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_dtor(free_op1.var); CHECK_EXCEPTION(); @@ -11098,7 +11098,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -11340,15 +11340,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD zend_free_op free_op2; zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -11671,15 +11671,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -11733,7 +11733,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -11748,7 +11748,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_dtor(free_op1.var); CHECK_EXCEPTION(); @@ -11815,7 +11815,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } if (IS_TMP_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -11909,15 +11909,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP zval *offset = NULL; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -12240,15 +12240,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -12730,15 +12730,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -12909,15 +12909,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -12990,7 +12990,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS SAVE_OPLINE(); var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_increment_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -13045,7 +13045,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS SAVE_OPLINE(); var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_decrement_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -13100,7 +13100,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG SAVE_OPLINE(); var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_increment_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -13154,7 +13154,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG SAVE_OPLINE(); var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_decrement_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -13219,7 +13219,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -13836,8 +13836,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case _IS_BOOL: ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); break; - case IS_INT: - ZVAL_INT(result, zval_get_int(expr)); + case IS_LONG: + ZVAL_LONG(result, zval_get_long(expr)); break; case IS_DOUBLE: ZVAL_DOUBLE(result, zval_get_double(expr)); @@ -13933,7 +13933,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND inc_filename = &tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -13946,7 +13946,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); } else { @@ -14197,12 +14197,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = Z_OBJ_P(array_ptr); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); if (key_type != HASH_KEY_NON_EXISTENT && - (key_type == HASH_KEY_IS_INT || + (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) { break; } @@ -14261,7 +14261,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = Z_OBJ_P(array); int key_type; zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var)); @@ -14282,15 +14282,15 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); zend_hash_move_forward(fe_ht); - if (key_type == HASH_KEY_IS_INT || + if (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { break; } } if (key) { - if (key_type == HASH_KEY_IS_INT) { - ZVAL_INT(key, int_key); + if (key_type == HASH_KEY_IS_LONG) { + ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; int prop_name_len; @@ -14356,7 +14356,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG HANDLE_EXCEPTION(); } } else { - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } } break; @@ -14385,8 +14385,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_free_op free_op1; zval *ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -14519,24 +14519,24 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); value = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { - ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value)); + ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value)); } else { if (Z_TYPE_P(value) < IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 0); + ZVAL_LONG(EX_VAR(opline->result.var), 0); } else if (Z_TYPE_P(value) == IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); } else if (Z_TYPE_P(value) <= IS_DOUBLE) { zend_string *str = zval_get_string(value); - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else if (Z_TYPE_P(value) == IS_OBJECT) { zend_string *str; if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { goto strlen_error; } - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else { strlen_error: zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value))); @@ -14558,7 +14558,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A value = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); switch (opline->extended_value) { case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_ARRAY: @@ -15419,7 +15419,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -15434,7 +15434,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); @@ -15501,7 +15501,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -16201,7 +16201,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv)); } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -16209,7 +16209,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); + ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -16272,10 +16272,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value); } ZVAL_DUP(EX_VAR(opline->result.var), value); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STR(EX_VAR(opline->result.var), ce->name); - STR_ADDREF(ce->name); + zend_string_addref(ce->name); } else { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); } @@ -16324,15 +16324,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC zval *offset = opline->op2.zv; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -16482,7 +16482,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND zend_free_op free_op1; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -16498,11 +16498,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -16690,7 +16690,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CONST_HANDLER(ZEND zend_free_op free_op1; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -16712,14 +16712,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -16764,20 +16764,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -16929,15 +16929,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -18463,15 +18463,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -18549,7 +18549,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE zend_free_op free_op1, free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -18565,11 +18565,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -18677,7 +18677,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_O zend_free_op free_op1, free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -18699,14 +18699,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -18751,20 +18751,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -18918,15 +18918,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -19792,7 +19792,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -19807,7 +19807,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); @@ -19874,7 +19874,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -20669,15 +20669,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD zend_free_op free_op2; zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -20827,7 +20827,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE zend_free_op free_op1, free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -20843,11 +20843,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -21035,7 +21035,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_O zend_free_op free_op1, free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -21057,14 +21057,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -21109,20 +21109,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -21276,15 +21276,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -21694,7 +21694,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -21709,7 +21709,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); @@ -21776,7 +21776,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } if (IS_VAR != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -22129,15 +22129,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP zval *offset = NULL; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -22479,15 +22479,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -24052,15 +24052,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -24138,7 +24138,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER zend_free_op free_op1; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -24154,11 +24154,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -24266,7 +24266,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OP zend_free_op free_op1; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -24288,14 +24288,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -24340,20 +24340,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -24505,15 +24505,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -24624,8 +24624,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS zval *ptr = NULL; - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -25478,7 +25478,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv)); } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -25486,7 +25486,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); + ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv))); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -25549,10 +25549,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value); } ZVAL_DUP(EX_VAR(opline->result.var), value); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STR(EX_VAR(opline->result.var), ce->name); - STR_ADDREF(ce->name); + zend_string_addref(ce->name); } else { zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); } @@ -25599,7 +25599,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -25615,11 +25615,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -25727,7 +25727,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CONST_HANDLER(Z zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -25749,14 +25749,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -25801,20 +25801,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -25965,15 +25965,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -26879,7 +26879,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN zend_free_op free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -26895,11 +26895,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -27007,7 +27007,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEN zend_free_op free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -27029,14 +27029,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -27081,20 +27081,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -27247,15 +27247,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -28161,7 +28161,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN zend_free_op free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -28177,11 +28177,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -28289,7 +28289,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEN zend_free_op free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -28311,14 +28311,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -28363,20 +28363,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -28529,15 +28529,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -29045,15 +29045,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -29952,7 +29952,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -29968,11 +29968,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -30080,7 +30080,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -30102,14 +30102,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -30154,20 +30154,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_UNUSED == IS_CV || IS_UNUSED == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -30318,15 +30318,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -30389,7 +30389,7 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_increment_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -30443,7 +30443,7 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { fast_decrement_function(var_ptr); if (RETURN_VALUE_USED(opline)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); @@ -30497,7 +30497,7 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS SAVE_OPLINE(); var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_increment_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -30550,7 +30550,7 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS SAVE_OPLINE(); var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC); - if (EXPECTED(Z_TYPE_P(var_ptr) == IS_INT)) { + if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) { ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); fast_decrement_function(var_ptr); ZEND_VM_NEXT_OPCODE(); @@ -30613,7 +30613,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); } @@ -31201,8 +31201,8 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) case _IS_BOOL: ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); break; - case IS_INT: - ZVAL_INT(result, zval_get_int(expr)); + case IS_LONG: + ZVAL_LONG(result, zval_get_long(expr)); break; case IS_DOUBLE: ZVAL_DOUBLE(result, zval_get_double(expr)); @@ -31296,7 +31296,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL inc_filename = &tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -31309,7 +31309,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); } else { @@ -31560,12 +31560,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_object *zobj = Z_OBJ_P(array_ptr); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { zend_string *str_key; - zend_uint_t int_key; + zend_ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); if (key_type != HASH_KEY_NON_EXISTENT && - (key_type == HASH_KEY_IS_INT || + (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) { break; } @@ -31600,8 +31600,8 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zval *ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); - if (Z_TYPE_P(ptr) == IS_INT) { - EG(exit_status) = Z_IVAL_P(ptr); + if (Z_TYPE_P(ptr) == IS_LONG) { + EG(exit_status) = Z_LVAL_P(ptr); } else { zend_print_variable(ptr TSRMLS_CC); } @@ -31732,24 +31732,24 @@ static int ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { - ZVAL_INT(EX_VAR(opline->result.var), Z_STRSIZE_P(value)); + ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value)); } else { if (Z_TYPE_P(value) < IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 0); + ZVAL_LONG(EX_VAR(opline->result.var), 0); } else if (Z_TYPE_P(value) == IS_TRUE) { - ZVAL_INT(EX_VAR(opline->result.var), 1); + ZVAL_LONG(EX_VAR(opline->result.var), 1); } else if (Z_TYPE_P(value) <= IS_DOUBLE) { zend_string *str = zval_get_string(value); - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else if (Z_TYPE_P(value) == IS_OBJECT) { zend_string *str; if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { goto strlen_error; } - ZVAL_INT(EX_VAR(opline->result.var), str->len); - STR_RELEASE(str); + ZVAL_LONG(EX_VAR(opline->result.var), str->len); + zend_string_release(str); } else { strlen_error: zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value))); @@ -31771,7 +31771,7 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); switch (opline->extended_value) { case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_STRING: case IS_ARRAY: @@ -32631,7 +32631,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -32646,7 +32646,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -32713,7 +32713,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -33322,15 +33322,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO zval *offset = opline->op2.zv; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -33480,7 +33480,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC); @@ -33496,11 +33496,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -33688,7 +33688,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_ zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -33710,14 +33710,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -33762,20 +33762,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_CV == IS_CV || IS_CV == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -33926,15 +33926,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -35372,15 +35372,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE zend_free_op free_op2; zval *offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -35458,7 +35458,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER zend_free_op free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC); @@ -35474,11 +35474,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -35586,7 +35586,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OP zend_free_op free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -35608,14 +35608,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -35660,20 +35660,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_CV == IS_CV || IS_CV == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -35826,15 +35826,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -36699,7 +36699,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -36714,7 +36714,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -36781,7 +36781,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -37458,15 +37458,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE zend_free_op free_op2; zval *offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -37616,7 +37616,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER zend_free_op free_op2; zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC); @@ -37632,11 +37632,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -37824,7 +37824,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OP zend_free_op free_op2; zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -37846,14 +37846,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -37898,20 +37898,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_CV == IS_CV || IS_CV == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -38064,15 +38064,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -38481,7 +38481,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, name = Z_STR_P(varname); } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { name = Z_STR_P(varname); - STR_ADDREF(name); + zend_string_addref(name); } else { name = zval_get_string(varname); } @@ -38496,7 +38496,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } CHECK_EXCEPTION(); @@ -38563,7 +38563,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } if (IS_CV != IS_CONST) { - STR_RELEASE(name); + zend_string_release(name); } ZEND_ASSERT(retval != NULL); @@ -38800,15 +38800,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC zval *offset = NULL; zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -39131,15 +39131,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { @@ -40585,15 +40585,15 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ zval *offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); zend_string *str; - zend_uint_t hval; + zend_ulong hval; add_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index: zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); break; @@ -40671,7 +40671,7 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ zval *container; zval *offset; - zend_uint_t hval; + zend_ulong hval; SAVE_OPLINE(); container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC); @@ -40687,11 +40687,11 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ offset_again: switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); zend_hash_index_del(ht, hval); break; - case IS_INT: - hval = Z_IVAL_P(offset); + case IS_LONG: + hval = Z_LVAL_P(offset); num_index_dim: zend_hash_index_del(ht, hval); break; @@ -40799,7 +40799,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPC zval *container; int result; - zend_uint_t hval; + zend_ulong hval; zval *offset; SAVE_OPLINE(); @@ -40821,14 +40821,14 @@ isset_again: } str_index_prop: value = zend_hash_find_ind(ht, str); - } else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { - hval = Z_IVAL_P(offset); + } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) { + hval = Z_LVAL_P(offset); num_index_prop: value = zend_hash_index_find(ht, hval); } else { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: - hval = zend_dval_to_ival(Z_DVAL_P(offset)); + hval = zend_dval_to_lval(Z_DVAL_P(offset)); goto num_index_prop; case IS_NULL: str = STR_EMPTY_ALLOC(); @@ -40873,20 +40873,20 @@ num_index_prop: zval tmp; result = 0; - if (UNEXPECTED(Z_TYPE_P(offset) != IS_INT)) { + if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) { if (IS_CV == IS_CV || IS_CV == IS_VAR) { ZVAL_DEREF(offset); } if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_INT == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { ZVAL_DUP(&tmp, offset); convert_to_int(&tmp); offset = &tmp; } } - if (Z_TYPE_P(offset) == IS_INT) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { + if (Z_TYPE_P(offset) == IS_LONG) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) { if ((opline->extended_value & ZEND_ISSET) || Z_STRVAL_P(container)[offset->value.lval] != '0') { result = 1; @@ -41037,15 +41037,15 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS ZVAL_COPY_VALUE(&generator->key, key); } - if (Z_TYPE(generator->key) == IS_INT - && Z_IVAL(generator->key) > generator->largest_used_integer_key + if (Z_TYPE(generator->key) == IS_LONG + && Z_LVAL(generator->key) > generator->largest_used_integer_key ) { - generator->largest_used_integer_key = Z_IVAL(generator->key); + generator->largest_used_integer_key = Z_LVAL(generator->key); } } else { /* If no key was specified we use auto-increment keys */ generator->largest_used_integer_key++; - ZVAL_INT(&generator->key, generator->largest_used_integer_key); + ZVAL_LONG(&generator->key, generator->largest_used_integer_key); } if (RETURN_VALUE_USED(opline)) { |