diff options
486 files changed, 11534 insertions, 11616 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)) { diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index b45a738a04..a6775c8c84 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -206,12 +206,12 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC) PHP_FUNCTION(bcadd) { char *left, *right; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second, result; int left_len, right_len; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -244,11 +244,11 @@ PHP_FUNCTION(bcsub) { char *left, *right; int left_len, right_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -281,11 +281,11 @@ PHP_FUNCTION(bcmul) { char *left, *right; int left_len, right_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -318,11 +318,11 @@ PHP_FUNCTION(bcdiv) { char *left, *right; int left_len, right_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -396,10 +396,10 @@ PHP_FUNCTION(bcpowmod) char *left, *right, *modulous; int left_len, right_len, modulous_len; bc_num first, second, mod, result; - php_int_t scale = BCG(bc_precision); + zend_long scale = BCG(bc_precision); int scale_int; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) { return; } @@ -436,11 +436,11 @@ PHP_FUNCTION(bcpow) { char *left, *right; int left_len, right_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -473,11 +473,11 @@ PHP_FUNCTION(bcsqrt) { char *left; int left_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "s|i", &left, &left_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) { return; } @@ -508,11 +508,11 @@ PHP_FUNCTION(bccomp) { char *left, *right; int left_len, right_len; - php_int_t scale_param = 0; + zend_long scale_param = 0; bc_num first, second; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -525,7 +525,7 @@ PHP_FUNCTION(bccomp) bc_str2num(&first, left, scale TSRMLS_CC); bc_str2num(&second, right, scale TSRMLS_CC); - RETVAL_INT(bc_compare(first, second)); + RETVAL_LONG(bc_compare(first, second)); bc_free_num(&first); bc_free_num(&second); @@ -537,9 +537,9 @@ PHP_FUNCTION(bccomp) Sets default scale parameter for all bc math functions */ PHP_FUNCTION(bcscale) { - php_int_t new_scale; + zend_long new_scale; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_scale) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) { return; } diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index 47990d2e92..e38bf87797 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -52,9 +52,9 @@ zend_string /* Allocate the string memory. */ signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ if (num->n_scale > 0) - str = STR_ALLOC(num->n_len + num->n_scale + signch + 1, 0); + str = zend_string_alloc(num->n_len + num->n_scale + signch + 1, 0); else - str = STR_ALLOC(num->n_len + signch, 0); + str = zend_string_alloc(num->n_len + signch, 0); if (str == NULL) bc_out_of_memory(); /* The negative sign if needed. */ diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h index 96f0baf189..df16410004 100644 --- a/ext/bcmath/php_bcmath.h +++ b/ext/bcmath/php_bcmath.h @@ -45,7 +45,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath) bc_num _zero_; bc_num _one_; bc_num _two_; - php_int_t bc_precision; + zend_long bc_precision; ZEND_END_MODULE_GLOBALS(bcmath) #ifdef ZTS diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index c6a03935d9..7696dbb93d 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -343,11 +343,11 @@ static PHP_MINFO_FUNCTION(bz2) static PHP_FUNCTION(bzread) { zval *bz; - php_int_t len = 1024; + zend_long len = 1024; php_stream *stream; zend_string *data; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &bz, &len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) { RETURN_FALSE; } @@ -357,11 +357,11 @@ static PHP_FUNCTION(bzread) php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative"); RETURN_FALSE; } - data = STR_ALLOC(len, 0); + data = zend_string_alloc(len, 0); data->len = php_stream_read(stream, data->val, data->len); if (data->len < 0) { - STR_FREE(data); + zend_string_free(data); php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream"); RETURN_FALSE; } @@ -393,7 +393,7 @@ static PHP_FUNCTION(bzopen) /* If it's not a resource its a string containing the filename to open */ if (Z_TYPE_P(file) == IS_STRING) { - if (Z_STRSIZE_P(file) == 0) { + if (Z_STRLEN_P(file) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty"); RETURN_FALSE; } @@ -490,8 +490,8 @@ static PHP_FUNCTION(bzerror) static PHP_FUNCTION(bzcompress) { char *source; /* Source data to compress */ - php_int_t zblock_size = 0; /* Optional block size to use */ - php_int_t zwork_factor = 0;/* Optional work factor to use */ + zend_long zblock_size = 0; /* Optional block size to use */ + zend_long zwork_factor = 0;/* Optional work factor to use */ zend_string *dest = NULL; /* Destination to place the compressed data into */ int error, /* Error Container */ block_size = 4, /* Block size for compression algorithm */ @@ -502,7 +502,7 @@ static PHP_FUNCTION(bzcompress) argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) { return; } @@ -513,7 +513,7 @@ static PHP_FUNCTION(bzcompress) dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600); /* Allocate the destination buffer */ - dest = STR_ALLOC(dest_len, 0); + dest = zend_string_alloc(dest_len, 0); /* Handle the optional arguments */ if (argc > 1) { @@ -526,8 +526,8 @@ static PHP_FUNCTION(bzcompress) error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor); if (error != BZ_OK) { - STR_FREE(dest); - RETURN_INT(error); + zend_string_free(dest); + RETURN_LONG(error); } else { /* Copy the buffer, we have perhaps allocate a lot more than we need, so we erealloc() the buffer to the proper size */ @@ -544,7 +544,7 @@ static PHP_FUNCTION(bzdecompress) { char *source, *dest; int source_len, error; - php_int_t small = 0; + zend_long small = 0; #if defined(PHP_WIN32) unsigned __int64 size = 0; #else @@ -552,7 +552,7 @@ static PHP_FUNCTION(bzdecompress) #endif bz_stream bzs; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &small)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) { RETURN_FALSE; } @@ -586,7 +586,7 @@ static PHP_FUNCTION(bzdecompress) efree(dest); } else { /* real error */ efree(dest); - RETVAL_INT(error); + RETVAL_LONG(error); } BZ2_bzDecompressEnd(&bzs); @@ -621,7 +621,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) /* Determine what to return */ switch (opt) { case PHP_BZ_ERRNO: - RETURN_INT(errnum); + RETURN_LONG(errnum); break; case PHP_BZ_ERRSTR: RETURN_STRING((char*)errstr); @@ -629,7 +629,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) case PHP_BZ_ERRBOTH: array_init(return_value); - add_assoc_int (return_value, "errno", errnum); + add_assoc_long (return_value, "errno", errnum); add_assoc_string(return_value, "errstr", (char*)errstr); break; } diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index 75c1bd418b..cb175af37c 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -381,10 +381,10 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi ZVAL_DUP(&tmp, tmpzval); convert_to_int(&tmp); - if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_IVAL_P(tmpzval)); + if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_LVAL_P(tmpzval)); } else { - blockSize100k = Z_IVAL(tmp); + blockSize100k = Z_LVAL(tmp); } } @@ -395,10 +395,10 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi ZVAL_DUP(&tmp, tmpzval); convert_to_int(&tmp); - if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_IVAL(tmp)); + if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_LVAL(tmp)); } else { - workFactor = Z_IVAL(tmp); + workFactor = Z_LVAL(tmp); } } } diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 6149a0c054..99adfd3563 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -31,7 +31,7 @@ PHP_FUNCTION(unixtojd) time_t ts = 0; struct tm *ta, tmbuf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts) == FAILURE) { return; } @@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd) RETURN_FALSE; } - RETURN_INT(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); + RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); } /* }}} */ @@ -64,7 +64,7 @@ PHP_FUNCTION(jdtounix) RETURN_FALSE; } - RETURN_INT(uday * 24 * 3600); + RETURN_LONG(uday * 24 * 3600); } /* }}} */ diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 56277b0dd9..173cf076e1 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -178,8 +178,8 @@ enum cal_name_type_t { CAL_NUM_CALS }; -typedef php_int_t (*cal_to_jd_func_t) (int month, int day, int year); -typedef void (*cal_from_jd_func_t) (php_int_t jd, int *year, int *month, int *day); +typedef zend_long (*cal_to_jd_func_t) (int month, int day, int year); +typedef void (*cal_from_jd_func_t) (zend_long jd, int *year, int *month, int *day); typedef char *(*cal_as_string_func_t) (int year, int month, int day); struct cal_entry_t { @@ -225,31 +225,31 @@ static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú"; PHP_MINIT_FUNCTION(calendar) { - REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); /* constants for jddayofweek */ - REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); /* constants for jdmonthname */ - REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); /* constants for easter calculation */ - REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); /* constants for Jewish date formatting */ - REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -279,7 +279,7 @@ static void _php_cal_info(int cal, zval *ret) add_assoc_zval(ret, "months", &months); add_assoc_zval(ret, "abbrevmonths", &smonths); - add_assoc_int(ret, "maxdaysinmonth", calendar->max_days_in_month); + add_assoc_long(ret, "maxdaysinmonth", calendar->max_days_in_month); add_assoc_string(ret, "calname", calendar->name); add_assoc_string(ret, "calsymbol", calendar->symbol); @@ -289,10 +289,10 @@ static void _php_cal_info(int cal, zval *ret) Returns information about a particular calendar */ PHP_FUNCTION(cal_info) { - php_int_t cal = -1; + zend_long cal = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &cal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) { RETURN_FALSE; } @@ -324,11 +324,11 @@ PHP_FUNCTION(cal_info) Returns the number of days in a month for a given year and calendar */ PHP_FUNCTION(cal_days_in_month) { - php_int_t cal, month, year; + zend_long cal, month, year; struct cal_entry_t *calendar; - php_int_t sdn_start, sdn_next; + zend_long sdn_start, sdn_next; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &cal, &month, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) { RETURN_FALSE; } @@ -360,7 +360,7 @@ PHP_FUNCTION(cal_days_in_month) } } - RETURN_INT(sdn_next - sdn_start); + RETURN_LONG(sdn_next - sdn_start); } /* }}} */ @@ -368,9 +368,9 @@ PHP_FUNCTION(cal_days_in_month) Converts from a supported calendar to Julian Day Count */ PHP_FUNCTION(cal_to_jd) { - php_int_t cal, month, day, year; + zend_long cal, month, day, year; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiii", &cal, &month, &day, &year) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) { RETURN_FALSE; } @@ -379,7 +379,7 @@ PHP_FUNCTION(cal_to_jd) RETURN_FALSE; } - RETURN_INT(cal_conversion_table[cal].to_jd(year, month, day)); + RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day)); } /* }}} */ @@ -387,12 +387,12 @@ PHP_FUNCTION(cal_to_jd) Converts from Julian Day Count to a supported calendar and return extended information */ PHP_FUNCTION(cal_from_jd) { - php_int_t jd, cal; + zend_long jd, cal; int month, day, year, dow; char date[16]; struct cal_entry_t *calendar; - if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ii", &jd, &cal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) { RETURN_FALSE; } @@ -409,13 +409,13 @@ PHP_FUNCTION(cal_from_jd) snprintf(date, sizeof(date), "%i/%i/%i", month, day, year); add_assoc_string(return_value, "date", date); - add_assoc_int(return_value, "month", month); - add_assoc_int(return_value, "day", day); - add_assoc_int(return_value, "year", year); + add_assoc_long(return_value, "month", month); + add_assoc_long(return_value, "day", day); + add_assoc_long(return_value, "year", year); /* day of week */ dow = DayOfWeek(jd); - add_assoc_int(return_value, "dow", dow); + add_assoc_long(return_value, "dow", dow); add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]); add_assoc_string(return_value, "dayname", DayNameLong[dow]); /* month name */ @@ -434,11 +434,11 @@ PHP_FUNCTION(cal_from_jd) Converts a julian day count to a gregorian calendar date */ PHP_FUNCTION(jdtogregorian) { - php_int_t julday; + zend_long julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { RETURN_FALSE; } @@ -453,13 +453,13 @@ PHP_FUNCTION(jdtogregorian) Converts a gregorian calendar date to julian day count */ PHP_FUNCTION(gregoriantojd) { - php_int_t year, month, day; + zend_long year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_INT(GregorianToSdn(year, month, day)); + RETURN_LONG(GregorianToSdn(year, month, day)); } /* }}} */ @@ -467,11 +467,11 @@ PHP_FUNCTION(gregoriantojd) Convert a julian day count to a julian calendar date */ PHP_FUNCTION(jdtojulian) { - php_int_t julday; + zend_long julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { RETURN_FALSE; } @@ -486,13 +486,13 @@ PHP_FUNCTION(jdtojulian) Converts a julian calendar date to julian day count */ PHP_FUNCTION(juliantojd) { - php_int_t year, month, day; + zend_long year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_INT(JulianToSdn(year, month, day)); + RETURN_LONG(JulianToSdn(year, month, day)); } /* }}} */ @@ -595,13 +595,13 @@ static char *heb_number_to_chars(int n, int fl, char **ret) Converts a julian day count to a jewish calendar date */ PHP_FUNCTION(jdtojewish) { - php_int_t julday, fl = 0; + zend_long julday, fl = 0; zend_bool heb = 0; int year, month, day; char date[16], hebdate[32]; char *dayp, *yearp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|bi", &julday, &heb, &fl) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) { RETURN_FALSE; } @@ -634,13 +634,13 @@ PHP_FUNCTION(jdtojewish) Converts a jewish calendar date to a julian day count */ PHP_FUNCTION(jewishtojd) { - php_int_t year, month, day; + zend_long year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_INT(JewishToSdn(year, month, day)); + RETURN_LONG(JewishToSdn(year, month, day)); } /* }}} */ @@ -648,11 +648,11 @@ PHP_FUNCTION(jewishtojd) Converts a julian day count to a french republic calendar date */ PHP_FUNCTION(jdtofrench) { - php_int_t julday; + zend_long julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { RETURN_FALSE; } @@ -667,13 +667,13 @@ PHP_FUNCTION(jdtofrench) Converts a french republic calendar date to julian day count */ PHP_FUNCTION(frenchtojd) { - php_int_t year, month, day; + zend_long year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_INT(FrenchToSdn(year, month, day)); + RETURN_LONG(FrenchToSdn(year, month, day)); } /* }}} */ @@ -681,11 +681,11 @@ PHP_FUNCTION(frenchtojd) Returns name or number of day of week from julian day count */ PHP_FUNCTION(jddayofweek) { - php_int_t julday, mode = CAL_DOW_DAYNO; + zend_long julday, mode = CAL_DOW_DAYNO; int day; char *daynamel, *daynames; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &julday, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) { RETURN_FALSE; } @@ -702,7 +702,7 @@ PHP_FUNCTION(jddayofweek) break; case CAL_DOW_DAYNO: default: - RETURN_INT(day); + RETURN_LONG(day); break; } } @@ -712,11 +712,11 @@ PHP_FUNCTION(jddayofweek) Returns name of month for julian day count */ PHP_FUNCTION(jdmonthname) { - php_int_t julday, mode; + zend_long julday, mode; char *monthname = NULL; int month, day, year; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &julday, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/calendar/dow.c b/ext/calendar/dow.c index 1e9b99694c..44f0490ed1 100644 --- a/ext/calendar/dow.c +++ b/ext/calendar/dow.c @@ -32,7 +32,7 @@ #include "sdncal.h" int DayOfWeek( - php_int_t sdn) + zend_long sdn) { int dow; diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c index a61a970461..d2b36f981a 100644 --- a/ext/calendar/easter.c +++ b/ext/calendar/easter.c @@ -24,14 +24,14 @@ #include "sdncal.h" #include <time.h> -static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm) +static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm) { /* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */ struct tm te; - php_int_t year, golden, solar, lunar, pfm, dom, tmp, easter, result; - php_int_t method = CAL_EASTER_DEFAULT; + zend_long year, golden, solar, lunar, pfm, dom, tmp, easter, result; + zend_long method = CAL_EASTER_DEFAULT; /* Default to the current year if year parameter is not given */ { @@ -47,7 +47,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm) } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "|ii", &year, &method) == FAILURE) { + "|ll", &year, &method) == FAILURE) { return; } @@ -115,7 +115,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm) } else { /* return the days after March 21 */ result = easter; } - ZVAL_INT(return_value, result); + ZVAL_LONG(return_value, result); } /* {{{ proto int easter_date([int year]) diff --git a/ext/calendar/french.c b/ext/calendar/french.c index c6584695e9..4eb0e78021 100644 --- a/ext/calendar/french.c +++ b/ext/calendar/french.c @@ -93,12 +93,12 @@ #define LAST_VALID 2380952 void SdnToFrench( - php_int_t sdn, + zend_long sdn, int *pYear, int *pMonth, int *pDay) { - php_int_t temp; + zend_long temp; int dayOfYear; if (sdn < FIRST_VALID || sdn > LAST_VALID) { @@ -114,7 +114,7 @@ void SdnToFrench( *pDay = dayOfYear % DAYS_PER_MONTH + 1; } -php_int_t FrenchToSdn( +zend_long FrenchToSdn( int year, int month, int day) diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c index b67de5fcc8..069fe6eb5a 100644 --- a/ext/calendar/gregor.c +++ b/ext/calendar/gregor.c @@ -135,7 +135,7 @@ #define DAYS_PER_400_YEARS 146097 void SdnToGregorian( - php_int_t sdn, + zend_long sdn, int *pYear, int *pMonth, int *pDay) @@ -144,7 +144,7 @@ void SdnToGregorian( int year; int month; int day; - php_int_t temp; + zend_long temp; int dayOfYear; if (sdn <= 0 || @@ -190,7 +190,7 @@ fail: *pDay = 0; } -php_int_t GregorianToSdn( +zend_long GregorianToSdn( int inputYear, int inputMonth, int inputDay) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index 83efb9949f..6a32e6ff08 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -382,12 +382,12 @@ char *JewishMonthHebName[14] = * (called dehiyyot) delays it. These 4 rules can delay the start of the * year by as much as 2 days. */ -static php_int_t Tishri1( +static zend_long Tishri1( int metonicYear, - php_int_t moladDay, - php_int_t moladHalakim) + zend_long moladDay, + zend_long moladHalakim) { - php_int_t tishri1; + zend_long tishri1; int dow; int leapYear; int lastWasLeapYear; @@ -429,10 +429,10 @@ static php_int_t Tishri1( */ static void MoladOfMetonicCycle( int metonicCycle, - php_int_t *pMoladDay, - php_int_t *pMoladHalakim) + zend_long *pMoladDay, + zend_long *pMoladHalakim) { - register php_uint_t r1, r2, d1, d2; + register zend_ulong r1, r2, d1, d2; /* Start with the time of the first molad after creation. */ r1 = NEW_MOON_OF_CREATION; @@ -468,14 +468,14 @@ static void MoladOfMetonicCycle( * us to avoid calculating the length of the year in most cases. */ static void FindTishriMolad( - php_int_t inputDay, + zend_long inputDay, int *pMetonicCycle, int *pMetonicYear, - php_int_t *pMoladDay, - php_int_t *pMoladHalakim) + zend_long *pMoladDay, + zend_long *pMoladHalakim) { - php_int_t moladDay; - php_int_t moladHalakim; + zend_long moladDay; + zend_long moladHalakim; int metonicCycle; int metonicYear; @@ -523,8 +523,8 @@ static void FindStartOfYear( int year, int *pMetonicCycle, int *pMetonicYear, - php_int_t *pMoladDay, - php_int_t *pMoladHalakim, + zend_long *pMoladDay, + zend_long *pMoladHalakim, int *pTishri1) { *pMetonicCycle = (year - 1) / 19; @@ -546,14 +546,14 @@ static void FindStartOfYear( * range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive. */ void SdnToJewish( - php_int_t sdn, + zend_long sdn, int *pYear, int *pMonth, int *pDay) { - php_int_t inputDay; - php_int_t day; - php_int_t halakim; + zend_long inputDay; + zend_long day; + zend_long halakim; int metonicCycle; int metonicYear; int tishri1; @@ -684,18 +684,18 @@ void SdnToJewish( * value. To verify that a date is valid, convert it to SDN and then back * and compare with the original. */ -php_int_t JewishToSdn( +zend_long JewishToSdn( int year, int month, int day) { - php_int_t sdn; + zend_long sdn; int metonicCycle; int metonicYear; int tishri1; int tishri1After; - php_int_t moladDay; - php_int_t moladHalakim; + zend_long moladDay; + zend_long moladHalakim; int yearLength; int lengthOfAdarIAndII; diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c index 3527627c2f..659ffc1740 100644 --- a/ext/calendar/julian.c +++ b/ext/calendar/julian.c @@ -11,7 +11,7 @@ * * void * SdnToJulian( - * php_int_t sdn, + * zend_long sdn, * int *pYear, * int *pMonth, * int *pDay); @@ -21,7 +21,7 @@ * will be >= -4713 and != 0; *pMonth will be in the range 1 to 12 * inclusive; *pDay will be in the range 1 to 31 inclusive. * - * php_int_t + * zend_long * JulianToSdn( * int inputYear, * int inputMonth, @@ -153,7 +153,7 @@ #define DAYS_PER_4_YEARS 1461 void SdnToJulian( - php_int_t sdn, + zend_long sdn, int *pYear, int *pMonth, int *pDay) @@ -161,7 +161,7 @@ void SdnToJulian( int year; int month; int day; - php_int_t temp; + zend_long temp; int dayOfYear; if (sdn <= 0) { @@ -212,7 +212,7 @@ fail: *pDay = 0; } -php_int_t JulianToSdn( +zend_long JulianToSdn( int inputYear, int inputMonth, int inputDay) diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h index 47d7748c4c..c76fc0063b 100644 --- a/ext/calendar/sdncal.h +++ b/ext/calendar/sdncal.h @@ -53,7 +53,7 @@ * * int y1, m1, d1; * int y2, m2, d2; - * php_int_t sdn; + * zend_long sdn; * ... * sdn = GregorianToSdn(y1, m1, d1); * if (sdn > 0) { @@ -68,18 +68,18 @@ #include "php.h" /* Gregorian calendar conversions. */ -void SdnToGregorian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); -php_int_t GregorianToSdn(int year, int month, int day); +void SdnToGregorian(zend_long sdn, int *pYear, int *pMonth, int *pDay); +zend_long GregorianToSdn(int year, int month, int day); extern char *MonthNameShort[13]; extern char *MonthNameLong[13]; /* Julian calendar conversions. */ -void SdnToJulian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); -php_int_t JulianToSdn(int year, int month, int day); +void SdnToJulian(zend_long sdn, int *pYear, int *pMonth, int *pDay); +zend_long JulianToSdn(int year, int month, int day); /* Jewish calendar conversions. */ -void SdnToJewish(php_int_t sdn, int *pYear, int *pMonth, int *pDay); -php_int_t JewishToSdn(int year, int month, int day); +void SdnToJewish(zend_long sdn, int *pYear, int *pMonth, int *pDay); +zend_long JewishToSdn(int year, int month, int day); extern char *JewishMonthName[14]; extern char *JewishMonthNameLeap[14]; extern char *JewishMonthHebName[14]; @@ -87,15 +87,15 @@ extern char *JewishMonthHebNameLeap[14]; extern int monthsPerYear[19]; /* French republic calendar conversions. */ -void SdnToFrench(php_int_t sdn, int *pYear, int *pMonth, int *pDay); -php_int_t FrenchToSdn(int inputYear, int inputMonth, int inputDay); +void SdnToFrench(zend_long sdn, int *pYear, int *pMonth, int *pDay); +zend_long FrenchToSdn(int inputYear, int inputMonth, int inputDay); extern char *FrenchMonthName[14]; /* Islamic calendar conversions. */ /* Not implemented yet. */ /* Day of week conversion. 0=Sunday, 6=Saturday */ -int DayOfWeek(php_int_t sdn); +int DayOfWeek(zend_long sdn); extern char *DayNameShort[7]; extern char *DayNameLong[7]; diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 00b62bb2d2..892d8c3829 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -57,11 +57,11 @@ PHP_FUNCTION(com_create_instance) obj = CDNO_FETCH(object); if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "s|s!is", + ZEND_NUM_ARGS() TSRMLS_CC, "s|s!ls", &module_name, &module_name_len, &server_name, &server_name_len, &obj->code_page, &typelib_name, &typelib_name_len) && FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "sa|is", + ZEND_NUM_ARGS() TSRMLS_CC, "sa|ls", &module_name, &module_name_len, &server_params, &obj->code_page, &typelib_name, &typelib_name_len)) { @@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance) "Server", sizeof("Server")-1))) { convert_to_string_ex(tmp); server_name = Z_STRVAL_P(tmp); - server_name_len = Z_STRSIZE_P(tmp); + server_name_len = Z_STRLEN_P(tmp); ctx = CLSCTX_REMOTE_SERVER; } @@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance) "Username", sizeof("Username")-1))) { convert_to_string_ex(tmp); user_name = Z_STRVAL_P(tmp); - user_name_len = Z_STRSIZE_P(tmp); + user_name_len = Z_STRLEN_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Password", sizeof("Password")-1))) { convert_to_string_ex(tmp); password = Z_STRVAL_P(tmp); - password_len = Z_STRSIZE_P(tmp); + password_len = Z_STRLEN_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Domain", sizeof("Domain")-1))) { convert_to_string_ex(tmp); domain_name = Z_STRVAL_P(tmp); - domain_name_len = Z_STRSIZE_P(tmp); + domain_name_len = Z_STRLEN_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Flags", sizeof("Flags")-1))) { convert_to_int_ex(tmp); - ctx = (CLSCTX)Z_IVAL_P(tmp); + ctx = (CLSCTX)Z_LVAL_P(tmp); } } @@ -289,14 +289,14 @@ PHP_FUNCTION(com_get_active_object) CLSID clsid; char *module_name; int module_name_len; - php_int_t code_page = COMG(code_page); + zend_long code_page = COMG(code_page); IUnknown *unk = NULL; IDispatch *obj = NULL; HRESULT res; OLECHAR *module = NULL; php_com_initialize(TSRMLS_C); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &module_name, &module_name_len, &code_page)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC); return; @@ -427,7 +427,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, } if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) { - *dispid = Z_IVAL_P(tmp); + *dispid = Z_LVAL_P(tmp); return S_OK; } @@ -456,7 +456,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, ALLOC_HASHTABLE(obj->id_of_name_cache); zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0); } - ZVAL_INT(&tmp, *dispid); + ZVAL_LONG(&tmp, *dispid); zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp); } @@ -784,11 +784,11 @@ PHP_FUNCTION(com_print_typeinfo) Process COM messages, sleeping for up to timeoutms milliseconds */ PHP_FUNCTION(com_message_pump) { - php_int_t timeoutms = 0; + zend_long timeoutms = 0; MSG msg; DWORD result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timeoutms) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE) RETURN_FALSE; php_com_initialize(TSRMLS_C); diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index c742fd30fc..9698fb3419 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -243,7 +243,7 @@ PHP_FUNCTION(com_dotnet_create_instance) obj = CDNO_FETCH(object); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &assembly_name, &assembly_name_len, &datatype_name, &datatype_name_len, &obj->code_page)) { diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index db9f5b21f9..2de35a58b1 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -383,12 +383,12 @@ PHP_MINIT_FUNCTION(com_dotnet) REGISTER_INI_ENTRIES(); -#define COM_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) +#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) #define COM_ERR_CONST(x) { \ - php_int_t __tmp; \ + zend_long __tmp; \ ULongToUIntPtr(x, &__tmp); \ - REGISTER_INT_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \ + REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \ } COM_CONST(CLSCTX_INPROC_SERVER); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 791aaeb5cc..b9df407a1b 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -44,7 +44,7 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc convert_to_string_ex(member); - res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), + res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC); if (res == SUCCESS) { @@ -71,7 +71,7 @@ static void com_property_write(zval *object, zval *member, zval *value, void **c VariantInit(&v); convert_to_string_ex(member); - if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), + if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T convert_to_int(offset); if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { - if (php_com_safearray_get_elem(&obj->v, &v, Z_IVAL_P(offset) TSRMLS_CC)) { + if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) { php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC); VariantClear(&v); } @@ -145,7 +145,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D } convert_to_int(offset); - indices = Z_IVAL_P(offset); + indices = Z_LVAL_P(offset); VariantInit(&v); php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC); @@ -197,7 +197,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void if (V_VT(&obj->v) == VT_DISPATCH) { convert_to_string_ex(member); - if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), &dispid TSRMLS_CC))) { + if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid TSRMLS_CC))) { /* TODO: distinguish between property and method! */ return 1; } @@ -238,7 +238,7 @@ static void function_dtor(zval *zv) { zend_internal_function *f = (zend_internal_function*)Z_PTR_P(zv); - STR_RELEASE(f->function_name); + zend_string_release(f->function_name); if (f->arg_info) { efree(f->arg_info); } @@ -277,7 +277,7 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin f.arg_info = NULL; f.scope = obj->ce; f.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; - f.function_name = STR_COPY(name); + f.function_name = zend_string_copy(name); f.handler = PHP_FN(com_method_handler); fptr = &f; @@ -434,7 +434,7 @@ static zend_string* com_class_name_get(const zend_object *object, int parent TSR { php_com_dotnet_object *obj = (php_com_dotnet_object *)object; - return STR_COPY(obj->ce->name); + return zend_string_copy(obj->ce->name); } /* This compares two variants for equality */ @@ -491,7 +491,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC) } switch(type) { - case IS_INT: + case IS_LONG: vt = VT_INT; break; case IS_DOUBLE: diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index d22bf1efde..f6aa1a1980 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -32,7 +32,7 @@ struct php_com_iterator { zend_object_iterator iter; IEnumVARIANT *ev; - php_uint_t key; + zend_ulong key; VARIANT v; /* cached element */ int code_page; VARIANT safe_array; @@ -75,10 +75,10 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data); - if (I->key == (php_uint_t)-1) { + if (I->key == (zend_ulong)-1) { ZVAL_NULL(key); } else { - ZVAL_INT(key, I->key); + ZVAL_LONG(key, I->key); } } diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index 294ff26fe7..d83aeeb188 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC) message = php_win32_error_to_msg(code); free_msg = 1; } - zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)code TSRMLS_CC); + zend_throw_exception(php_com_exception_class_entry, message, (zend_long)code TSRMLS_CC); if (free_msg) { LocalFree(message); } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 2a2657ae3c..0b496404f4 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -439,7 +439,7 @@ CPH_METHOD(LoadFromFile) HRESULT res; char *filename, *fullpath; int filename_len; - php_int_t flags = 0; + zend_long flags = 0; OLECHAR *olefilename; CPH_FETCH(); @@ -448,7 +448,7 @@ CPH_METHOD(LoadFromFile) res = get_persist_file(helper); if (helper->ipf) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &flags)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); return; @@ -506,7 +506,7 @@ CPH_METHOD(GetMaxStreamSize) php_com_throw_exception(res, NULL TSRMLS_CC); } else { /* TODO: handle 64 bit properly */ - RETURN_INT((php_int_t)size.QuadPart); + RETURN_LONG((zend_long)size.QuadPart); } } /* }}} */ diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 886bd808f9..20aa33ed53 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * VariantInit(&v); res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRSIZE(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, + Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, proxy->dimensions, args, 0 TSRMLS_CC); if (res == SUCCESS) { @@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * SafeArrayGetLBound(sa, proxy->dimensions, &lbound); SafeArrayGetUBound(sa, proxy->dimensions, &ubound); - if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) { + if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC); return rv; } @@ -167,11 +167,11 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* copy indices from proxy */ for (i = 0; i < dims; i++) { convert_to_int(&proxy->indices[i]); - indices[i] = Z_IVAL(proxy->indices[i]); + indices[i] = Z_LVAL(proxy->indices[i]); } /* add user-supplied index */ - indices[dims-1] = Z_IVAL_P(offset); + indices[dims-1] = Z_LVAL_P(offset); /* now fetch the value */ if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { @@ -225,7 +225,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM convert_to_string(&proxy->indices[0]); VariantInit(&v); if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRSIZE(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, + Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, args, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -241,12 +241,12 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM /* copy indices from proxy */ for (i = 0; i < dims; i++) { convert_to_int(&proxy->indices[i]); - indices[i] = Z_IVAL(proxy->indices[i]); + indices[i] = Z_LVAL(proxy->indices[i]); } /* add user-supplied index */ convert_to_int(offset); - indices[dims-1] = Z_IVAL_P(offset); + indices[dims-1] = Z_LVAL_P(offset); if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) { vt = V_VT(&proxy->obj->v) & ~VT_ARRAY; @@ -340,7 +340,7 @@ static zend_class_entry *saproxy_class_entry_get(const zend_object *object TSRML static zend_string* saproxy_class_name_get(const zend_object *object, int parent TSRMLS_DC) { - return STR_COPY(php_com_saproxy_class_entry->name); + return zend_string_copy(php_com_saproxy_class_entry->name); } static int saproxy_objects_compare(zval *object1, zval *object2 TSRMLS_DC) @@ -353,7 +353,7 @@ static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC return FAILURE; } -static int saproxy_count_elements(zval *object, php_int_t *count TSRMLS_DC) +static int saproxy_count_elements(zval *object, zend_long *count TSRMLS_DC) { php_com_saproxy *proxy = SA_FETCH(object); LONG ubound, lbound; @@ -516,7 +516,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC if (I->key == -1) { ZVAL_NULL(key); } else { - ZVAL_INT(key, I->key); + ZVAL_LONG(key, I->key); } } @@ -561,7 +561,7 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0); for (i = 0; i < proxy->dimensions; i++) { convert_to_int(&proxy->indices[i]); - I->indices[i] = Z_IVAL(proxy->indices[i]); + I->indices[i] = Z_LVAL(proxy->indices[i]); } SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin); diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 0cb8c4de28..b32c4b2600 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -186,7 +186,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa } const_name = php_com_olestring_to_string(bstr_ids, &len, codepage TSRMLS_CC); - c.name = STR_INIT(const_name, len, 1); + c.name = zend_string_init(const_name, len, 1); // TODO: avoid reallocation??? efree(const_name); if(c.name == NULL) { @@ -201,16 +201,16 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa if (COMG(autoreg_verbose) && !compare_function(&results, &c.value, exists TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type library constant %s is already defined", c.name); } - STR_RELEASE(c.name); + zend_string_release(c.name); ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc); continue; } /* register the constant */ php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC); - if (Z_TYPE(value) == IS_INT) { + if (Z_TYPE(value) == IS_LONG) { c.flags = mode; - ZVAL_INT(&c.value, Z_IVAL(value)); + ZVAL_LONG(&c.value, Z_LVAL(value)); c.module_number = 0; zend_register_constant(&c TSRMLS_CC); } diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 27583e5dc9..9931e7182f 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -39,8 +39,8 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC) HashPosition pos; int keytype; zend_string *strindex; - php_int_t intindex = -1; - php_int_t max_index = 0; + zend_long intindex = -1; + zend_long max_index = 0; VARIANT *va; zval *item; @@ -145,9 +145,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep safe_array_from_zval(v, z, codepage TSRMLS_CC); break; - case IS_INT: + case IS_LONG: V_VT(v) = VT_I4; - V_I4(v) = Z_IVAL_P(z); + V_I4(v) = Z_LVAL_P(z); break; case IS_DOUBLE: @@ -157,11 +157,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep case IS_STRING: V_VT(v) = VT_BSTR; - olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRSIZE_P(z), codepage TSRMLS_CC); + olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC); if (CP_UTF8 == codepage) { V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR)); } else { - V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRSIZE_P(z) * sizeof(OLECHAR)); + V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR)); } efree(olestring); break; @@ -187,28 +187,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa ZVAL_NULL(z); break; case VT_UI1: - ZVAL_INT(z, (php_int_t)V_UI1(v)); + ZVAL_LONG(z, (zend_long)V_UI1(v)); break; case VT_I1: - ZVAL_INT(z, (php_int_t)V_I1(v)); + ZVAL_LONG(z, (zend_long)V_I1(v)); break; case VT_UI2: - ZVAL_INT(z, (php_int_t)V_UI2(v)); + ZVAL_LONG(z, (zend_long)V_UI2(v)); break; case VT_I2: - ZVAL_INT(z, (php_int_t)V_I2(v)); + ZVAL_LONG(z, (zend_long)V_I2(v)); break; case VT_UI4: /* TODO: promote to double if large? */ - ZVAL_INT(z, (php_int_t)V_UI4(v)); + ZVAL_LONG(z, (zend_long)V_UI4(v)); break; case VT_I4: - ZVAL_INT(z, (php_int_t)V_I4(v)); + ZVAL_LONG(z, (zend_long)V_I4(v)); break; case VT_INT: - ZVAL_INT(z, V_INT(v)); + ZVAL_LONG(z, V_INT(v)); break; case VT_UINT: /* TODO: promote to double if large? */ - ZVAL_INT(z, (php_int_t)V_UINT(v)); + ZVAL_LONG(z, (zend_long)V_UINT(v)); break; case VT_R4: ZVAL_DOUBLE(z, (double)V_R4(v)); @@ -406,8 +406,8 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR /* {{{ com_variant_create_instance - ctor for new VARIANT() */ PHP_FUNCTION(com_variant_create_instance) { - /* VARTYPE == unsigned short */ php_int_t vt = VT_EMPTY; - php_int_t codepage = CP_ACP; + /* VARTYPE == unsigned short */ zend_long vt = VT_EMPTY; + zend_long codepage = CP_ACP; zval *object = getThis(); php_com_dotnet_object *obj; zval *zvalue = NULL; @@ -421,7 +421,7 @@ PHP_FUNCTION(com_variant_create_instance) obj = CDNO_FETCH(object); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "z!|ii", &zvalue, &vt, &codepage)) { + "z!|ll", &zvalue, &vt, &codepage)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); return; } @@ -444,7 +444,7 @@ PHP_FUNCTION(com_variant_create_instance) but will probably fail (original behavior) */ if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) { - php_int_t orig_vt = vt; + zend_long orig_vt = vt; vt &= ~VT_ARRAY; if (vt) { @@ -832,7 +832,7 @@ PHP_FUNCTION(variant_round) zval *zleft = NULL; php_com_dotnet_object *obj; int codepage = CP_ACP; - php_int_t decimals = 0; + zend_long decimals = 0; VariantInit(&left_val); VariantInit(&vres); @@ -867,8 +867,8 @@ PHP_FUNCTION(variant_cmp) zval *zleft = NULL, *zright = NULL; php_com_dotnet_object *obj; int codepage = CP_ACP; - php_int_t lcid = LOCALE_SYSTEM_DEFAULT; - php_int_t flags = 0; + zend_long lcid = LOCALE_SYSTEM_DEFAULT; + zend_long flags = 0; /* it is safe to ignore the warning for this line; see the comments in com_handlers.c */ STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags); @@ -876,28 +876,28 @@ PHP_FUNCTION(variant_cmp) VariantInit(&right_val); if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "OO|ii", &zleft, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "OO|ll", &zleft, php_com_variant_class_entry, &zright, php_com_variant_class_entry, &lcid, &flags)) { obj = CDNO_FETCH(zleft); vleft = &obj->v; obj = CDNO_FETCH(zright); vright = &obj->v; } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ii", &zleft, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ll", &zleft, php_com_variant_class_entry, &zright, &lcid, &flags)) { obj = CDNO_FETCH(zleft); vleft = &obj->v; vright = &right_val; php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC); } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ii", &zleft, &zright, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ll", &zleft, &zright, php_com_variant_class_entry, &lcid, &flags)) { obj = CDNO_FETCH(zright); vright = &obj->v; vleft = &left_val; php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); } else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "z!z!|ii", &zleft, &zright, &lcid, &flags)) { + "z!z!|ll", &zleft, &zright, &lcid, &flags)) { vleft = &left_val; php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); @@ -909,7 +909,7 @@ PHP_FUNCTION(variant_cmp) return; } - ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags)); + ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags)); VariantClear(&left_val); VariantClear(&right_val); @@ -948,7 +948,7 @@ PHP_FUNCTION(variant_date_to_timestamp) tmv.tm_isdst = -1; tzset(); - RETVAL_INT(mktime(&tmv)); + RETVAL_LONG(mktime(&tmv)); } VariantClear(&vres); @@ -959,13 +959,13 @@ PHP_FUNCTION(variant_date_to_timestamp) Returns a variant date representation of a unix timestamp */ PHP_FUNCTION(variant_date_from_timestamp) { - php_int_t timestamp; + zend_long timestamp; time_t ttstamp; SYSTEMTIME systime; struct tm *tmv; VARIANT res; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", ×tamp)) { return; } @@ -1010,7 +1010,7 @@ PHP_FUNCTION(variant_get_type) } obj = CDNO_FETCH(zobj); - RETURN_INT(V_VT(&obj->v)); + RETURN_LONG(V_VT(&obj->v)); } /* }}} */ @@ -1020,11 +1020,11 @@ PHP_FUNCTION(variant_set_type) { zval *zobj; php_com_dotnet_object *obj; - /* VARTYPE == unsigned short */ php_int_t vt; + /* VARTYPE == unsigned short */ zend_long vt; HRESULT res; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "Oi", &zobj, php_com_variant_class_entry, &vt)) { + "Ol", &zobj, php_com_variant_class_entry, &vt)) { return; } obj = CDNO_FETCH(zobj); @@ -1055,12 +1055,12 @@ PHP_FUNCTION(variant_cast) { zval *zobj; php_com_dotnet_object *obj; - /* VARTYPE == unsigned short */ php_int_t vt; + /* VARTYPE == unsigned short */ zend_long vt; VARIANT vres; HRESULT res; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "Oi", &zobj, php_com_variant_class_entry, &vt)) { + "Ol", &zobj, php_com_variant_class_entry, &vt)) { return; } obj = CDNO_FETCH(zobj); diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 27ea773748..585b207cde 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames( ret = DISP_E_UNKNOWNNAME; rgDispId[i] = 0; } else { - rgDispId[i] = Z_IVAL_P(tmp); + rgDispId[i] = Z_LVAL_P(tmp); } efree(name); @@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid( /* Lookup the name in the hash */ if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) { trace("found it\n"); - *pid = Z_IVAL_P(tmp); + *pid = Z_LVAL_P(tmp); ret = S_OK; } @@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { /* TODO: add support for overloaded objects */ - trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRSIZE_P(name), wFlags, pdp->cArgs); + trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRLEN_P(name), wFlags, pdp->cArgs); /* convert args into zvals. * Args are in reverse order */ @@ -283,9 +283,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( * and expose it as a COM exception */ if (wFlags & DISPATCH_PROPERTYGET) { - retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, 1 TSRMLS_CC); + retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, 1 TSRMLS_CC); } else if (wFlags & DISPATCH_PROPERTYPUT) { - zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name), ¶ms[0] TSRMLS_CC); + zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name), ¶ms[0] TSRMLS_CC); } else if (wFlags & DISPATCH_METHOD) { zend_try { retval = &rv; @@ -385,7 +385,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername( FETCH_DISP("GetMemberName"); if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { - OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRSIZE_P(name), COMG(code_page) TSRMLS_CC); + OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRLEN_P(name), COMG(code_page) TSRMLS_CC); *pbstrName = SysAllocString(olestr); efree(olestr); return S_OK; @@ -450,7 +450,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) zend_string *name = NULL; zval *tmp, tmp2; int keytype; - php_uint_t pid; + zend_ulong pid; if (disp->dispid_to_name == NULL) { ALLOC_HASHTABLE(disp->dispid_to_name); @@ -466,30 +466,30 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) zend_hash_get_current_key_ex(Z_OBJPROP(disp->object), &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_INT) { + if (keytype == HASH_KEY_IS_LONG) { snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid); - name = STR_INIT(namebuf, strlen(namebuf), 0); + name = zend_string_init(namebuf, strlen(namebuf), 0); } else { - STR_ADDREF(name); + zend_string_addref(name); } zend_hash_move_forward_ex(Z_OBJPROP(disp->object), &pos); /* Find the existing id */ if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { - STR_RELEASE(name); + zend_string_release(name); continue; } /* add the mappings */ - ZVAL_STR(&tmp2, STR_COPY(name)); + ZVAL_STR(&tmp2, zend_string_copy(name)); pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_INT(&tmp2, pid); + ZVAL_LONG(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); - STR_RELEASE(name); + zend_string_release(name); } } @@ -501,30 +501,30 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_INT) { + if (keytype == HASH_KEY_IS_LONG) { snprintf(namebuf, sizeof(namebuf), "%d", pid); - name = STR_INIT(namebuf, strlen(namebuf), 0); + name = zend_string_init(namebuf, strlen(namebuf), 0); } else { - STR_ADDREF(name); + zend_string_addref(name); } zend_hash_move_forward_ex(&Z_OBJCE(disp->object)->function_table, &pos); /* Find the existing id */ if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { - STR_RELEASE(name); + zend_string_release(name); continue; } /* add the mappings */ - ZVAL_STR(&tmp2, STR_COPY(name)); + ZVAL_STR(&tmp2, zend_string_copy(name)); pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_INT(&tmp2, pid); + ZVAL_LONG(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); - STR_RELEASE(name); + zend_string_release(name); } } } @@ -590,7 +590,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si zend_string *name = NULL; zval tmp, *ntmp; int keytype; - php_uint_t pid; + zend_ulong pid; disp->dispid_to_name = id_to_name; @@ -604,11 +604,11 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si while (HASH_KEY_NON_EXISTENT != (keytype = zend_hash_get_current_key_ex(id_to_name, &name, &pid, 0, &pos))) { - if (keytype == HASH_KEY_IS_INT) { + if (keytype == HASH_KEY_IS_LONG) { ntmp = zend_hash_get_current_data_ex(id_to_name, &pos); - ZVAL_INT(&tmp, pid); + ZVAL_LONG(&tmp, pid); zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp); } diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index 5d4e75b3f8..b893523748 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -38,7 +38,7 @@ typedef struct _php_com_dotnet_object { int modified; ITypeInfo *typeinfo; - php_int_t code_page; + zend_long code_page; zend_class_entry *ce; diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index e9ccc9f3de..8f116b86d3 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -146,11 +146,11 @@ static PHP_MINFO_FUNCTION(ctype) zval *c, tmp; \ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \ return; \ - if (Z_TYPE_P(c) == IS_INT) { \ - if (Z_IVAL_P(c) <= 255 && Z_IVAL_P(c) >= 0) { \ - RETURN_BOOL(iswhat(Z_IVAL_P(c))); \ - } else if (Z_IVAL_P(c) >= -128 && Z_IVAL_P(c) < 0) { \ - RETURN_BOOL(iswhat(Z_IVAL_P(c) + 256)); \ + if (Z_TYPE_P(c) == IS_LONG) { \ + if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \ + RETURN_BOOL(iswhat(Z_LVAL_P(c))); \ + } else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \ + RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \ } \ tmp = *c; \ zval_copy_ctor(&tmp); \ @@ -159,18 +159,18 @@ static PHP_MINFO_FUNCTION(ctype) tmp = *c; \ } \ if (Z_TYPE(tmp) == IS_STRING) { \ - char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRSIZE(tmp); \ + char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \ if (e == p) { \ - if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ while (p < e) { \ if(!iswhat((int)*(unsigned char *)(p++))) { \ - if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ } \ - if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ RETURN_TRUE; \ } else { \ RETURN_FALSE; \ diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 2f493e2686..0f3c166043 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -154,7 +154,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err; -#define CAAL(s, v) add_assoc_int_ex(return_value, s, sizeof(s) - 1, (php_int_t) v); +#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : "")); #define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : STR_EMPTY_ALLOC()); @@ -166,7 +166,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC); # define php_curl_ret(__ret) RETVAL_FALSE; return; #endif -static int php_curl_option_str(php_curl *ch, php_int_t option, const char *str, const int len, zend_bool make_copy TSRMLS_DC) +static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC) { CURLcode error = CURLE_OK; @@ -612,7 +612,7 @@ PHP_MINFO_FUNCTION(curl) } /* }}} */ -#define REGISTER_CURL_CONSTANT(__c) REGISTER_INT_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) +#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) /* {{{ PHP_MINIT_FUNCTION */ @@ -1318,10 +1318,10 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_INT) { + if (Z_TYPE(retval) != IS_LONG) { convert_to_int_ex(&retval); } - length = Z_IVAL(retval); + length = Z_LVAL(retval); } zval_ptr_dtor(&argv[0]); @@ -1371,10 +1371,10 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string) if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_INT) { + if (Z_TYPE(retval) != IS_LONG) { convert_to_int_ex(&retval); } - rval = Z_IVAL(retval); + rval = Z_LVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1410,10 +1410,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); - ZVAL_INT(&argv[1], (long)dltotal); - ZVAL_INT(&argv[2], (long)dlnow); - ZVAL_INT(&argv[3], (long)ultotal); - ZVAL_INT(&argv[4], (long)ulnow); + ZVAL_LONG(&argv[1], (long)dltotal); + ZVAL_LONG(&argv[2], (long)dlnow); + ZVAL_LONG(&argv[3], (long)ultotal); + ZVAL_LONG(&argv[4], (long)ulnow); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1431,10 +1431,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_INT) { + if (Z_TYPE(retval) != IS_LONG) { convert_to_int_ex(&retval); } - if (0 != Z_IVAL(retval)) { + if (0 != Z_LVAL(retval)) { rval = 1; } } @@ -1475,7 +1475,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) Z_ADDREF(argv[0]); ZVAL_RES(&argv[1], t->res); Z_ADDREF(argv[1]); - ZVAL_INT(&argv[2], (int)size * nmemb); + ZVAL_LONG(&argv[2], (int)size * nmemb); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1497,7 +1497,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) #endif } else if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) == IS_STRING) { - length = MIN((int) (size * nmemb), Z_STRSIZE(retval)); + length = MIN((int) (size * nmemb), Z_STRLEN(retval)); memcpy(data, Z_STRVAL(retval), length); } zval_ptr_dtor(&retval); @@ -1562,10 +1562,10 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_INT) { + if (Z_TYPE(retval) != IS_LONG) { convert_to_int_ex(&retval); } - length = Z_IVAL(retval); + length = Z_LVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1589,10 +1589,10 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v if (type == CURLINFO_HEADER_OUT) { if (ch->header.str) { - STR_RELEASE(ch->header.str); + zend_string_release(ch->header.str); } if (buf_len > 0) { - ch->header.str = STR_INIT(buf, buf_len, 0); + ch->header.str = zend_string_init(buf, buf_len, 0); } } @@ -1616,16 +1616,16 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRING(&argv[1], prompt); - ZVAL_INT(&argv[2], buflen); + ZVAL_LONG(&argv[2], buflen); error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION"); } else if (Z_TYPE(retval) == IS_STRING) { - if (Z_STRSIZE(retval) > buflen) { + if (Z_STRLEN(retval) > buflen) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle"); } else { - memcpy(buf, Z_STRVAL(retval), Z_STRSIZE(retval) + 1); + memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func)); @@ -1670,9 +1670,9 @@ static void curl_free_slist(zval *el) PHP_FUNCTION(curl_version) { curl_version_info_data *d; - php_int_t uversion = CURLVERSION_NOW; + zend_long uversion = CURLVERSION_NOW; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &uversion) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uversion) == FAILURE) { return; } @@ -1986,7 +1986,7 @@ PHP_FUNCTION(curl_copy_handle) } /* }}} */ -static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_DC) /* {{{ */ +static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue TSRMLS_DC) /* {{{ */ { CURLcode error = CURLE_OK; @@ -1994,7 +1994,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ /* Long options */ case CURLOPT_SSL_VERIFYHOST: convert_to_int(zvalue); - if (Z_IVAL_P(zvalue) == 1) { + if (Z_LVAL_P(zvalue) == 1) { #if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead"); #else @@ -2151,16 +2151,16 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM >= 0x71304 if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) && - (PG(open_basedir) && *PG(open_basedir)) && (Z_IVAL_P(zvalue) & CURLPROTO_FILE)) { + (PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_P(zvalue) & CURLPROTO_FILE)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set"); return 1; } #endif - error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); break; case CURLOPT_SAFE_UPLOAD: convert_to_int_ex(zvalue); - ch->safe_upload = (Z_IVAL_P(zvalue) != 0); + ch->safe_upload = (Z_LVAL_P(zvalue) != 0); break; /* String options */ @@ -2222,7 +2222,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ #endif { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); } /* Curl nullable string options */ @@ -2245,7 +2245,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ error = curl_easy_setopt(ch->cp, option, NULL); } else { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); } break; } @@ -2253,12 +2253,12 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ /* Curl private option */ case CURLOPT_PRIVATE: convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 1 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 1 TSRMLS_CC); /* Curl url option */ case CURLOPT_URL: convert_to_string_ex(zvalue); - return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue) TSRMLS_CC); + return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue) TSRMLS_CC); /* Curl file handle options */ case CURLOPT_FILE: @@ -2439,13 +2439,13 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM < 0x071304 if (PG(open_basedir) && *PG(open_basedir)) { - if (Z_IVAL_P(zvalue) != 0) { + if (Z_LVAL_P(zvalue) != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set"); return FAILURE; } } #endif - error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); break; case CURLOPT_HEADERFUNCTION: @@ -2476,9 +2476,9 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ char *postval; /* Pretend we have a string_key here */ if (!string_key) { - string_key = zend_int_to_str(num_key); + string_key = zend_longo_str(num_key); } else { - STR_ADDREF(string_key); + zend_string_addref(string_key); } if (Z_TYPE_P(current) == IS_OBJECT && @@ -2498,11 +2498,11 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ } prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { type = Z_STRVAL_P(prop); } prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { filename = Z_STRVAL_P(prop); } error = curl_formadd(&first, &last, @@ -2514,7 +2514,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ CURLFORM_END); } - STR_RELEASE(string_key); + zend_string_release(string_key); continue; } @@ -2533,13 +2533,13 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ php_error_docref("curl.curlfile" TSRMLS_CC, E_DEPRECATED, "The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead"); - name = estrndup(postval, Z_STRSIZE_P(current)); + name = estrndup(postval, Z_STRLEN_P(current)); if ((type = php_memnstr(name, ";type=", sizeof(";type=") - 1, - name + Z_STRSIZE_P(current)))) { + name + Z_STRLEN_P(current)))) { *type = '\0'; } if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1, - name + Z_STRSIZE_P(current)))) { + name + Z_STRLEN_P(current)))) { *filename = '\0'; } /* open_basedir check */ @@ -2560,11 +2560,11 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ CURLFORM_COPYNAME, string_key->val, CURLFORM_NAMELENGTH, (long)string_key->len, CURLFORM_COPYCONTENTS, postval, - CURLFORM_CONTENTSLENGTH, (long)Z_STRSIZE_P(current), + CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_P(current), CURLFORM_END); } - STR_RELEASE(string_key); + zend_string_release(string_key); } ZEND_HASH_FOREACH_END(); SAVE_CURL_ERROR(ch, error); @@ -2581,17 +2581,17 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ #if LIBCURL_VERSION_NUM >= 0x071101 convert_to_string_ex(zvalue); /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_P(zvalue)); #else char *post = NULL; convert_to_string_ex(zvalue); - post = estrndup(Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue)); + post = estrndup(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue)); zend_llist_add_element(&ch->to_free->str, &post); curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); #endif } break; @@ -2620,7 +2620,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ case CURLOPT_RETURNTRANSFER: convert_to_int_ex(zvalue); - if (Z_IVAL_P(zvalue)) { + if (Z_LVAL_P(zvalue)) { ch->handlers->write->method = PHP_CURL_RETURN; } else { ch->handlers->write->method = PHP_CURL_STDOUT; @@ -2640,14 +2640,14 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ case CURLOPT_MAX_RECV_SPEED_LARGE: case CURLOPT_MAX_SEND_SPEED_LARGE: convert_to_int_ex(zvalue); - error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_IVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_LVAL_P(zvalue)); break; #endif #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ case CURLOPT_POSTREDIR: convert_to_int_ex(zvalue); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_IVAL_P(zvalue) & CURL_REDIR_POST_ALL); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_LVAL_P(zvalue) & CURL_REDIR_POST_ALL); break; #endif @@ -2684,16 +2684,16 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ { convert_to_string_ex(zvalue); - if (Z_STRSIZE_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { + if (Z_STRLEN_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { return FAILURE; } - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); } case CURLINFO_HEADER_OUT: convert_to_int_ex(zvalue); - if (Z_IVAL_P(zvalue) == 1) { + if (Z_LVAL_P(zvalue) == 1) { curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug); curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch); curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1); @@ -2744,10 +2744,10 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_ PHP_FUNCTION(curl_setopt) { zval *zid, *zvalue; - php_int_t options; + zend_long options; php_curl *ch; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) { return; } @@ -2772,7 +2772,7 @@ PHP_FUNCTION(curl_setopt_array) { zval *zid, *arr, *entry; php_curl *ch; - php_uint_t option; + zend_ulong option; zend_string *string_key; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) { @@ -2787,7 +2787,7 @@ PHP_FUNCTION(curl_setopt_array) "Array keys must be CURLOPT constants or equivalent integer values"); RETURN_FALSE; } - if (_php_curl_setopt(ch, (php_int_t) option, entry TSRMLS_CC) == FAILURE) { + if (_php_curl_setopt(ch, (zend_long) option, entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } } ZEND_HASH_FOREACH_END(); @@ -2802,7 +2802,7 @@ void _php_curl_cleanup_handle(php_curl *ch) { smart_str_free(&ch->handlers->write->buf); if (ch->header.str) { - STR_RELEASE(ch->header.str); + zend_string_release(ch->header.str); ch->header.str = NULL; } @@ -2847,7 +2847,7 @@ PHP_FUNCTION(curl_exec) if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) { smart_str_0(&ch->handlers->write->buf); - RETURN_STR(STR_COPY(ch->handlers->write->buf.s)); + RETURN_STR(zend_string_copy(ch->handlers->write->buf.s)); } /* flush the file handle, so any remaining data is synched to disk */ @@ -2872,9 +2872,9 @@ PHP_FUNCTION(curl_getinfo) { zval *zid; php_curl *ch; - php_int_t option = 0; + zend_long option = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zid, &option) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zid, &option) == FAILURE) { return; } @@ -2882,7 +2882,7 @@ PHP_FUNCTION(curl_getinfo) if (ZEND_NUM_ARGS() < 2) { char *s_code; - php_int_t l_code; + zend_long l_code; double d_code; #if LIBCURL_VERSION_NUM > 0x071301 struct curl_certinfo *ci = NULL; @@ -2992,7 +2992,7 @@ PHP_FUNCTION(curl_getinfo) switch (option) { case CURLINFO_HEADER_OUT: if (ch->header.str) { - RETURN_STR(STR_COPY(ch->header.str)); + RETURN_STR(zend_string_copy(ch->header.str)); } else { RETURN_FALSE; } @@ -3026,10 +3026,10 @@ PHP_FUNCTION(curl_getinfo) } case CURLINFO_LONG: { - php_int_t code = 0; + zend_long code = 0; if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { - RETURN_INT(code); + RETURN_LONG(code); } else { RETURN_FALSE; } @@ -3103,7 +3103,7 @@ PHP_FUNCTION(curl_errno) ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_INT(ch->err.no); + RETURN_LONG(ch->err.no); } /* }}} */ @@ -3175,7 +3175,7 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC) #endif zval_ptr_dtor(&ch->handlers->std_err); if (ch->header.str) { - STR_RELEASE(ch->header.str); + zend_string_release(ch->header.str); } zval_ptr_dtor(&ch->handlers->write_header->stream); @@ -3217,10 +3217,10 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC) return string describing error code */ PHP_FUNCTION(curl_strerror) { - php_int_t code; + zend_long code; const char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { return; } @@ -3363,17 +3363,17 @@ PHP_FUNCTION(curl_unescape) pause and unpause a connection */ PHP_FUNCTION(curl_pause) { - php_int_t bitmask; + zend_long bitmask; zval *zid; php_curl *ch; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zid, &bitmask) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zid, &bitmask) == FAILURE) { return; } ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_INT(curl_easy_pause(ch->cp, bitmask)); + RETURN_LONG(curl_easy_pause(ch->cp, bitmask)); } /* }}} */ #endif diff --git a/ext/curl/multi.c b/ext/curl/multi.c index a3441bda78..14f1e1ae84 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -92,7 +92,7 @@ PHP_FUNCTION(curl_multi_add_handle) zend_llist_add_element(&mh->easyh, &tmp_val); - RETURN_INT((php_int_t)curl_multi_add_handle(mh->multi, ch->cp)); + RETURN_LONG((zend_long)curl_multi_add_handle(mh->multi, ch->cp)); } /* }}} */ @@ -140,7 +140,7 @@ PHP_FUNCTION(curl_multi_remove_handle) ZEND_FETCH_RESOURCE(mh, php_curlm *, z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); ZEND_FETCH_RESOURCE(ch, php_curl *, z_ch, -1, le_curl_name, le_curl); - RETVAL_INT((php_int_t)curl_multi_remove_handle(mh->multi, ch->cp)); + RETVAL_LONG((zend_long)curl_multi_remove_handle(mh->multi, ch->cp)); zend_llist_del_element(&mh->easyh, &z_ch, (int (*)(void *, void *))curl_compare_resources); } @@ -183,9 +183,9 @@ PHP_FUNCTION(curl_multi_select) curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); if (maxfd == -1) { - RETURN_INT(-1); + RETURN_LONG(-1); } - RETURN_INT(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); + RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } /* }}} */ @@ -219,11 +219,11 @@ PHP_FUNCTION(curl_multi_exec) } convert_to_int_ex(z_still_running); - still_running = Z_IVAL_P(z_still_running); + still_running = Z_LVAL_P(z_still_running); result = curl_multi_perform(mh->multi, &still_running); - ZVAL_INT(z_still_running, still_running); + ZVAL_LONG(z_still_running, still_running); - RETURN_INT(result); + RETURN_LONG(result); } /* }}} */ @@ -242,7 +242,7 @@ PHP_FUNCTION(curl_multi_getcontent) if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) { smart_str_0(&ch->handlers->write->buf); - RETURN_STR(STR_COPY(ch->handlers->write->buf.s)); + RETURN_STR(zend_string_copy(ch->handlers->write->buf.s)); } RETURN_EMPTY_STRING(); @@ -271,12 +271,12 @@ PHP_FUNCTION(curl_multi_info_read) } if (zmsgs_in_queue) { zval_dtor(zmsgs_in_queue); - ZVAL_INT(zmsgs_in_queue, queued_msgs); + ZVAL_LONG(zmsgs_in_queue, queued_msgs); } array_init(return_value); - add_assoc_int(return_value, "msg", tmp_msg->msg); - add_assoc_int(return_value, "result", tmp_msg->data.result); + add_assoc_long(return_value, "msg", tmp_msg->msg); + add_assoc_long(return_value, "result", tmp_msg->data.result); /* find the original easy curl handle */ { @@ -357,10 +357,10 @@ void _php_curl_multi_close(zend_resource *rsrc TSRMLS_DC) /* {{{ */ return string describing error code */ PHP_FUNCTION(curl_multi_strerror) { - php_int_t code; + zend_long code; const char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { return; } @@ -375,7 +375,7 @@ PHP_FUNCTION(curl_multi_strerror) #endif #if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */ -static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ +static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ { CURLMcode error = CURLM_OK; @@ -387,7 +387,7 @@ static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue, case CURLMOPT_MAXCONNECTS: #endif convert_to_int_ex(zvalue); - error = curl_multi_setopt(mh->multi, option, Z_IVAL_P(zvalue)); + error = curl_multi_setopt(mh->multi, option, Z_LVAL_P(zvalue)); break; default: @@ -409,10 +409,10 @@ static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue, PHP_FUNCTION(curl_multi_setopt) { zval *z_mh, *zvalue; - php_int_t options; + zend_long options; php_curlm *mh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_mh, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_mh, &options, &zvalue) == FAILURE) { return; } diff --git a/ext/curl/share.c b/ext/curl/share.c index a0d5b006d0..254ab2d2d6 100644 --- a/ext/curl/share.c +++ b/ext/curl/share.c @@ -66,7 +66,7 @@ PHP_FUNCTION(curl_share_close) } /* }}} */ -static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ +static int _php_curl_share_setopt(php_curlsh *sh, zend_long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ { CURLSHcode error = CURLSHE_OK; @@ -74,7 +74,7 @@ static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue case CURLSHOPT_SHARE: case CURLSHOPT_UNSHARE: convert_to_int_ex(zvalue); - error = curl_share_setopt(sh->share, option, Z_IVAL_P(zvalue)); + error = curl_share_setopt(sh->share, option, Z_LVAL_P(zvalue)); break; default: @@ -96,10 +96,10 @@ static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue PHP_FUNCTION(curl_share_setopt) { zval *zid, *zvalue; - php_int_t options; + zend_long options; php_curlsh *sh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) { return; } diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index ad25f8b5c6..26bf8f5686 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -176,7 +176,7 @@ void timelib_error_container_dtor(timelib_error_container *errors) free(errors); } -php_int_t timelib_date_to_int(timelib_time *d, int *error) +zend_long timelib_date_to_int(timelib_time *d, int *error) { timelib_sll ts; @@ -191,7 +191,7 @@ php_int_t timelib_date_to_int(timelib_time *d, int *error) if (error) { *error = 0; } - return (php_int_t) d->sse; + return (zend_long) d->sse; } void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec) diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index 45160ae238..1185dbfe5c 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -21,7 +21,7 @@ #ifndef __TIMELIB_H__ #define __TIMELIB_H__ -#include "php.h" /* for php_int_t */ +#include "php.h" /* for zend_long */ #include "timelib_structs.h" #if HAVE_LIMITS_H #include <limits.h> @@ -129,7 +129,7 @@ void timelib_time_offset_dtor(timelib_time_offset* t); void timelib_error_container_dtor(timelib_error_container *errors); -php_int_t timelib_date_to_int(timelib_time *d, int *error); +zend_long timelib_date_to_int(timelib_time *d, int *error); void timelib_dump_date(timelib_time *d, int options); void timelib_dump_rel_time(timelib_rel_time *d); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1cdf4d6348..e8e135d83a 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -860,9 +860,9 @@ PHP_MINIT_FUNCTION(date) REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); php_date_global_timezone_db = NULL; php_date_global_timezone_db_enabled = 0; @@ -962,7 +962,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) zval ztz; if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) - && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } } else if (*DATEG(default_timezone)) { @@ -1217,9 +1217,9 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) { char *format; int format_len; - php_int_t ts; + zend_long ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 1) { @@ -1373,10 +1373,10 @@ PHP_FUNCTION(idate) { char *format; int format_len; - php_int_t ts = 0; + zend_long ts = 0; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } @@ -1394,7 +1394,7 @@ PHP_FUNCTION(idate) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); RETURN_FALSE; } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1411,12 +1411,12 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb) /* }}} */ /* {{{ php_parse_date: Backwards compatibility function */ -PHPAPI php_int_t php_parse_date(char *string, php_int_t *now) +PHPAPI zend_long php_parse_date(char *string, zend_long *now) { timelib_time *parsed_time; timelib_error_container *error = NULL; int error2; - php_int_t retval; + zend_long retval; parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); if (error->error_count) { @@ -1442,14 +1442,14 @@ PHP_FUNCTION(strtotime) char *times, *initial_ts; int time_len, error1, error2; struct timelib_error_container *error; - php_int_t preset_ts = 0, ts; + zend_long preset_ts = 0, ts; timelib_time *t, *now; timelib_tzinfo *tzi; tzi = get_timezone_info(TSRMLS_C); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "si", ×, &time_len, &preset_ts) != FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", ×, &time_len, &preset_ts) != FAILURE) { /* We have an initial timestamp */ now = timelib_time_ctor(); @@ -1462,7 +1462,7 @@ PHP_FUNCTION(strtotime) timelib_unixtime2local(now, t->sse); timelib_time_dtor(t); efree(initial_ts); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", ×, &time_len, &preset_ts) != FAILURE) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ×, &time_len, &preset_ts) != FAILURE) { /* We have no initial timestamp */ now = timelib_time_ctor(); now->tz_info = tzi; @@ -1490,7 +1490,7 @@ PHP_FUNCTION(strtotime) if (error1 || error2) { RETURN_FALSE; } else { - RETURN_INT(ts); + RETURN_LONG(ts); } } /* }}} */ @@ -1498,13 +1498,13 @@ PHP_FUNCTION(strtotime) /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { - php_int_t hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1; + zend_long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1; timelib_time *now; timelib_tzinfo *tzi = NULL; - php_int_t ts, adjust_seconds = 0; + zend_long ts, adjust_seconds = 0; int error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iiiiiii", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lllllll", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) { RETURN_FALSE; } /* Initialize structure with current time */ @@ -1582,7 +1582,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) if (error) { RETURN_FALSE; } else { - RETURN_INT(ts); + RETURN_LONG(ts); } } /* }}} */ @@ -1607,9 +1607,9 @@ PHP_FUNCTION(gmmktime) Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) { - php_int_t m, d, y; + zend_long m, d, y; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &m, &d, &y) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) { RETURN_FALSE; } @@ -1626,7 +1626,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { char *format; int format_len; - php_int_t timestamp = 0; + zend_long timestamp = 0; struct tm ta; int max_reallocs = 5; size_t buf_len = 256, real_len; @@ -1635,9 +1635,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) timelib_time_offset *offset = NULL; zend_string *buf; - timestamp = (php_int_t) time(NULL); + timestamp = (zend_long) time(NULL); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -1686,10 +1686,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) /* VS2012 crt has a bug where strftime crash with %z and %Z format when the initial buffer is too small. See http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */ - buf = STR_ALLOC(buf_len, 0); + buf = zend_string_alloc(buf_len, 0); while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) { buf_len *= 2; - buf = STR_REALLOC(buf, buf_len, 0); + buf = zend_string_realloc(buf, buf_len, 0); if (!--max_reallocs) { break; } @@ -1708,10 +1708,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) } if (real_len && real_len != buf_len) { - buf = STR_REALLOC(buf, real_len, 0); + buf = zend_string_realloc(buf, real_len, 0); RETURN_STR(buf); } - STR_FREE(buf); + zend_string_free(buf); RETURN_FALSE; } /* }}} */ @@ -1737,7 +1737,7 @@ PHP_FUNCTION(gmstrftime) Return current UNIX timestamp */ PHP_FUNCTION(time) { - RETURN_INT((php_int_t)time(NULL)); + RETURN_LONG((zend_long)time(NULL)); } /* }}} */ @@ -1745,12 +1745,12 @@ PHP_FUNCTION(time) Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */ PHP_FUNCTION(localtime) { - php_int_t timestamp = (php_int_t)time(NULL); + zend_long timestamp = (zend_long)time(NULL); zend_bool associative = 0; timelib_tzinfo *tzi; timelib_time *ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ib", ×tamp, &associative) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", ×tamp, &associative) == FAILURE) { RETURN_FALSE; } @@ -1763,25 +1763,25 @@ PHP_FUNCTION(localtime) array_init(return_value); if (associative) { - add_assoc_int(return_value, "tm_sec", ts->s); - add_assoc_int(return_value, "tm_min", ts->i); - add_assoc_int(return_value, "tm_hour", ts->h); - add_assoc_int(return_value, "tm_mday", ts->d); - add_assoc_int(return_value, "tm_mon", ts->m - 1); - add_assoc_int(return_value, "tm_year", ts->y - 1900); - add_assoc_int(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_int(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); - add_assoc_int(return_value, "tm_isdst", ts->dst); + add_assoc_long(return_value, "tm_sec", ts->s); + add_assoc_long(return_value, "tm_min", ts->i); + add_assoc_long(return_value, "tm_hour", ts->h); + add_assoc_long(return_value, "tm_mday", ts->d); + add_assoc_long(return_value, "tm_mon", ts->m - 1); + add_assoc_long(return_value, "tm_year", ts->y - 1900); + add_assoc_long(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_long(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_long(return_value, "tm_isdst", ts->dst); } else { - add_next_index_int(return_value, ts->s); - add_next_index_int(return_value, ts->i); - add_next_index_int(return_value, ts->h); - add_next_index_int(return_value, ts->d); - add_next_index_int(return_value, ts->m - 1); - add_next_index_int(return_value, ts->y- 1900); - add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); - add_next_index_int(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); - add_next_index_int(return_value, ts->dst); + add_next_index_long(return_value, ts->s); + add_next_index_long(return_value, ts->i); + add_next_index_long(return_value, ts->h); + add_next_index_long(return_value, ts->d); + add_next_index_long(return_value, ts->m - 1); + add_next_index_long(return_value, ts->y- 1900); + add_next_index_long(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); + add_next_index_long(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); + add_next_index_long(return_value, ts->dst); } timelib_time_dtor(ts); @@ -1792,11 +1792,11 @@ PHP_FUNCTION(localtime) Get date/time information */ PHP_FUNCTION(getdate) { - php_int_t timestamp = (php_int_t)time(NULL); + zend_long timestamp = (zend_long)time(NULL); timelib_tzinfo *tzi; timelib_time *ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", ×tamp) == FAILURE) { RETURN_FALSE; } @@ -1808,17 +1808,17 @@ PHP_FUNCTION(getdate) array_init(return_value); - add_assoc_int(return_value, "seconds", ts->s); - add_assoc_int(return_value, "minutes", ts->i); - add_assoc_int(return_value, "hours", ts->h); - add_assoc_int(return_value, "mday", ts->d); - add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_int(return_value, "mon", ts->m); - add_assoc_int(return_value, "year", ts->y); - add_assoc_int(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_long(return_value, "seconds", ts->s); + add_assoc_long(return_value, "minutes", ts->i); + add_assoc_long(return_value, "hours", ts->h); + add_assoc_long(return_value, "mday", ts->d); + add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_long(return_value, "mon", ts->m); + add_assoc_long(return_value, "year", ts->y); + add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]); - add_index_int(return_value, 0, timestamp); + add_index_long(return_value, 0, timestamp); timelib_time_dtor(ts); } @@ -1925,7 +1925,7 @@ static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC) static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - ZVAL_INT(key, iterator->current_index); + ZVAL_LONG(key, iterator->current_index); } /* }}} */ @@ -2049,7 +2049,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_timezone.get_gc = date_object_get_gc_timezone; #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_int(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); @@ -2096,7 +2096,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_period.write_property = date_period_write_property; #define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_int(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE); } /* }}} */ @@ -2203,7 +2203,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */ /* then we add the timezone name (or similar) */ if (dateobj->time->is_localtime) { - ZVAL_INT(&zv, dateobj->time->zone_type); + ZVAL_LONG(&zv, dateobj->time->zone_type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (dateobj->time->zone_type) { @@ -2211,7 +2211,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */ ZVAL_STRING(&zv, dateobj->time->tz_info->name); break; case TIMELIB_ZONETYPE_OFFSET: { - zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0); + zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0); timelib_sll utc_offset = dateobj->time->z; tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d", @@ -2296,7 +2296,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /* return props; } - ZVAL_INT(&zv, tzobj->type); + ZVAL_LONG(&zv, tzobj->type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (tzobj->type) { @@ -2304,7 +2304,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /* ZVAL_STRING(&zv, tzobj->tzi.tz->name); break; case TIMELIB_ZONETYPE_OFFSET: { - zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0); + zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0); tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d", tzobj->tzi.utc_offset > 0 ? '-' : '+', @@ -2377,7 +2377,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) /* } #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ - ZVAL_INT(&zv, (php_int_t)intervalobj->diff->f); \ + ZVAL_LONG(&zv, (zend_long)intervalobj->diff->f); \ zend_hash_str_update(props, n, sizeof(n)-1, &zv); PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); @@ -2765,13 +2765,13 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht if (z_timezone) { convert_to_string(z_timezone); - switch (Z_IVAL_P(z_timezone_type)) { + switch (Z_LVAL_P(z_timezone_type)) { case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_ABBR: { - char *tmp = emalloc(Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2); + char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2); int ret; - snprintf(tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); - ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); + ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); return 1 == ret; } @@ -2791,7 +2791,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht tzobj->tzi.tz = tzi; tzobj->initialized = 1; - ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRSIZE_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); + ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); return 1 == ret; } @@ -2870,14 +2870,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) / int i; zval element; - add_assoc_int(z, "warning_count", error->warning_count); + add_assoc_long(z, "warning_count", error->warning_count); array_init(&element); for (i = 0; i < error->warning_count; i++) { add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message); } add_assoc_zval(z, "warnings", &element); - add_assoc_int(z, "error_count", error->error_count); + add_assoc_long(z, "error_count", error->error_count); array_init(&element); for (i = 0; i < error->error_count; i++) { add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message); @@ -2908,7 +2908,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * if (parsed_time->elem == -99999) { \ add_assoc_bool(return_value, #name, 0); \ } else { \ - add_assoc_int(return_value, #name, parsed_time->elem); \ + add_assoc_long(return_value, #name, parsed_time->elem); \ } PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y); PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m); @@ -2953,17 +2953,17 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * } if (parsed_time->have_relative) { array_init(&element); - add_assoc_int(&element, "year", parsed_time->relative.y); - add_assoc_int(&element, "month", parsed_time->relative.m); - add_assoc_int(&element, "day", parsed_time->relative.d); - add_assoc_int(&element, "hour", parsed_time->relative.h); - add_assoc_int(&element, "minute", parsed_time->relative.i); - add_assoc_int(&element, "second", parsed_time->relative.s); + add_assoc_long(&element, "year", parsed_time->relative.y); + add_assoc_long(&element, "month", parsed_time->relative.m); + add_assoc_long(&element, "day", parsed_time->relative.d); + add_assoc_long(&element, "hour", parsed_time->relative.h); + add_assoc_long(&element, "minute", parsed_time->relative.i); + add_assoc_long(&element, "second", parsed_time->relative.s); if (parsed_time->relative.have_weekday_relative) { - add_assoc_int(&element, "weekday", parsed_time->relative.weekday); + add_assoc_long(&element, "weekday", parsed_time->relative.weekday); } if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) { - add_assoc_int(&element, "weekdays", parsed_time->relative.special.amount); + add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount); } if (parsed_time->relative.first_last_day_of) { add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); @@ -3360,24 +3360,24 @@ PHP_FUNCTION(date_offset_get) switch (dateobj->time->zone_type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info); - RETVAL_INT(offset->offset); + RETVAL_LONG(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETVAL_INT(dateobj->time->z * -60); + RETVAL_LONG(dateobj->time->z * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETVAL_INT((dateobj->time->z - (60 * dateobj->time->dst)) * -60); + RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60); break; } return; } else { - RETURN_INT(0); + RETURN_LONG(0); } } /* }}} */ -static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t s, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long s, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3395,9 +3395,9 @@ static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t PHP_FUNCTION(date_time_set) { zval *object; - php_int_t h, i, s = 0; + zend_long h, i, s = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &h, &i, &s) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) { RETURN_FALSE; } @@ -3412,9 +3412,9 @@ PHP_FUNCTION(date_time_set) PHP_METHOD(DateTimeImmutable, setTime) { zval *object, new_object; - php_int_t h, i, s = 0; + zend_long h, i, s = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &h, &i, &s) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) { RETURN_FALSE; } @@ -3425,7 +3425,7 @@ PHP_METHOD(DateTimeImmutable, setTime) } /* }}} */ -static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_date_set(zval *object, zend_long y, zend_long m, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3443,9 +3443,9 @@ static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t PHP_FUNCTION(date_date_set) { zval *object; - php_int_t y, m, d; + zend_long y, m, d; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_date, &y, &m, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) { RETURN_FALSE; } @@ -3460,9 +3460,9 @@ PHP_FUNCTION(date_date_set) PHP_METHOD(DateTimeImmutable, setDate) { zval *object, new_object; - php_int_t y, m, d; + zend_long y, m, d; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_immutable, &y, &m, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) { RETURN_FALSE; } @@ -3473,7 +3473,7 @@ PHP_METHOD(DateTimeImmutable, setDate) } /* }}} */ -static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_isodate_set(zval *object, zend_long y, zend_long w, zend_long d, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3495,9 +3495,9 @@ static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int PHP_FUNCTION(date_isodate_set) { zval *object; - php_int_t y, w, d = 1; + zend_long y, w, d = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &y, &w, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) { RETURN_FALSE; } @@ -3512,9 +3512,9 @@ PHP_FUNCTION(date_isodate_set) PHP_METHOD(DateTimeImmutable, setISODate) { zval *object, new_object; - php_int_t y, w, d = 1; + zend_long y, w, d = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &y, &w, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) { RETURN_FALSE; } @@ -3525,7 +3525,7 @@ PHP_METHOD(DateTimeImmutable, setISODate) } /* }}} */ -static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_timestamp_set(zval *object, zend_long timestamp, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3541,9 +3541,9 @@ static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *retu PHP_FUNCTION(date_timestamp_set) { zval *object; - php_int_t timestamp; + zend_long timestamp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_date, ×tamp) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -3558,9 +3558,9 @@ PHP_FUNCTION(date_timestamp_set) PHP_METHOD(DateTimeImmutable, setTimestamp) { zval *object, new_object; - php_int_t timestamp; + zend_long timestamp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_immutable, ×tamp) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -3578,7 +3578,7 @@ PHP_FUNCTION(date_timestamp_get) { zval *object; php_date_obj *dateobj; - php_int_t timestamp; + zend_long timestamp; int error; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) { @@ -3592,7 +3592,7 @@ PHP_FUNCTION(date_timestamp_get) if (error) { RETURN_FALSE; } else { - RETVAL_INT(timestamp); + RETVAL_LONG(timestamp); } } /* }}} */ @@ -3605,9 +3605,9 @@ PHP_FUNCTION(date_diff) zval *object1, *object2; php_date_obj *dateobj1, *dateobj2; php_interval_obj *interval; - php_int_t absolute = 0; + zend_long absolute = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) { RETURN_FALSE; } dateobj1 = Z_PHPDATE_P(object1); @@ -3756,7 +3756,7 @@ PHP_FUNCTION(timezone_name_get) RETURN_STRING(tzobj->tzi.tz->name); break; case TIMELIB_ZONETYPE_OFFSET: { - zend_string *tmpstr = STR_ALLOC(sizeof("UTC+05:00")-1, 0); + zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0); timelib_sll utc_offset = tzobj->tzi.utc_offset; tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d", @@ -3782,10 +3782,10 @@ PHP_FUNCTION(timezone_name_from_abbr) char *abbr; char *tzid; int abbr_len; - php_int_t gmtoffset = -1; - php_int_t isdst = -1; + zend_long gmtoffset = -1; + zend_long isdst = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { RETURN_FALSE; } tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst); @@ -3819,14 +3819,14 @@ PHP_FUNCTION(timezone_offset_get) switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); - RETVAL_INT(offset->offset); + RETVAL_LONG(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETURN_INT(tzobj->tzi.utc_offset * -60); + RETURN_LONG(tzobj->tzi.utc_offset * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETURN_INT((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); + RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); break; } } @@ -3840,9 +3840,9 @@ PHP_FUNCTION(timezone_transitions_get) zval *object, element; php_timezone_obj *tzobj; unsigned int i, begin = 0, found; - php_int_t timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX; + zend_long timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ii", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { RETURN_FALSE; } tzobj = Z_PHPTIMEZONE_P(object); @@ -3853,18 +3853,18 @@ PHP_FUNCTION(timezone_transitions_get) #define add_nominal() \ array_init(&element); \ - add_assoc_int(&element, "ts", timestamp_begin); \ + add_assoc_long(&element, "ts", timestamp_begin); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \ - add_assoc_int(&element, "offset", tzobj->tzi.tz->type[0].offset); \ + add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \ add_next_index_zval(return_value, &element); #define add(i,ts) \ array_init(&element); \ - add_assoc_int(&element, "ts", ts); \ + add_assoc_long(&element, "ts", ts); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \ - add_assoc_int(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ + add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \ add_next_index_zval(return_value, &element); @@ -4023,7 +4023,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c retval = rv; if (value != -99999) { - ZVAL_INT(retval, value); + ZVAL_LONG(retval, value); } else { ZVAL_FALSE(retval); } @@ -4062,7 +4062,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ - obj->diff->n = zval_get_int(value); \ + obj->diff->n = zval_get_long(value); \ break; \ } @@ -4119,7 +4119,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter do { \ zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ if (z_arg) { \ - (*intobj)->diff->member = (itype)zval_get_int(z_arg); \ + (*intobj)->diff->member = (itype)zval_get_long(z_arg); \ } else { \ (*intobj)->diff->member = (itype)def; \ } \ @@ -4131,7 +4131,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter if (z_arg) { \ zend_string *str = zval_get_string(z_arg); \ DATE_A64I((*intobj)->diff->member, str->val); \ - STR_RELEASE(str); \ + zend_string_release(str); \ } else { \ (*intobj)->diff->member = -1LL; \ } \ @@ -4248,8 +4248,8 @@ static zend_string *date_interval_format(char *format, int format_len, timelib_r case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break; case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break; - case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (php_int_t) t->s); break; - case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (php_int_t) t->s); break; + case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (zend_long) t->s); break; + case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (zend_long) t->s); break; case 'a': { if ((int) t->days != -99999) { @@ -4301,7 +4301,7 @@ PHP_FUNCTION(date_interval_format) } /* }}} */ -static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, php_int_t *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */ +static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, zend_long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */ { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4334,16 +4334,16 @@ PHP_METHOD(DatePeriod, __construct) php_date_obj *dateobj; php_interval_obj *intobj; zval *start, *end = NULL, *interval; - php_int_t recurrences = 0, options = 0; + zend_long recurrences = 0, options = 0; char *isostr = NULL; int isostr_len = 0; timelib_time *clone; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOi|i", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|i", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &isostr, &isostr_len, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments."); zend_restore_error_handling(&error_handling TSRMLS_CC); return; @@ -4413,7 +4413,7 @@ PHP_METHOD(DatePeriod, __construct) } /* }}} */ -static int check_id_allowed(char *id, php_int_t what) /* {{{ */ +static int check_id_allowed(char *id, zend_long what) /* {{{ */ { if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1; if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1; @@ -4437,11 +4437,11 @@ PHP_FUNCTION(timezone_identifiers_list) const timelib_tzdb *tzdb; const timelib_tzdb_index_entry *table; int i, item_count; - php_int_t what = PHP_DATE_TIMEZONE_GROUP_ALL; + zend_long what = PHP_DATE_TIMEZONE_GROUP_ALL; char *option = NULL; int option_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|is", &what, &option, &option_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) { RETURN_FALSE; } @@ -4496,7 +4496,7 @@ PHP_FUNCTION(timezone_abbreviations_list) do { array_init(&element); add_assoc_bool(&element, "dst", entry->type); - add_assoc_int(&element, "offset", entry->gmtoffset); + add_assoc_long(&element, "offset", entry->gmtoffset); if (entry->full_tz_name) { add_assoc_string(&element, "timezone_id", entry->full_tz_name); } else { @@ -4558,13 +4558,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude; double h_rise, h_set, N; timelib_sll rise, set, transit; - php_int_t time, retformat = 0; + zend_long time, retformat = 0; int rs; timelib_time *t; timelib_tzinfo *tzi; zend_string *retstr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|idddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) { RETURN_FALSE; } @@ -4617,7 +4617,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su } if (retformat == SUNFUNCS_RET_TIMESTAMP) { - RETURN_INT(calc_sunset ? set : rise); + RETURN_LONG(calc_sunset ? set : rise); } N = (calc_sunset ? h_set : h_rise) + gmt_offset; @@ -4657,7 +4657,7 @@ PHP_FUNCTION(date_sunset) Returns an array with information about sun set/rise and twilight begin/end */ PHP_FUNCTION(date_sun_info) { - php_int_t time; + zend_long time; double latitude, longitude; timelib_time *t, *t2; timelib_tzinfo *tzi; @@ -4666,7 +4666,7 @@ PHP_FUNCTION(date_sun_info) int dummy; double ddummy; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "idd", &time, &latitude, &longitude) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) { RETURN_FALSE; } /* Initialize time struct */ @@ -4693,12 +4693,12 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_int(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_int(return_value, "sunset", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "sunset", timelib_date_to_int(t2, &dummy)); } t2->sse = transit; - add_assoc_int(return_value, "transit", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy)); /* Get civil twilight */ rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); @@ -4713,9 +4713,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_int(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_int(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get nautical twilight */ @@ -4731,9 +4731,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_int(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_int(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get astronomical twilight */ @@ -4749,9 +4749,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_int(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_int(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); } timelib_time_dtor(t); timelib_time_dtor(t2); @@ -4821,7 +4821,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC) /* { zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv); /* converted to larger type (int->long); must check when unserializing */ - ZVAL_INT(&zv, (long) period_obj->recurrences); + ZVAL_LONG(&zv, (long) period_obj->recurrences); zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv); ZVAL_BOOL(&zv, period_obj->include_start_date); @@ -4891,8 +4891,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1); if (ht_entry && - Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) { - period_obj->recurrences = Z_IVAL_P(ht_entry); + Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) { + period_obj->recurrences = Z_LVAL_P(ht_entry); } else { return 0; } diff --git a/ext/date/php_date.h b/ext/date/php_date.h index cc71246d94..1d4ea16a2d 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -203,7 +203,7 @@ ZEND_END_MODULE_GLOBALS(date) #endif /* Backwards compatibility wrapper */ -PHPAPI php_int_t php_parse_date(char *string, php_int_t *now); +PHPAPI zend_long php_parse_date(char *string, zend_long *now); PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt); PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); #if HAVE_STRFTIME diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 8e0da59654..68751ed6d0 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -217,10 +217,10 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); convert_to_string_ex(group); convert_to_string_ex(name); - if (Z_STRSIZE_P(group) == 0) { + if (Z_STRLEN_P(group) == 0) { *key_str = Z_STRVAL_P(name); *key_free = NULL; - return Z_STRSIZE_P(name); + return Z_STRLEN_P(name); } len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name)); *key_free = *key_str; @@ -232,8 +232,8 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS ZVAL_COPY(&tmp, key); convert_to_string(&tmp); - *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); - len = Z_STRSIZE(tmp); + *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + len = Z_STRLEN(tmp); zval_ptr_dtor(&tmp); return len; @@ -256,7 +256,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS zval *key; \ char *key_str, *key_free; \ size_t key_len; \ - php_int_t skip = 0; \ + zend_long skip = 0; \ switch(ac) { \ case 2: \ if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \ @@ -264,7 +264,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS } \ break; \ case 3: \ - if (zend_parse_parameters(ac TSRMLS_CC, "zir", &key, &skip, &id) == FAILURE) { \ + if (zend_parse_parameters(ac TSRMLS_CC, "zlr", &key, &skip, &id) == FAILURE) { \ return; \ } \ break; \ @@ -646,7 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else if (Z_REFCOUNTED(args[i])) { Z_ADDREF(args[i]); } - keylen += Z_STRSIZE(args[i]); + keylen += Z_STRLEN(args[i]); } if (persistent) { @@ -658,8 +658,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) keylen = 0; for(i = 0; i < ac; i++) { - memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); - keylen += Z_STRSIZE(args[i]); + memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i])); + keylen += Z_STRLEN(args[i]); } /* try to find if we already have this link in our persistent list */ @@ -1243,7 +1243,7 @@ PHP_FUNCTION(dba_handlers) List opened databases */ PHP_FUNCTION(dba_list) { - php_uint_t numitems, i; + zend_ulong numitems, i; zend_resource *le; dba_info *info; diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c index 9f16cb4cd2..66a6a57c60 100644 --- a/ext/dba/dba_db1.c +++ b/ext/dba/dba_db1.c @@ -52,7 +52,7 @@ DBA_OPEN_FUNC(db1) if (info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } gmode = 0; diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c index c4c17a1661..518e5c2093 100644 --- a/ext/dba/dba_db2.c +++ b/ext/dba/dba_db2.c @@ -73,7 +73,7 @@ DBA_OPEN_FUNC(db2) if (info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c index 5ed6f502cc..599a15ad97 100644 --- a/ext/dba/dba_db3.c +++ b/ext/dba/dba_db3.c @@ -82,7 +82,7 @@ DBA_OPEN_FUNC(db3) if (info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } #ifdef DB_FCNTL_LOCKING diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index a927c49ee5..4fab0b92ce 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -119,7 +119,7 @@ DBA_OPEN_FUNC(db4) if (info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if ((err=db_create(&dbp, NULL, 0)) == 0) { diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c index 5d5a234670..1d07998d62 100644 --- a/ext/dba/dba_dbm.c +++ b/ext/dba/dba_dbm.c @@ -61,7 +61,7 @@ DBA_OPEN_FUNC(dbm) if(info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if(info->mode == DBA_TRUNC) { diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c index c5a2bccee0..362eddd879 100644 --- a/ext/dba/dba_gdbm.c +++ b/ext/dba/dba_gdbm.c @@ -55,7 +55,7 @@ DBA_OPEN_FUNC(gdbm) if(info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c index 6805c45d9f..d2524ada48 100644 --- a/ext/dba/dba_ndbm.c +++ b/ext/dba/dba_ndbm.c @@ -60,7 +60,7 @@ DBA_OPEN_FUNC(ndbm) if(info->argc > 0) { convert_to_int_ex(&info->argv[0]); - filemode = Z_IVAL(info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } dbf = dbm_open(info->path, gmode, filemode); diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index 7276ba6942..d4d4c62c4a 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -126,7 +126,7 @@ typedef struct dba_handler { DBA_SYNC_FUNC(x); \ DBA_INFO_FUNC(x) -#define VALLEN(p) Z_STRVAL_PP(p), Z_STRSIZE_PP(p) +#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p) PHP_FUNCTION(dba_open); PHP_FUNCTION(dba_popen); diff --git a/ext/dom/attr.c b/ext/dom/attr.c index b0489ef122..4cd4414691 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -175,7 +175,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC) xmlNodeSetContentLen((xmlNodePtr) attrp, str->val, str->len + 1); - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 390e4e032b..ccae33ab74 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -110,7 +110,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC) xmlNodeSetContentLen(nodep, str->val, str->len + 1); - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } @@ -139,7 +139,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval TSRMLS_DC) xmlFree(content); } - ZVAL_INT(retval, length); + ZVAL_LONG(retval, length); return SUCCESS; } @@ -156,11 +156,11 @@ PHP_FUNCTION(dom_characterdata_substring_data) xmlChar *cur; xmlChar *substring; xmlNodePtr node; - php_int_t offset, count; + zend_long offset, count; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -239,11 +239,11 @@ PHP_FUNCTION(dom_characterdata_insert_data) xmlChar *cur, *first, *second; xmlNodePtr node; char *arg; - php_int_t offset; + zend_long offset; int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { return; } @@ -286,11 +286,11 @@ PHP_FUNCTION(dom_characterdata_delete_data) zval *id; xmlChar *cur, *substring, *second; xmlNodePtr node; - php_int_t offset, count; + zend_long offset, count; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -342,11 +342,11 @@ PHP_FUNCTION(dom_characterdata_replace_data) xmlChar *cur, *substring, *second = NULL; xmlNodePtr node; char *arg; - php_int_t offset, count; + zend_long offset, count; int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiis", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { return; } diff --git a/ext/dom/document.c b/ext/dom/document.c index abe0c55f06..944d55c20b 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -352,7 +352,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document Encoding"); } - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } @@ -388,7 +388,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC) return FAILURE; } - standalone = zval_get_int(newval); + standalone = zval_get_long(newval); docp->standalone = ZEND_NORMALIZE_BOOL(standalone); return SUCCESS; @@ -440,7 +440,7 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC) docp->version = xmlStrdup((const xmlChar *) str->val); - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } @@ -668,7 +668,7 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC) docp->URL = xmlStrdup((const xmlChar *) str->val); - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } @@ -970,9 +970,9 @@ PHP_FUNCTION(dom_document_import_node) xmlNodePtr nodep, retnodep; dom_object *intern, *nodeobj; int ret; - php_int_t recursive = 0; + zend_long recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1465,14 +1465,14 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { dom_object *intern; char *source; int source_len, refcount, ret; - php_int_t options = 0; + zend_long options = 0; id = getThis(); if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { id = NULL; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) { return; } @@ -1547,9 +1547,9 @@ PHP_FUNCTION(dom_document_save) dom_object *intern; dom_doc_propsptr doc_props; char *file; - php_int_t options = 0; + zend_long options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) { return; } @@ -1575,7 +1575,7 @@ PHP_FUNCTION(dom_document_save) if (bytes == -1) { RETURN_FALSE; } - RETURN_INT(bytes); + RETURN_LONG(bytes); } /* }}} end dom_document_save */ @@ -1593,9 +1593,9 @@ PHP_FUNCTION(dom_document_savexml) dom_object *intern, *nodeobj; dom_doc_propsptr doc_props; int size, format, saveempty = 0; - php_int_t options = 0; + zend_long options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!i", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) { return; } @@ -1698,11 +1698,11 @@ PHP_FUNCTION(dom_document_xinclude) zval *id; xmlDoc *docp; xmlNodePtr root; - php_int_t flags = 0; + zend_long flags = 0; int err; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_document_class_entry, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) { return; } @@ -1723,7 +1723,7 @@ PHP_FUNCTION(dom_document_xinclude) } if (err) { - RETVAL_INT(err); + RETVAL_LONG(err); } else { RETVAL_FALSE; } @@ -1772,14 +1772,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type dom_object *intern; char *source = NULL, *valid_file = NULL; int source_len = 0, valid_opts = 0; - php_int_t flags = 0; + zend_long flags = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; xmlSchemaValidCtxtPtr vptr; int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|i", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { return; } @@ -1963,12 +1963,12 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ dom_doc_propsptr doc_prop; char *source; int source_len, refcount, ret; - php_int_t options = 0; + zend_long options = 0; htmlParserCtxtPtr ctxt; id = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) { return; } @@ -2087,7 +2087,7 @@ PHP_FUNCTION(dom_document_save_html_file) if (bytes == -1) { RETURN_FALSE; } - RETURN_INT(bytes); + RETURN_LONG(bytes); } /* }}} end dom_document_save_html_file */ diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 9abe2c7c20..22d0ab0ee3 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -158,7 +158,7 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key T zval *object = &iterator->intern.data; if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) { - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } else { dom_object *intern = Z_DOMOBJ_P(&iterator->curobj); diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 43c26605bc..bae0b28ec2 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -113,7 +113,7 @@ int dom_namednodemap_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_INT(retval, count); + ZVAL_LONG(retval, count); return SUCCESS; } @@ -200,7 +200,7 @@ Since: PHP_FUNCTION(dom_namednodemap_item) { zval *id; - php_int_t index; + zend_long index; int ret; dom_object *intern; xmlNodePtr itemnode = NULL; @@ -209,7 +209,7 @@ PHP_FUNCTION(dom_namednodemap_item) xmlNodePtr nodep, curnode; int count; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_namednodemap_class_entry, &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) { return; } if (index >= 0) { diff --git a/ext/dom/node.c b/ext/dom/node.c index f34c0347cb..32880ee7d9 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -345,7 +345,7 @@ int dom_node_node_value_write(dom_object *obj, zval *newval TSRMLS_DC) { zend_string *str = zval_get_string(newval); xmlNodeSetContentLen(nodep, str->val, str->len + 1); - STR_RELEASE(str); + zend_string_release(str); break; } default: @@ -375,9 +375,9 @@ int dom_node_node_type_read(dom_object *obj, zval *retval TSRMLS_DC) /* Specs dictate that they are both type XML_DOCUMENT_TYPE_NODE */ if (nodep->type == XML_DTD_NODE) { - ZVAL_INT(retval, XML_DOCUMENT_TYPE_NODE); + ZVAL_LONG(retval, XML_DOCUMENT_TYPE_NODE); } else { - ZVAL_INT(retval, nodep->type); + ZVAL_LONG(retval, nodep->type); } return SUCCESS; @@ -745,14 +745,14 @@ int dom_node_prefix_write(dom_object *obj, zval *newval TSRMLS_DC) } if (ns == NULL) { - STR_RELEASE(str); + zend_string_release(str); php_dom_throw_error(NAMESPACE_ERR, dom_get_strict_error(obj->document) TSRMLS_CC); return FAILURE; } xmlSetNs(nodep, ns); } - STR_RELEASE(str); + zend_string_release(str); break; default: break; @@ -1334,9 +1334,9 @@ PHP_FUNCTION(dom_node_clone_node) xmlNode *n, *node; int ret; dom_object *intern; - php_int_t recursive = 0; + zend_long recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_node_class_entry, &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1815,7 +1815,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ bytes = xmlOutputBufferClose(buf); if (mode == 1 && (ret >= 0)) { - RETURN_INT(bytes); + RETURN_LONG(bytes); } } } @@ -1872,7 +1872,7 @@ PHP_METHOD(domnode, getLineNo) DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern); - RETURN_INT(xmlGetLineNo(nodep)); + RETURN_LONG(xmlGetLineNo(nodep)); } /* }}} */ diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 5d45ad6edd..3ef43f2ac7 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -91,7 +91,7 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_INT(retval, count); + ZVAL_LONG(retval, count); return SUCCESS; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 49ac4740a9..7f1c19bd0e 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -321,7 +321,7 @@ static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot TSRMLS_CC); } - STR_RELEASE(member_str); + zend_string_release(member_str); return retval; } /* }}} */ @@ -352,7 +352,7 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, retval = std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC); } - STR_RELEASE(member_str); + zend_string_release(member_str); return retval; } /* }}} */ @@ -374,7 +374,7 @@ void dom_write_property(zval *object, zval *member, zval *value, void **cache_sl std_hnd->write_property(object, member, value, cache_slot TSRMLS_CC); } - STR_RELEASE(member_str); + zend_string_release(member_str); } /* }}} */ @@ -407,7 +407,7 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void retval = std_hnd->has_property(object, member, check_empty, cache_slot TSRMLS_CC); } - STR_RELEASE(member_str); + zend_string_release(member_str); return retval; } /* }}} */ @@ -440,7 +440,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC zend_hash_move_forward_ex(prop_handlers, &pos)) { zval value; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; if (entry->read_func(obj, &value TSRMLS_CC) == FAILURE) { continue; @@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(dom) INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions); dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_int(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry); @@ -860,56 +860,56 @@ PHP_MINIT_FUNCTION(dom) zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers); #endif - REGISTER_INT_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); #ifdef XML_GLOBAL_NAMESPACE - REGISTER_INT_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); /* DOMException Codes */ - REGISTER_INT_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); php_libxml_register_export(dom_node_class_entry, php_dom_export_node); diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 36b159cc6e..c46b1bf244 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -149,7 +149,7 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC xmlNodeSetContentLen(nodep, str->val, str->len + 1); - STR_RELEASE(str); + zend_string_release(str); return SUCCESS; } diff --git a/ext/dom/text.c b/ext/dom/text.c index 66bdcec0e4..9940dbf8d0 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -149,11 +149,11 @@ PHP_FUNCTION(dom_text_split_text) xmlChar *second; xmlNodePtr node; xmlNodePtr nnode; - php_int_t offset; + zend_long offset; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_text_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) { return; } DOM_GET_OBJ(node, id, xmlNodePtr, intern); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 8351946038..549411d768 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -223,12 +223,12 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, } else { zend_string *str = zval_get_string(&retval); valuePush(ctxt, xmlXPathNewString(str->val)); - STR_RELEASE(str); + zend_string_release(str); } zval_ptr_dtor(&retval); } } - STR_RELEASE(callable); + zend_string_release(callable); zval_dtor(&fci.function_name); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { @@ -524,10 +524,10 @@ PHP_FUNCTION(dom_xpath_register_php_functions) zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) { zend_string *str = zval_get_string(entry); - ZVAL_INT(&new_string,1); + ZVAL_LONG(&new_string,1); zend_hash_update(intern->registered_phpfunctions, str, &new_string); zend_hash_move_forward(Z_ARRVAL_P(array_value)); - STR_RELEASE(str); + zend_string_release(str); } intern->registerPhpFunctions = 2; RETURN_TRUE; @@ -535,7 +535,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XPATHOBJ_P(id); - ZVAL_INT(&new_string, 1); + ZVAL_LONG(&new_string, 1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; } else { diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index e8c9555152..28b8d1a15b 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -289,8 +289,8 @@ PHP_MINIT_FUNCTION(enchant) { le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant_broker", module_number); le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant_dict", module_number); - REGISTER_INT_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -422,11 +422,11 @@ PHP_FUNCTION(enchant_broker_set_dict_path) { zval *broker; enchant_broker *pbroker; - php_int_t dict_type; + zend_long dict_type; char *value; int value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris", &broker, &dict_type, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &broker, &dict_type, &value, &value_len) == FAILURE) { RETURN_FALSE; } @@ -462,10 +462,10 @@ PHP_FUNCTION(enchant_broker_get_dict_path) { zval *broker; enchant_broker *pbroker; - php_int_t dict_type; + zend_long dict_type; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &broker, &dict_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &broker, &dict_type) == FAILURE) { RETURN_FALSE; } diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 3a4cbbbb85..ca00b7a175 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -379,7 +379,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } else { if (match_len == 0) match_len = 1; - RETVAL_INT(match_len); + RETVAL_LONG(match_len); } regfree(&re); } @@ -564,33 +564,33 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_P(arg_pattern) == IS_STRING) { - if (Z_STRVAL_P(arg_pattern) && Z_STRSIZE_P(arg_pattern)) { - pattern = STR_COPY(Z_STR_P(arg_pattern)); + if (Z_STRVAL_P(arg_pattern) && Z_STRLEN_P(arg_pattern)) { + pattern = zend_string_copy(Z_STR_P(arg_pattern)); } else { pattern = STR_EMPTY_ALLOC(); } } else { convert_to_int_ex(arg_pattern); - pattern = STR_ALLOC(1, 0); - pattern->val[0] = (char) Z_IVAL_P(arg_pattern); + pattern = zend_string_alloc(1, 0); + pattern->val[0] = (char) Z_LVAL_P(arg_pattern); pattern->val[1] = '\0'; } if (Z_TYPE_P(arg_replace) == IS_STRING) { - if (Z_STRVAL_P(arg_replace) && Z_STRSIZE_P(arg_replace)) { - replace = STR_COPY(Z_STR_P(arg_replace)); + if (Z_STRVAL_P(arg_replace) && Z_STRLEN_P(arg_replace)) { + replace = zend_string_copy(Z_STR_P(arg_replace)); } else { replace = STR_EMPTY_ALLOC(); } } else { convert_to_int_ex(arg_replace); - replace = STR_ALLOC(1, 0); - replace->val[0] = (char) Z_IVAL_P(arg_replace); + replace = zend_string_alloc(1, 0); + replace->val[0] = (char) Z_LVAL_P(arg_replace); replace->val[1] = '\0'; } if (arg_string) { - string = STR_COPY(arg_string); + string = zend_string_copy(arg_string); } else { string = STR_EMPTY_ALLOC(); } @@ -604,9 +604,9 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) efree(ret); } - STR_RELEASE(string); - STR_RELEASE(replace); - STR_RELEASE(pattern); + zend_string_release(string); + zend_string_release(replace); + zend_string_release(pattern); } /* }}} */ @@ -630,14 +630,14 @@ PHP_FUNCTION(eregi_replace) */ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) { - php_int_t count = -1; + zend_long count = -1; regex_t re; regmatch_t subs[1]; char *spliton, *str, *strp, *endp; int spliton_len, str_len; int err, size, copts = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) { return; } diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 0108a84bc5..3c3c64398c 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif) { REGISTER_INI_ENTRIES(); if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) { - REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); } else { - REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); } return SUCCESS; } @@ -2020,16 +2020,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_int(&array, b, (int)(info_value->s[b])); + add_index_long(&array, b, (int)(info_value->s[b])); } break; } case TAG_FMT_USHORT: case TAG_FMT_ULONG: if (l==1) { - add_assoc_int(&tmpi, name, (int)info_value->u); + add_assoc_long(&tmpi, name, (int)info_value->u); } else { - add_index_int(&array, ap, (int)info_value->u); + add_index_long(&array, ap, (int)info_value->u); } break; @@ -2046,16 +2046,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_int(&array, ap, (int)info_value->s[b]); + add_index_long(&array, ap, (int)info_value->s[b]); } break; } case TAG_FMT_SSHORT: case TAG_FMT_SLONG: if (l==1) { - add_assoc_int(&tmpi, name, info_value->i); + add_assoc_long(&tmpi, name, info_value->i); } else { - add_index_int(&array, ap, info_value->i); + add_index_long(&array, ap, info_value->i); } break; @@ -2334,10 +2334,10 @@ static char * exif_get_markername(int marker) Get headername for index or false if not defined */ PHP_FUNCTION(exif_tagname) { - php_int_t tag; + zend_long tag; char *szTemp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &tag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { return; } @@ -3884,7 +3884,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t base = php_basename(FileName, strlen(FileName), NULL, 0 TSRMLS_CC); ImageInfo->FileName = estrndup(base->val, base->len); - STR_RELEASE(base); + zend_string_release(base); ImageInfo->read_thumbnail = read_thumbnail; ImageInfo->read_all = read_all; ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; @@ -4129,12 +4129,12 @@ PHP_FUNCTION(exif_thumbnail) } zval_dtor(p_width); zval_dtor(p_height); - ZVAL_INT(p_width, ImageInfo.Thumbnail.width); - ZVAL_INT(p_height, ImageInfo.Thumbnail.height); + ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); + ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); } if (arg_c >= 4) { zval_dtor(p_imagetype); - ZVAL_INT(p_imagetype, ImageInfo.Thumbnail.filetype); + ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG @@ -4175,7 +4175,7 @@ PHP_FUNCTION(exif_imagetype) if (itype == IMAGE_FILETYPE_UNKNOWN) { RETURN_FALSE; } else { - ZVAL_INT(return_value, itype); + ZVAL_LONG(return_value, itype); } } /* }}} */ diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 4c8e5bfe7e..4ba687f4d3 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -44,7 +44,7 @@ /* {{{ macros and type definitions */ typedef struct _php_fileinfo { - php_int_t options; + zend_long options; struct magic_set *magic; } php_fileinfo; @@ -226,19 +226,19 @@ PHP_MINIT_FUNCTION(finfo) le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number); - REGISTER_INT_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); -/* REGISTER_INT_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ - REGISTER_INT_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); +/* REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ + REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); #ifdef MAGIC_PRESERVE_ATIME - REGISTER_INT_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); #endif #ifdef MAGIC_RAW - REGISTER_INT_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); #endif return SUCCESS; @@ -295,14 +295,14 @@ PHP_MINFO_FUNCTION(fileinfo) Create a new fileinfo resource. */ PHP_FUNCTION(finfo_open) { - php_int_t options = MAGIC_NONE; + zend_long options = MAGIC_NONE; char *file = NULL; int file_len = 0; php_fileinfo *finfo; FILEINFO_DECLARE_INIT_OBJECT(object) char resolved_path[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ip", &options, &file, &file_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lp", &options, &file, &file_len) == FAILURE) { FILEINFO_DESTROY_OBJECT(object); RETURN_FALSE; } @@ -382,18 +382,18 @@ PHP_FUNCTION(finfo_close) Set libmagic configuration options. */ PHP_FUNCTION(finfo_set_flags) { - php_int_t options; + zend_long options; php_fileinfo *finfo; zval *zfinfo; FILEINFO_DECLARE_INIT_OBJECT(object) if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zfinfo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zfinfo, &options) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo); @@ -412,7 +412,7 @@ PHP_FUNCTION(finfo_set_flags) static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mimetype_emu) /* {{{ */ { - php_int_t options = 0; + zend_long options = 0; char *ret_val = NULL, *buffer = NULL; int buffer_len; php_fileinfo *finfo = NULL; @@ -433,7 +433,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime switch (Z_TYPE_P(what)) { case IS_STRING: buffer = Z_STRVAL_P(what); - buffer_len = Z_STRSIZE_P(what); + buffer_len = Z_STRLEN_P(what); mode = FILEINFO_MODE_FILE; break; @@ -452,13 +452,13 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime goto common; } } else if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ir", &buffer, &buffer_len, &options, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); magic = finfo->magic; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ir", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo); diff --git a/ext/fileinfo/libmagic/funcs.c b/ext/fileinfo/libmagic/funcs.c index 3c9d387470..4dd3d1c51f 100644 --- a/ext/fileinfo/libmagic/funcs.c +++ b/ext/fileinfo/libmagic/funcs.c @@ -471,7 +471,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep) strncpy(ms->o.buf, res->val, res->len); ms->o.buf[res->len] = '\0'; - STR_RELEASE(res); + zend_string_release(res); out: (void)setlocale(LC_CTYPE, ""); diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index b0e29c2b91..0b323c0ec8 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -366,13 +366,13 @@ check_fmt(struct magic_set *ms, struct magic *m) return 0; (void)setlocale(LC_CTYPE, "C"); - pattern = STR_INIT("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0); + pattern = zend_string_init("~%[-0-9.]*s~", sizeof("~%[-0-9.]*s~") - 1, 0); if ((pce = pcre_get_compiled_regex(pattern, &re_extra, &re_options TSRMLS_CC)) == NULL) { rv = -1; } else { rv = !pcre_exec(pce, re_extra, m->desc, strlen(m->desc), 0, re_options, NULL, 0); } - STR_RELEASE(pattern); + zend_string_release(pattern); (void)setlocale(LC_CTYPE, ""); return rv; } @@ -1887,7 +1887,7 @@ convert_libmagic_pattern(zval *pattern, char *val, int len, int options) int i, j=0; zend_string *t; - t = STR_ALLOC(len * 2 + 4, 0); + t = zend_string_alloc(len * 2 + 4, 0); t->val[j++] = '~'; @@ -2110,11 +2110,11 @@ magiccheck(struct magic_set *ms, struct magic *m) /* Free haystack */ efree(haystack); - if (Z_IVAL(retval) < 0) { + if (Z_LVAL(retval) < 0) { zval_ptr_dtor(&subpats); zval_ptr_dtor(&pattern); return -1; - } else if ((Z_IVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { + } else if ((Z_LVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { /* Need to fetch global match which equals pmatch[0] */ zval *pzval; HashTable *ht = Z_ARRVAL(subpats); @@ -2163,9 +2163,9 @@ magiccheck(struct magic_set *ms, struct magic *m) zval_dtor(&tmpcopy); if ((pattern_match != NULL) && (pattern_offset != NULL)) { - ms->search.s += Z_IVAL_P(pattern_offset); /* this is where the match starts */ - ms->search.offset += Z_IVAL_P(pattern_offset); /* this is where the match starts as size_t */ - ms->search.rm_len = Z_STRSIZE_P(pattern_match) /* This is the length of the matched pattern */; + ms->search.s += Z_LVAL_P(pattern_offset); /* this is where the match starts */ + ms->search.offset += Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */ + ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */; v = 0; zval_ptr_dtor(pattern_match); diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 08e01bdabe..7d3721237a 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -211,72 +211,72 @@ PHP_MINIT_FUNCTION(filter) REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); sapi_register_input_filter(php_sapi_filter, php_sapi_filter_init TSRMLS_CC); @@ -327,7 +327,7 @@ PHP_MINFO_FUNCTION(filter) } /* }}} */ -static filter_list_entry php_find_filter(php_int_t id) /* {{{ */ +static filter_list_entry php_find_filter(zend_long id) /* {{{ */ { int i, size = sizeof(filter_list) / sizeof(filter_list_entry); @@ -358,7 +358,7 @@ static unsigned int php_sapi_filter_init(TSRMLS_D) return SUCCESS; } -static void php_zval_filter(zval *value, php_int_t filter, php_int_t flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */ +static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */ { filter_list_entry filter_func; @@ -466,11 +466,11 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t v if (retval) { if (new_val_len) { - *new_val_len = Z_STRSIZE(new_var); + *new_val_len = Z_STRLEN(new_var); } efree(*val); - if (Z_STRSIZE(new_var)) { - *val = estrndup(Z_STRVAL(new_var), Z_STRSIZE(new_var)); + if (Z_STRLEN(new_var)) { + *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var)); } else { *val = estrdup(""); } @@ -481,7 +481,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t v } /* }}} */ -static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */ +static void php_zval_filter_recursive(zval *value, zend_long filter, zend_long flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */ { if (Z_TYPE_P(value) == IS_ARRAY) { zval *element; @@ -506,7 +506,7 @@ static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t f } /* }}} */ -static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */ +static zval *php_filter_get_storage(zend_long arg TSRMLS_DC)/* {{{ */ { zval *array_ptr = NULL; @@ -523,17 +523,17 @@ static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */ break; case PARSE_SERVER: if (PG(auto_globals_jit)) { - zend_string *name = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0); + zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0); zend_is_auto_global(name TSRMLS_CC); - STR_RELEASE(name); + zend_string_release(name); } array_ptr = &IF_G(server_array); break; case PARSE_ENV: if (PG(auto_globals_jit)) { - zend_string *name = STR_INIT("_ENV", sizeof("_ENV") - 1, 0); + zend_string *name = zend_string_init("_ENV", sizeof("_ENV") - 1, 0); zend_is_auto_global(name TSRMLS_CC); - STR_RELEASE(name); + zend_string_release(name); } array_ptr = &IF_G(env_array) ? &IF_G(env_array) : &PG(http_globals)[TRACK_VARS_ENV]; break; @@ -556,11 +556,11 @@ static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */ */ PHP_FUNCTION(filter_has_var) { - php_int_t arg; + zend_long arg; zend_string *var; zval *array_ptr = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS", &arg, &var) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &arg, &var) == FAILURE) { RETURN_FALSE; } @@ -574,14 +574,14 @@ PHP_FUNCTION(filter_has_var) } /* }}} */ -static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args, const int copy, php_int_t filter_flags TSRMLS_DC) /* {{{ */ +static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args, const int copy, zend_long filter_flags TSRMLS_DC) /* {{{ */ { zval *options = NULL; zval *option; char *charset = NULL; if (filter_args && Z_TYPE_P(filter_args) != IS_ARRAY) { - php_int_t lval; + zend_long lval; PHP_FILTER_GET_LONG_OPT(filter_args, lval); @@ -661,7 +661,7 @@ static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args, static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zend_bool add_empty TSRMLS_DC) /* {{{ */ { - php_uint_t index; + zend_ulong index; zend_string *arg_key; zval *tmp, *arg_elm; @@ -669,10 +669,10 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); php_filter_call(return_value, FILTER_DEFAULT, NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); - } else if (Z_TYPE_P(op) == IS_INT) { + } else if (Z_TYPE_P(op) == IS_LONG) { zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); - php_filter_call(return_value, Z_IVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); + php_filter_call(return_value, Z_LVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); } else if (Z_TYPE_P(op) == IS_ARRAY) { array_init(return_value); @@ -710,12 +710,12 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value, */ PHP_FUNCTION(filter_input) { - php_int_t fetch_from, filter = FILTER_DEFAULT; + zend_long fetch_from, filter = FILTER_DEFAULT; zval *filter_args = NULL, *tmp; zval *input = NULL; zend_string *var; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS|iz", &fetch_from, &var, &filter, &filter_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS|lz", &fetch_from, &var, &filter, &filter_args) == FAILURE) { return; } @@ -726,11 +726,11 @@ PHP_FUNCTION(filter_input) input = php_filter_get_storage(fetch_from TSRMLS_CC); if (!input || !HASH_OF(input) || (tmp = zend_hash_find(HASH_OF(input), var)) == NULL) { - php_int_t filter_flags = 0; + zend_long filter_flags = 0; zval *option, *opt, *def; if (filter_args) { - if (Z_TYPE_P(filter_args) == IS_INT) { - filter_flags = Z_IVAL_P(filter_args); + if (Z_TYPE_P(filter_args) == IS_LONG) { + filter_flags = Z_LVAL_P(filter_args); } else if (Z_TYPE_P(filter_args) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(filter_args), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -766,10 +766,10 @@ PHP_FUNCTION(filter_input) */ PHP_FUNCTION(filter_var) { - php_int_t filter = FILTER_DEFAULT; + zend_long filter = FILTER_DEFAULT; zval *filter_args = NULL, *data; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|iz", &data, &filter, &filter_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|lz", &data, &filter, &filter_args) == FAILURE) { return; } @@ -788,26 +788,26 @@ PHP_FUNCTION(filter_var) */ PHP_FUNCTION(filter_input_array) { - php_int_t fetch_from; + zend_long fetch_from; zval *array_input = NULL, *op = NULL; zend_bool add_empty = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|zb", &fetch_from, &op, &add_empty) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|zb", &fetch_from, &op, &add_empty) == FAILURE) { return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { RETURN_FALSE; } array_input = php_filter_get_storage(fetch_from TSRMLS_CC); if (!array_input || !HASH_OF(array_input)) { - php_int_t filter_flags = 0; + zend_long filter_flags = 0; zval *option; if (op) { - if (Z_TYPE_P(op) == IS_INT) { - filter_flags = Z_IVAL_P(op); + if (Z_TYPE_P(op) == IS_LONG) { + filter_flags = Z_LVAL_P(op); } else if (Z_TYPE_P(op) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(op), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -841,7 +841,7 @@ PHP_FUNCTION(filter_var_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { RETURN_FALSE; } @@ -880,7 +880,7 @@ PHP_FUNCTION(filter_id) for (i = 0; i < size; ++i) { if (strcmp(filter_list[i].name, filter) == 0) { - RETURN_INT(filter_list[i].id); + RETURN_LONG(filter_list[i].id); } } diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index 869b412d4e..45ab99a824 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -118,13 +118,13 @@ } #define PHP_FILTER_GET_LONG_OPT(zv, opt) { \ - if (Z_TYPE_P(zv) != IS_INT) { \ + if (Z_TYPE_P(zv) != IS_LONG) { \ zval ___tmp; \ ZVAL_DUP(&___tmp, zv); \ convert_to_int(&___tmp); \ - opt = Z_IVAL(___tmp); \ + opt = Z_LVAL(___tmp); \ } else { \ - opt = Z_IVAL_P(zv); \ + opt = Z_LVAL_P(zv); \ } \ } diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 5b2333343b..914d85e3e7 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -56,7 +56,7 @@ if ((option_val = zend_hash_str_find(HASH_OF(option_array), option_name, sizeof(option_name) - 1)) != NULL) { \ if (Z_TYPE_P(option_val) == IS_STRING) { \ var_name = Z_STRVAL_P(option_val); \ - var_name##_len = Z_STRSIZE_P(option_val); \ + var_name##_len = Z_STRLEN_P(option_val); \ var_name##_set = 1; \ } \ } \ @@ -80,8 +80,8 @@ #define FORMAT_IPV4 4 #define FORMAT_IPV6 6 -static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */ - php_int_t ctx_value; +static int php_filter_parse_int(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */ + zend_long ctx_value; int sign = 0, digit = 0; const char *end = str + str_len; @@ -106,8 +106,8 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t return -1; } - if ((end - str > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */ - || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_ZEND_INT - 1) && *str > '2')) { + if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ + || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { /* overflow */ return -1; } @@ -132,16 +132,16 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t } /* }}} */ -static int php_filter_parse_octal(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */ - php_uint_t ctx_value = 0; +static int php_filter_parse_octal(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */ + zend_ulong ctx_value = 0; const char *end = str + str_len; while (str < end) { if (*str >= '0' && *str <= '7') { - php_uint_t n = ((*(str++)) - '0'); + zend_ulong n = ((*(str++)) - '0'); - if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 8) || - ((ctx_value = ctx_value * 8) > ((php_uint_t)(~(php_int_t)0)) - n)) { + if ((ctx_value > ((zend_ulong)(~(zend_long)0)) / 8) || + ((ctx_value = ctx_value * 8) > ((zend_ulong)(~(zend_long)0)) - n)) { return -1; } ctx_value += n; @@ -150,15 +150,15 @@ static int php_filter_parse_octal(const char *str, unsigned int str_len, php_int } } - *ret = (php_int_t)ctx_value; + *ret = (zend_long)ctx_value; return 1; } /* }}} */ -static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */ - php_uint_t ctx_value = 0; +static int php_filter_parse_hex(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */ + zend_ulong ctx_value = 0; const char *end = str + str_len; - php_uint_t n; + zend_ulong n; while (str < end) { if (*str >= '0' && *str <= '9') { @@ -170,14 +170,14 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t } else { return -1; } - if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 16) || - ((ctx_value = ctx_value * 16) > ((php_uint_t)(~(php_int_t)0)) - n)) { + if ((ctx_value > ((zend_ulong)(~(zend_long)0)) / 16) || + ((ctx_value = ctx_value * 16) > ((zend_ulong)(~(zend_long)0)) - n)) { return -1; } ctx_value += n; } - *ret = (php_int_t)ctx_value; + *ret = (zend_long)ctx_value; return 1; } /* }}} */ @@ -185,11 +185,11 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { zval *option_val; - php_int_t min_range, max_range, option_flags; + zend_long min_range, max_range, option_flags; int min_range_set, max_range_set; int allow_octal = 0, allow_hex = 0; int len, error = 0; - php_int_t ctx_value; + zend_long ctx_value; char *p; /* Parse options */ @@ -197,7 +197,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ FETCH_LONG_OPTION(max_range, "max_range"); option_flags = flags; - len = Z_STRSIZE_P(value); + len = Z_STRLEN_P(value); if (len == 0) { RETURN_VALIDATION_FAILED @@ -241,7 +241,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } else { zval_ptr_dtor(value); - ZVAL_INT(value, ctx_value); + ZVAL_LONG(value, ctx_value); return; } } @@ -250,7 +250,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *str = Z_STRVAL_P(value); - int len = Z_STRSIZE_P(value); + int len = Z_STRLEN_P(value); int ret; PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); @@ -327,12 +327,12 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ char dec_sep = '.'; char tsd_sep[3] = "',."; - php_int_t lval; + zend_long lval; double dval; int first, n; - len = Z_STRSIZE_P(value); + len = Z_STRLEN_P(value); str = Z_STRVAL_P(value); PHP_FILTER_TRIM_DEFAULT(str, len); @@ -398,7 +398,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ *p = 0; switch (is_numeric_string(num, p - num, &lval, &dval, 0)) { - case IS_INT: + case IS_LONG: zval_ptr_dtor(value); ZVAL_DOUBLE(value, lval); break; @@ -422,7 +422,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { zval *option_val; zend_string *regexp; - php_int_t option_flags; + zend_long option_flags; int regexp_set, option_flags_set; pcre *re = NULL; pcre_extra *pcre_extra = NULL; @@ -443,7 +443,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if (!re) { RETURN_VALIDATION_FAILED } - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -455,16 +455,16 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { php_url *url; - int old_len = Z_STRSIZE_P(value); + int old_len = Z_STRLEN_P(value); php_filter_url(value, flags, option_array, charset TSRMLS_CC); - if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRSIZE_P(value)) { + if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) { RETURN_VALIDATION_FAILED } /* Use parse_url - if it returns false, we return NULL */ - url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value)); + url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRLEN_P(value)); if (url == NULL) { RETURN_VALIDATION_FAILED @@ -543,18 +543,18 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ /* The maximum length of an e-mail address is 320 octets, per RFC 2821. */ - if (Z_STRSIZE_P(value) > 320) { + if (Z_STRLEN_P(value) > 320) { RETURN_VALIDATION_FAILED } - sregexp = STR_INIT(regexp, sizeof(regexp) - 1, 0); + sregexp = zend_string_init(regexp, sizeof(regexp) - 1, 0); re = pcre_get_compiled_regex(sregexp, &pcre_extra, &preg_options TSRMLS_CC); if (!re) { - STR_RELEASE(sregexp); + zend_string_release(sregexp); RETURN_VALIDATION_FAILED } - STR_RELEASE(sregexp); - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); + zend_string_release(sregexp); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -688,9 +688,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int ip[4]; int mode; - if (memchr(Z_STRVAL_P(value), ':', Z_STRSIZE_P(value))) { + if (memchr(Z_STRVAL_P(value), ':', Z_STRLEN_P(value))) { mode = FORMAT_IPV6; - } else if (memchr(Z_STRVAL_P(value), '.', Z_STRSIZE_P(value))) { + } else if (memchr(Z_STRVAL_P(value), '.', Z_STRLEN_P(value))) { mode = FORMAT_IPV4; } else { RETURN_VALIDATION_FAILED @@ -706,7 +706,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ switch (mode) { case FORMAT_IPV4: - if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRSIZE_P(value), ip)) { + if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRLEN_P(value), ip)) { RETURN_VALIDATION_FAILED } @@ -738,18 +738,18 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ case FORMAT_IPV6: { int res = 0; - res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRSIZE_P(value) TSRMLS_CC); + res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC); if (res < 1) { RETURN_VALIDATION_FAILED } /* Check flags */ if (flags & FILTER_FLAG_NO_PRIV_RANGE) { - if (Z_STRSIZE_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { + if (Z_STRLEN_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { RETURN_VALIDATION_FAILED } } if (flags & FILTER_FLAG_NO_RES_RANGE) { - switch (Z_STRSIZE_P(value)) { + switch (Z_STRLEN_P(value)) { case 1: case 0: break; case 2: @@ -763,7 +763,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } break; default: - if (Z_STRSIZE_P(value) >= 5) { + if (Z_STRLEN_P(value) >= 5) { if ( !strncasecmp("fe8", Z_STRVAL_P(value), 3) || !strncasecmp("fe9", Z_STRVAL_P(value), 3) || @@ -774,10 +774,10 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } } if ( - (Z_STRSIZE_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || - (Z_STRSIZE_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || - (Z_STRSIZE_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || - (Z_STRSIZE_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) + (Z_STRLEN_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || + (Z_STRLEN_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || + (Z_STRLEN_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || + (Z_STRLEN_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) ) { RETURN_VALIDATION_FAILED } @@ -792,11 +792,11 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *input = Z_STRVAL_P(value); - int input_len = Z_STRSIZE_P(value); + int input_len = Z_STRLEN_P(value); int tokens, length, i, offset, exp_separator_set, exp_separator_len; char separator; char *exp_separator; - php_int_t ret = 0; + zend_long ret = 0; zval *option_val; FETCH_STRING_OPTION(exp_separator, "separator"); diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h index 05eb78d885..e62ef8c677 100644 --- a/ext/filter/php_filter.h +++ b/ext/filter/php_filter.h @@ -59,8 +59,8 @@ ZEND_BEGIN_MODULE_GLOBALS(filter) zval env_array; zval server_array; zval session_array; - php_int_t default_filter; - php_int_t default_filter_flags; + zend_long default_filter; + zend_long default_filter_flags; ZEND_END_MODULE_GLOBALS(filter) #ifdef ZTS @@ -70,7 +70,7 @@ ZEND_END_MODULE_GLOBALS(filter) #endif -#define PHP_INPUT_FILTER_PARAM_DECL zval *value, php_int_t flags, zval *option_array, char *charset TSRMLS_DC +#define PHP_INPUT_FILTER_PARAM_DECL zval *value, zend_long flags, zval *option_array, char *charset TSRMLS_DC void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL); diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index 98c939f686..ca3059cd26 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -30,18 +30,18 @@ typedef unsigned long filter_map[256]; static void php_filter_encode_html(zval *value, const unsigned char *chars) { smart_str str = {0}; - int len = Z_STRSIZE_P(value); + int len = Z_STRLEN_P(value); unsigned char *s = (unsigned char *)Z_STRVAL_P(value); unsigned char *e = s + len; - if (Z_STRSIZE_P(value) == 0) { + if (Z_STRLEN_P(value) == 0) { return; } while (s < e) { if (chars[*s]) { smart_str_appendl(&str, "&#", 2); - smart_str_append_unsigned(&str, (php_uint_t)*s); + smart_str_append_unsigned(&str, (zend_ulong)*s); smart_str_appendc(&str, ';'); } else { /* XXX: this needs to be optimized to work with blocks of 'safe' chars */ @@ -87,10 +87,10 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const memset(tmp, 1, 32); } */ - str = STR_ALLOC(3 * Z_STRSIZE_P(value), 0); + str = zend_string_alloc(3 * Z_STRLEN_P(value), 0); p = str->val; s = Z_STRVAL_P(value); - e = s + Z_STRSIZE_P(value); + e = s + Z_STRLEN_P(value); while (s < e) { if (tmp[*s]) { @@ -108,7 +108,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const ZVAL_STR(value, str); } -static void php_filter_strip(zval *value, php_int_t flags) +static void php_filter_strip(zval *value, zend_long flags) { unsigned char *str; int i, c; @@ -120,9 +120,9 @@ static void php_filter_strip(zval *value, php_int_t flags) } str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); + buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRSIZE_P(value); i++) { + for (i = 0; i < Z_STRLEN_P(value); i++) { if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) { } else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) { } else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) { @@ -162,9 +162,9 @@ static void filter_map_apply(zval *value, filter_map *map) zend_string *buf; str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); + buf = zend_string_alloc(Z_STRLEN_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRSIZE_P(value); i++) { + for (i = 0; i < Z_STRLEN_P(value); i++) { if ((*map)[str[i]]) { buf->val[c] = str[i]; ++c; @@ -185,7 +185,7 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) unsigned char enc[256] = {0}; if (IS_INTERNED(Z_STR_P(value))) { - ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRSIZE_P(value)); + ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRLEN_P(value)); } /* strip high/strip low ( see flags )*/ @@ -207,8 +207,8 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) php_filter_encode_html(value, enc); /* strip tags, implicitly also removes \0 chars */ - new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), NULL, NULL, 0, 1); - Z_STRSIZE_P(value) = new_len; + new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0, 1); + Z_STRLEN_P(value) = new_len; if (new_len == 0) { zval_dtor(value); @@ -264,7 +264,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) } else { quotes = ENT_NOQUOTES; } - buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); + buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); } @@ -274,7 +274,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) { /* Only if no flags are set (optimization) */ - if (flags != 0 && Z_STRSIZE_P(value) > 0) { + if (flags != 0 && Z_STRLEN_P(value) > 0) { unsigned char enc[256] = {0}; php_filter_strip(value, flags); @@ -290,7 +290,7 @@ void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) } php_filter_encode_html(value, enc); - } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRSIZE_P(value) == 0) { + } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) { zval_dtor(value); ZVAL_NULL(value); } @@ -373,7 +373,7 @@ void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL) zend_string *buf; /* just call php_addslashes quotes */ - buf = php_addslashes(Z_STRVAL_P(value), Z_STRSIZE_P(value), 0 TSRMLS_CC); + buf = php_addslashes(Z_STRVAL_P(value), Z_STRLEN_P(value), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 5b0fea6db9..45c6ffed10 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -121,7 +121,7 @@ union ipbox { /* {{{ ftp_open */ ftpbuf_t* -ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC) +ftp_open(const char *host, short port, zend_long timeout_sec TSRMLS_DC) { ftpbuf_t *ftp; socklen_t size; @@ -248,7 +248,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) { #if HAVE_OPENSSL_EXT SSL_CTX *ctx = NULL; - php_int_t ssl_ctx_options = SSL_OP_ALL; + zend_long ssl_ctx_options = SSL_OP_ALL; #endif if (ftp == NULL) { return 0; @@ -554,13 +554,13 @@ ftp_mkdir(ftpbuf_t *ftp, const char *dir) } /* copy out the dir from response */ if ((mkd = strchr(ftp->inbuf, '"')) == NULL) { - return STR_INIT(dir, strlen(dir), 0); + return zend_string_init(dir, strlen(dir), 0); } if ((end = strrchr(++mkd, '"')) == NULL) { return NULL; } *end = 0; - ret = STR_INIT(mkd, end - mkd, 0); + ret = zend_string_init(mkd, end - mkd, 0); *end = '"'; return ret; @@ -616,7 +616,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam /* {{{ ftp_alloc */ int -ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response) +ftp_alloc(ftpbuf_t *ftp, const zend_long size, zend_string **response) { char buffer[64]; @@ -635,7 +635,7 @@ ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response) } if (response) { - *response = STR_INIT(ftp->inbuf, strlen(ftp->inbuf), 0); + *response = zend_string_init(ftp->inbuf, strlen(ftp->inbuf), 0); } if (ftp->resp < 200 || ftp->resp >= 300) { @@ -791,7 +791,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) /* {{{ ftp_get */ int -ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC) +ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC) { databuf_t *data = NULL; size_t rcvd; @@ -883,10 +883,10 @@ bail: /* {{{ ftp_put */ int -ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC) +ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC) { databuf_t *data = NULL; - php_int_t size; + zend_long size; char *ptr; int ch; char arg[11]; @@ -960,7 +960,7 @@ bail: /* {{{ ftp_size */ -php_int_t +zend_long ftp_size(ftpbuf_t *ftp, const char *path) { if (ftp == NULL) { @@ -1227,7 +1227,7 @@ ftp_getresp(ftpbuf_t *ftp) int my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) { - php_int_t size, sent; + zend_long size, sent; int n; size = len; @@ -1493,7 +1493,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) #if HAVE_OPENSSL_EXT SSL_CTX *ctx; - php_int_t ssl_ctx_options = SSL_OP_ALL; + zend_long ssl_ctx_options = SSL_OP_ALL; #endif if (data->fd != -1) { @@ -1711,7 +1711,7 @@ bail: /* {{{ ftp_nb_get */ int -ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC) +ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1828,7 +1828,7 @@ bail: /* {{{ ftp_nb_put */ int -ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC) +ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h index 9891a14e55..57b3f663d7 100644 --- a/ext/ftp/ftp.h +++ b/ext/ftp/ftp.h @@ -69,7 +69,7 @@ typedef struct ftpbuf ftptype_t type; /* current transfer type */ int pasv; /* 0=off; 1=pasv; 2=ready */ php_sockaddr_storage pasvaddr; /* passive mode address */ - php_int_t timeout_sec; /* User configureable timeout (seconds) */ + zend_long timeout_sec; /* User configureable timeout (seconds) */ int autoseek; /* User configureable autoseek flag */ int nb; /* "nonblocking" transfer in progress */ @@ -93,7 +93,7 @@ typedef struct ftpbuf /* open a FTP connection, returns ftpbuf (NULL on error) * port is the ftp port in network byte order, or 0 for the default */ -ftpbuf_t* ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC); +ftpbuf_t* ftp_open(const char *host, short port, zend_long timeout_sec TSRMLS_DC); /* quits from the ftp session (it still needs to be closed) * return true on success, false on error @@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi * however some servers will not accept STOR or APPE until ALLO is confirmed. * If response is passed, it is estrdup()ed from ftp->inbuf and must be freed * or assigned to a zval returned to the user */ -int ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response); +int ftp_alloc(ftpbuf_t *ftp, const zend_long size, zend_string **response); /* returns a NULL-terminated array of filenames in the given path * or NULL on error. the return array must be freed (but don't @@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv); /* retrieves a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC); +int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC); +int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC); /* returns the size of the given file, or -1 on error */ -php_int_t ftp_size(ftpbuf_t *ftp, const char *path); +zend_long ftp_size(ftpbuf_t *ftp, const char *path); /* returns the last modified time of the given file, or -1 on error */ time_t ftp_mdtm(ftpbuf_t *ftp, const char *path); @@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd); /* retrieves part of a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC); +int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, zend_long resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC); +int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, zend_long startpos TSRMLS_DC); /* continues a previous nb_(f)get command */ diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 41b8e12861..19fee1ffaa 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -308,16 +308,16 @@ static void ftp_destructor_ftpbuf(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(ftp) { le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number); - REGISTER_INT_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); return SUCCESS; } @@ -344,10 +344,10 @@ PHP_FUNCTION(ftp_connect) ftpbuf_t *ftp; char *host; int host_len; - php_int_t port = 0; - php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT; + zend_long port = 0; + zend_long timeout_sec = FTP_DEFAULT_TIMEOUT; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) { return; } @@ -380,10 +380,10 @@ PHP_FUNCTION(ftp_ssl_connect) ftpbuf_t *ftp; char *host; int host_len; - php_int_t port = 0; - php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT; + zend_long port = 0; + zend_long timeout_sec = FTP_DEFAULT_TIMEOUT; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) { return; } @@ -606,9 +606,9 @@ PHP_FUNCTION(ftp_chmod) ftpbuf_t *ftp; char *filename; int filename_len; - php_int_t mode; + zend_long mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rip", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { RETURN_FALSE; } @@ -619,7 +619,7 @@ PHP_FUNCTION(ftp_chmod) RETURN_FALSE; } - RETURN_INT(mode); + RETURN_LONG(mode); } /* }}} */ @@ -629,10 +629,10 @@ PHP_FUNCTION(ftp_alloc) { zval *z_ftp, *zresponse = NULL; ftpbuf_t *ftp; - php_int_t size, ret; + zend_long size, ret; zend_string *response = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &z_ftp, &size, &zresponse) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &z_ftp, &size, &zresponse) == FAILURE) { RETURN_FALSE; } @@ -742,9 +742,9 @@ PHP_FUNCTION(ftp_fget) php_stream *stream; char *file; int file_len; - php_int_t mode, resumepos=0; + zend_long mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -786,9 +786,9 @@ PHP_FUNCTION(ftp_nb_fget) php_stream *stream; char *file; int file_len; - php_int_t mode, resumepos=0, ret; + zend_long mode, resumepos=0, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -817,10 +817,10 @@ PHP_FUNCTION(ftp_nb_fget) if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_INT(ret); + RETURN_LONG(ret); } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -856,9 +856,9 @@ PHP_FUNCTION(ftp_get) php_stream *outstream; char *local, *remote; int local_len, remote_len; - php_int_t mode, resumepos=0; + zend_long mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -919,9 +919,9 @@ PHP_FUNCTION(ftp_nb_get) php_stream *outstream; char *local, *remote; int local_len, remote_len, ret; - php_int_t mode, resumepos=0; + zend_long mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -967,7 +967,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; VCWD_UNLINK(local); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_INT(PHP_FTP_FAILED); + RETURN_LONG(PHP_FTP_FAILED); } if (ret == PHP_FTP_FINISHED){ @@ -975,7 +975,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -985,7 +985,7 @@ PHP_FUNCTION(ftp_nb_continue) { zval *z_ftp; ftpbuf_t *ftp; - php_int_t ret; + zend_long ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) { return; @@ -995,7 +995,7 @@ PHP_FUNCTION(ftp_nb_continue) if (!ftp->nb) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue."); - RETURN_INT(PHP_FTP_FAILED); + RETURN_LONG(PHP_FTP_FAILED); } if (ftp->direction) { @@ -1013,7 +1013,7 @@ PHP_FUNCTION(ftp_nb_continue) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1025,11 +1025,11 @@ PHP_FUNCTION(ftp_fput) ftpbuf_t *ftp; ftptype_t xtype; int remote_len; - php_int_t mode, startpos=0; + zend_long mode, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1072,11 +1072,11 @@ PHP_FUNCTION(ftp_nb_fput) ftpbuf_t *ftp; ftptype_t xtype; int remote_len, ret; - php_int_t mode, startpos=0; + zend_long mode, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1108,10 +1108,10 @@ PHP_FUNCTION(ftp_nb_fput) if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == PHP_FTP_FAILED)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_INT(ret); + RETURN_LONG(ret); } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1124,11 +1124,11 @@ PHP_FUNCTION(ftp_put) ftpbuf_t *ftp; ftptype_t xtype; char *remote, *local; - php_int_t remote_len, local_len; - php_int_t mode, startpos=0; + zend_long remote_len, local_len; + zend_long mode, startpos=0; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } @@ -1178,10 +1178,10 @@ PHP_FUNCTION(ftp_nb_put) ftptype_t xtype; char *remote, *local; int remote_len, local_len; - php_int_t mode, startpos=0, ret; + zend_long mode, startpos=0, ret; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } @@ -1225,7 +1225,7 @@ PHP_FUNCTION(ftp_nb_put) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1245,7 +1245,7 @@ PHP_FUNCTION(ftp_size) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file size */ - RETURN_INT(ftp_size(ftp, file)); + RETURN_LONG(ftp_size(ftp, file)); } /* }}} */ @@ -1265,7 +1265,7 @@ PHP_FUNCTION(ftp_mdtm) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file mod time */ - RETURN_INT(ftp_mdtm(ftp, file)); + RETURN_LONG(ftp_mdtm(ftp, file)); } /* }}} */ @@ -1368,10 +1368,10 @@ PHP_FUNCTION(ftp_close) PHP_FUNCTION(ftp_set_option) { zval *z_ftp, *z_value; - php_int_t option; + zend_long option; ftpbuf_t *ftp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_ftp, &option, &z_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) { return; } @@ -1379,16 +1379,16 @@ PHP_FUNCTION(ftp_set_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - if (Z_TYPE_P(z_value) != IS_INT) { + if (Z_TYPE_P(z_value) != IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option TIMEOUT_SEC expects value of type long, %s given", zend_zval_type_name(z_value)); RETURN_FALSE; } - if (Z_IVAL_P(z_value) <= 0) { + if (Z_LVAL_P(z_value) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0"); RETURN_FALSE; } - ftp->timeout_sec = Z_IVAL_P(z_value); + ftp->timeout_sec = Z_LVAL_P(z_value); RETURN_TRUE; break; case PHP_FTP_OPT_AUTOSEEK: @@ -1413,10 +1413,10 @@ PHP_FUNCTION(ftp_set_option) PHP_FUNCTION(ftp_get_option) { zval *z_ftp; - php_int_t option; + zend_long option; ftpbuf_t *ftp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &z_ftp, &option) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) { return; } @@ -1424,7 +1424,7 @@ PHP_FUNCTION(ftp_get_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - RETURN_INT(ftp->timeout_sec); + RETURN_LONG(ftp->timeout_sec); break; case PHP_FTP_OPT_AUTOSEEK: RETURN_BOOL(ftp->autoseek); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 11941a43b9..53f07c06ec 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1142,93 +1142,93 @@ PHP_MINIT_FUNCTION(gd) #endif REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); /* special colours for gd */ - REGISTER_INT_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); /* for imagefilledarc */ - REGISTER_INT_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); /* GD2 image format types */ - REGISTER_INT_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_GD_BUNDLED) - REGISTER_INT_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_INT_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); #endif /* Section Filters */ - REGISTER_INT_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); /* End Section Filters */ #ifdef GD_VERSION_STRING @@ -1236,9 +1236,9 @@ PHP_MINIT_FUNCTION(gd) #endif #if defined(GD_MAJOR_VERSION) && defined(GD_MINOR_VERSION) && defined(GD_RELEASE_VERSION) && defined(GD_EXTRA_VERSION) - REGISTER_INT_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("GD_EXTRA_VERSION", GD_EXTRA_VERSION, CONST_CS | CONST_PERSISTENT); #endif @@ -1250,13 +1250,13 @@ PHP_MINIT_FUNCTION(gd) * /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup. * as error, use the values for now... */ - REGISTER_INT_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -1515,7 +1515,7 @@ PHP_FUNCTION(imageloadfont) * that overlap with the old fonts (with indices 1-5). The first * list index given out is always 1. */ - RETURN_INT(Z_RES_HANDLE_P(ind) + 5); + RETURN_LONG(Z_RES_HANDLE_P(ind) + 5); } /* }}} */ @@ -1538,13 +1538,13 @@ PHP_FUNCTION(imagesetstyle) stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0); ZEND_HASH_FOREACH_VAL(HASH_OF(styles), item) { - if (Z_TYPE_P(item) != IS_INT) { + if (Z_TYPE_P(item) != IS_LONG) { zval lval; ZVAL_COPY(&lval, item); convert_to_int(&lval); - stylearr[index++] = Z_IVAL(lval); + stylearr[index++] = Z_LVAL(lval); } else { - stylearr[index++] = Z_IVAL_P(item); + stylearr[index++] = Z_LVAL_P(item); } } ZEND_HASH_FOREACH_END(); @@ -1560,10 +1560,10 @@ PHP_FUNCTION(imagesetstyle) Create a new true color image */ PHP_FUNCTION(imagecreatetruecolor) { - php_int_t x_size, y_size; + zend_long x_size, y_size; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) { return; } @@ -1605,10 +1605,10 @@ PHP_FUNCTION(imagetruecolortopalette) { zval *IM; zend_bool dither; - php_int_t ncolors; + zend_long ncolors; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbi", &IM, &dither, &ncolors) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbl", &IM, &dither, &ncolors) == FAILURE) { return; } @@ -1689,10 +1689,10 @@ PHP_FUNCTION(imagecolormatch) PHP_FUNCTION(imagesetthickness) { zval *IM; - php_int_t thick; + zend_long thick; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &thick) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &thick) == FAILURE) { return; } @@ -1709,10 +1709,10 @@ PHP_FUNCTION(imagesetthickness) PHP_FUNCTION(imagefilledellipse) { zval *IM; - php_int_t cx, cy, w, h, color; + zend_long cx, cy, w, h, color; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { return; } @@ -1729,11 +1729,11 @@ PHP_FUNCTION(imagefilledellipse) PHP_FUNCTION(imagefilledarc) { zval *IM; - php_int_t cx, cy, w, h, ST, E, col, style; + zend_long cx, cy, w, h, ST, E, col, style; gdImagePtr im; int e, st; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) { return; } @@ -1798,10 +1798,10 @@ PHP_FUNCTION(imagesavealpha) PHP_FUNCTION(imagelayereffect) { zval *IM; - php_int_t effect; + zend_long effect; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &effect) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &effect) == FAILURE) { return; } @@ -1817,11 +1817,11 @@ PHP_FUNCTION(imagelayereffect) PHP_FUNCTION(imagecolorallocatealpha) { zval *IM; - php_int_t red, green, blue, alpha; + zend_long red, green, blue, alpha; gdImagePtr im; int ct = (-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { RETURN_FALSE; } @@ -1830,7 +1830,7 @@ PHP_FUNCTION(imagecolorallocatealpha) if (ct < 0) { RETURN_FALSE; } - RETURN_INT((php_int_t)ct); + RETURN_LONG((zend_long)ct); } /* }}} */ @@ -1839,16 +1839,16 @@ PHP_FUNCTION(imagecolorallocatealpha) PHP_FUNCTION(imagecolorresolvealpha) { zval *IM; - php_int_t red, green, blue, alpha; + zend_long red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorResolveAlpha(im, red, green, blue, alpha)); + RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1857,16 +1857,16 @@ PHP_FUNCTION(imagecolorresolvealpha) PHP_FUNCTION(imagecolorclosestalpha) { zval *IM; - php_int_t red, green, blue, alpha; + zend_long red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorClosestAlpha(im, red, green, blue, alpha)); + RETURN_LONG(gdImageColorClosestAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1875,16 +1875,16 @@ PHP_FUNCTION(imagecolorclosestalpha) PHP_FUNCTION(imagecolorexactalpha) { zval *IM; - php_int_t red, green, blue, alpha; + zend_long red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorExactAlpha(im, red, green, blue, alpha)); + RETURN_LONG(gdImageColorExactAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1893,11 +1893,11 @@ PHP_FUNCTION(imagecolorexactalpha) PHP_FUNCTION(imagecopyresampled) { zval *SIM, *DIM; - php_int_t SX, SY, SW, SH, DX, DY, DW, DH; + zend_long SX, SY, SW, SH, DX, DY, DW, DH; gdImagePtr im_dst, im_src; int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { return; } @@ -1925,7 +1925,7 @@ PHP_FUNCTION(imagecopyresampled) PHP_FUNCTION(imagegrabwindow) { HWND window; - php_int_t client_area = 0; + zend_long client_area = 0; RECT rc = {0}; RECT rc_win = {0}; int Width, Height; @@ -1934,12 +1934,12 @@ PHP_FUNCTION(imagegrabwindow) HBITMAP memBM; HBITMAP hOld; HINSTANCE handle; - php_int_t lwindow_handle; + zend_long lwindow_handle; typedef BOOL (WINAPI *tPrintWindow)(HWND, HDC,UINT); tPrintWindow pPrintWindow = 0; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &lwindow_handle, &client_area) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &lwindow_handle, &client_area) == FAILURE) { RETURN_FALSE; } @@ -2076,10 +2076,10 @@ PHP_FUNCTION(imagerotate) zval *SIM; gdImagePtr im_dst, im_src; double degrees; - php_int_t color; - php_int_t ignoretransparent = 0; + zend_long color; + zend_long ignoretransparent = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdi|i", &SIM, °rees, &color, &ignoretransparent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdl|l", &SIM, °rees, &color, &ignoretransparent) == FAILURE) { RETURN_FALSE; } @@ -2139,10 +2139,10 @@ PHP_FUNCTION(imagesetbrush) Create a new image */ PHP_FUNCTION(imagecreate) { - php_int_t x_size, y_size; + zend_long x_size, y_size; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) { return; } @@ -2182,7 +2182,7 @@ PHP_FUNCTION(imagetypes) return; } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -2251,7 +2251,7 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct gdImagePtr im; gdIOCtx *io_ctx; - io_ctx = gdNewDynamicCtxEx(Z_STRSIZE_P(data), Z_STRVAL_P(data), 0); + io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0); if (!io_ctx) { return NULL; @@ -2284,7 +2284,7 @@ PHP_FUNCTION(imagecreatefromstring) } convert_to_string_ex(data); - if (Z_STRSIZE_P(data) < 8) { + if (Z_STRLEN_P(data) < 8) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string or invalid image"); RETURN_FALSE; } @@ -2344,7 +2344,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, { char *file; int file_len; - php_int_t srcx, srcy, width, height; + zend_long srcx, srcy, width, height; gdImagePtr im = NULL; php_stream *stream; FILE * fp = NULL; @@ -2353,7 +2353,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, #endif if (image_type == PHP_GDIMG_TYPE_GD2PART) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "siiii", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) { return; } if (width < 1 || height < 1) { @@ -2395,7 +2395,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, io_ctx = gdNewDynamicCtxEx(buff->len, pstr, 0); if (!io_ctx) { pefree(pstr, 1); - STR_RELEASE(buff); + zend_string_release(buff); php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context"); goto out_err; } @@ -2407,7 +2407,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } io_ctx->gd_free(io_ctx); pefree(pstr, 1); - STR_RELEASE(buff); + zend_string_release(buff); } else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) { /* try and force the stream to be FILE* */ @@ -2551,7 +2551,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char { zval *imgind; char *file = NULL; - php_int_t quality = 0, type = 0; + zend_long quality = 0, type = 0; gdImagePtr im; char *fn = NULL; FILE *fp; @@ -2562,7 +2562,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */ /* The quality parameter for gd2 stands for chunk size */ - if (zend_parse_parameters(argc TSRMLS_CC, "r|pii", &imgind, &file, &file_len, &quality, &type) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) { return; } @@ -2794,11 +2794,11 @@ PHP_FUNCTION(imagedestroy) PHP_FUNCTION(imagecolorallocate) { zval *IM; - php_int_t red, green, blue; + zend_long red, green, blue; gdImagePtr im; int ct = (-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { return; } @@ -2808,7 +2808,7 @@ PHP_FUNCTION(imagecolorallocate) if (ct < 0) { RETURN_FALSE; } - RETURN_INT(ct); + RETURN_LONG(ct); } /* }}} */ @@ -2835,10 +2835,10 @@ PHP_FUNCTION(imagepalettecopy) PHP_FUNCTION(imagecolorat) { zval *IM; - php_int_t x, y; + zend_long x, y; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &IM, &x, &y) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &IM, &x, &y) == FAILURE) { return; } @@ -2846,14 +2846,14 @@ PHP_FUNCTION(imagecolorat) if (gdImageTrueColor(im)) { if (im->tpixels && gdImageBoundsSafe(im, x, y)) { - RETURN_INT(gdImageTrueColorPixel(im, x, y)); + RETURN_LONG(gdImageTrueColorPixel(im, x, y)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%pd,%pd is out of bounds", x, y); RETURN_FALSE; } } else { if (im->pixels && gdImageBoundsSafe(im, x, y)) { - RETURN_INT(im->pixels[y][x]); + RETURN_LONG(im->pixels[y][x]); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%pd,%pd is out of bounds", x, y); RETURN_FALSE; @@ -2867,16 +2867,16 @@ PHP_FUNCTION(imagecolorat) PHP_FUNCTION(imagecolorclosest) { zval *IM; - php_int_t red, green, blue; + zend_long red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorClosest(im, red, green, blue)); + RETURN_LONG(gdImageColorClosest(im, red, green, blue)); } /* }}} */ @@ -2885,16 +2885,16 @@ PHP_FUNCTION(imagecolorclosest) PHP_FUNCTION(imagecolorclosesthwb) { zval *IM; - php_int_t red, green, blue; + zend_long red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorClosestHWB(im, red, green, blue)); + RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue)); } /* }}} */ @@ -2903,11 +2903,11 @@ PHP_FUNCTION(imagecolorclosesthwb) PHP_FUNCTION(imagecolordeallocate) { zval *IM; - php_int_t index; + zend_long index; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) { return; } @@ -2935,16 +2935,16 @@ PHP_FUNCTION(imagecolordeallocate) PHP_FUNCTION(imagecolorresolve) { zval *IM; - php_int_t red, green, blue; + zend_long red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorResolve(im, red, green, blue)); + RETURN_LONG(gdImageColorResolve(im, red, green, blue)); } /* }}} */ @@ -2953,16 +2953,16 @@ PHP_FUNCTION(imagecolorresolve) PHP_FUNCTION(imagecolorexact) { zval *IM; - php_int_t red, green, blue; + zend_long red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorExact(im, red, green, blue)); + RETURN_LONG(gdImageColorExact(im, red, green, blue)); } /* }}} */ @@ -2971,11 +2971,11 @@ PHP_FUNCTION(imagecolorexact) PHP_FUNCTION(imagecolorset) { zval *IM; - php_int_t color, red, green, blue, alpha = 0; + zend_long color, red, green, blue, alpha = 0; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) { return; } @@ -2999,11 +2999,11 @@ PHP_FUNCTION(imagecolorset) PHP_FUNCTION(imagecolorsforindex) { zval *IM; - php_int_t index; + zend_long index; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) { return; } @@ -3014,10 +3014,10 @@ PHP_FUNCTION(imagecolorsforindex) if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) { array_init(return_value); - add_assoc_int(return_value,"red", gdImageRed(im,col)); - add_assoc_int(return_value,"green", gdImageGreen(im,col)); - add_assoc_int(return_value,"blue", gdImageBlue(im,col)); - add_assoc_int(return_value,"alpha", gdImageAlpha(im,col)); + add_assoc_long(return_value,"red", gdImageRed(im,col)); + add_assoc_long(return_value,"green", gdImageGreen(im,col)); + add_assoc_long(return_value,"blue", gdImageBlue(im,col)); + add_assoc_long(return_value,"alpha", gdImageAlpha(im,col)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col); RETURN_FALSE; @@ -3073,10 +3073,10 @@ PHP_FUNCTION(imagegammacorrect) PHP_FUNCTION(imagesetpixel) { zval *IM; - php_int_t x, y, col; + zend_long x, y, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) { return; } @@ -3091,10 +3091,10 @@ PHP_FUNCTION(imagesetpixel) PHP_FUNCTION(imageline) { zval *IM; - php_int_t x1, y1, x2, y2, col; + zend_long x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3117,10 +3117,10 @@ PHP_FUNCTION(imageline) PHP_FUNCTION(imagedashedline) { zval *IM; - php_int_t x1, y1, x2, y2, col; + zend_long x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3135,10 +3135,10 @@ PHP_FUNCTION(imagedashedline) PHP_FUNCTION(imagerectangle) { zval *IM; - php_int_t x1, y1, x2, y2, col; + zend_long x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3153,10 +3153,10 @@ PHP_FUNCTION(imagerectangle) PHP_FUNCTION(imagefilledrectangle) { zval *IM; - php_int_t x1, y1, x2, y2, col; + zend_long x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3171,11 +3171,11 @@ PHP_FUNCTION(imagefilledrectangle) PHP_FUNCTION(imagearc) { zval *IM; - php_int_t cx, cy, w, h, ST, E, col; + zend_long cx, cy, w, h, ST, E, col; gdImagePtr im; int e, st; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) { return; } @@ -3201,10 +3201,10 @@ PHP_FUNCTION(imagearc) PHP_FUNCTION(imageellipse) { zval *IM; - php_int_t cx, cy, w, h, color; + zend_long cx, cy, w, h, color; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { return; } @@ -3220,10 +3220,10 @@ PHP_FUNCTION(imageellipse) PHP_FUNCTION(imagefilltoborder) { zval *IM; - php_int_t x, y, border, col; + zend_long x, y, border, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &x, &y, &border, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &x, &y, &border, &col) == FAILURE) { return; } @@ -3238,10 +3238,10 @@ PHP_FUNCTION(imagefilltoborder) PHP_FUNCTION(imagefill) { zval *IM; - php_int_t x, y, col; + zend_long x, y, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) { return; } @@ -3264,7 +3264,7 @@ PHP_FUNCTION(imagecolorstotal) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageColorsTotal(im)); + RETURN_LONG(gdImageColorsTotal(im)); } /* }}} */ @@ -3273,11 +3273,11 @@ PHP_FUNCTION(imagecolorstotal) PHP_FUNCTION(imagecolortransparent) { zval *IM; - php_int_t COL = 0; + zend_long COL = 0; gdImagePtr im; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &COL) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &COL) == FAILURE) { return; } @@ -3287,7 +3287,7 @@ PHP_FUNCTION(imagecolortransparent) gdImageColorTransparent(im, COL); } - RETURN_INT(gdImageGetTransparent(im)); + RETURN_LONG(gdImageGetTransparent(im)); } /* }}} */ @@ -3297,10 +3297,10 @@ PHP_FUNCTION(imageinterlace) { zval *IM; int argc = ZEND_NUM_ARGS(); - php_int_t INT = 0; + zend_long INT = 0; gdImagePtr im; - if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &INT) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &INT) == FAILURE) { return; } @@ -3310,7 +3310,7 @@ PHP_FUNCTION(imageinterlace) gdImageInterlace(im, INT); } - RETURN_INT(gdImageGetInterlaced(im)); + RETURN_LONG(gdImageGetInterlaced(im)); } /* }}} */ @@ -3321,13 +3321,13 @@ PHP_FUNCTION(imageinterlace) static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { zval *IM, *POINTS; - php_int_t NPOINTS, COL; + zend_long NPOINTS, COL; zval *var = NULL; gdImagePtr im; gdPointPtr points; int npoints, col, nelem, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "raii", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rall", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) { return; } @@ -3354,23 +3354,23 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) for (i = 0; i < npoints; i++) { if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2))) != NULL) { - if (Z_TYPE_P(var) != IS_INT) { + if (Z_TYPE_P(var) != IS_LONG) { zval lval; ZVAL_COPY(&lval, var); convert_to_int(&lval); - points[i].x = Z_IVAL(lval); + points[i].x = Z_LVAL(lval); } else { - points[i].x = Z_IVAL_P(var); + points[i].x = Z_LVAL_P(var); } } if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2) + 1)) != NULL) { - if (Z_TYPE_P(var) != IS_INT) { + if (Z_TYPE_P(var) != IS_LONG) { zval lval; ZVAL_COPY(&lval, var); convert_to_int(&lval); - points[i].y = Z_IVAL(lval); + points[i].y = Z_LVAL(lval); } else { - points[i].y = Z_IVAL_P(var); + points[i].y = Z_LVAL_P(var); } } } @@ -3449,15 +3449,15 @@ static gdFontPtr php_find_gd_font(int size TSRMLS_DC) */ static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) { - php_int_t SIZE; + zend_long SIZE; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &SIZE) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &SIZE) == FAILURE) { return; } font = php_find_gd_font(SIZE TSRMLS_CC); - RETURN_INT(arg ? font->h : font->w); + RETURN_LONG(arg ? font->h : font->w); } /* }}} */ @@ -3512,7 +3512,7 @@ static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, i static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) { zval *IM; - php_int_t SIZE, X, Y, COL; + zend_long SIZE, X, Y, COL; char *C; int C_len; gdImagePtr im; @@ -3520,7 +3520,7 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) unsigned char *str = NULL; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiisi", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllsl", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) { return; } @@ -3607,11 +3607,11 @@ PHP_FUNCTION(imagestringup) PHP_FUNCTION(imagecopy) { zval *SIM, *DIM; - php_int_t SX, SY, SW, SH, DX, DY; + zend_long SX, SY, SW, SH, DX, DY; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) { return; } @@ -3635,11 +3635,11 @@ PHP_FUNCTION(imagecopy) PHP_FUNCTION(imagecopymerge) { zval *SIM, *DIM; - php_int_t SX, SY, SW, SH, DX, DY, PCT; + zend_long SX, SY, SW, SH, DX, DY, PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { return; } @@ -3664,11 +3664,11 @@ PHP_FUNCTION(imagecopymerge) PHP_FUNCTION(imagecopymergegray) { zval *SIM, *DIM; - php_int_t SX, SY, SW, SH, DX, DY, PCT; + zend_long SX, SY, SW, SH, DX, DY, PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { return; } @@ -3693,11 +3693,11 @@ PHP_FUNCTION(imagecopymergegray) PHP_FUNCTION(imagecopyresized) { zval *SIM, *DIM; - php_int_t SX, SY, SW, SH, DX, DY, DW, DH; + zend_long SX, SY, SW, SH, DX, DY, DW, DH; gdImagePtr im_dst, im_src; int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { return; } @@ -3736,7 +3736,7 @@ PHP_FUNCTION(imagesx) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageSX(im)); + RETURN_LONG(gdImageSX(im)); } /* }}} */ @@ -3753,7 +3753,7 @@ PHP_FUNCTION(imagesy) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_INT(gdImageSY(im)); + RETURN_LONG(gdImageSY(im)); } /* }}} */ @@ -3804,7 +3804,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int { zval *IM, *EXT = NULL; gdImagePtr im=NULL; - php_int_t col = -1, x = -1, y = -1; + zend_long col = -1, x = -1, y = -1; int str_len, fontname_len, i, brect[8]; double ptsize, angle; char *str = NULL, *fontname = NULL; @@ -3821,7 +3821,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int } else { if (argc < 8 || argc > ((extended) ? 9 : 8)) { ZEND_WRONG_PARAM_COUNT(); - } else if (zend_parse_parameters(argc TSRMLS_CC, "rddiiiss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { + } else if (zend_parse_parameters(argc TSRMLS_CC, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); @@ -3833,7 +3833,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int if (extended && EXT) { /* parse extended info */ zval *item; zend_string *key; - php_uint_t num_key; + zend_ulong num_key; /* walk the assoc array */ ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(EXT), num_key, key, item) { @@ -3878,7 +3878,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* return array with the text's bounding box */ for (i = 0; i < 8; i++) { - add_next_index_int(return_value, brect[i]); + add_next_index_long(return_value, brect[i]); } } /* }}} */ @@ -3994,7 +3994,7 @@ PHP_FUNCTION(imagepscopyfont) nf_ind->extend = 1; l_ind = zend_list_insert(nf_ind, le_ps_font TSRMLS_CC); - RETURN_INT(l_ind); + RETURN_LONG(l_ind); } */ /* }}} */ @@ -4105,7 +4105,7 @@ PHP_FUNCTION(imagepstext) { zval *img, *fnt; int i, j; - php_int_t _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; + zend_long _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; int *f_ind; int h_lines, v_lines, c_ind; int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl; @@ -4121,7 +4121,7 @@ PHP_FUNCTION(imagepstext) char *str; int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsriiiii|iidi", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrlllll|lldl", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) { return; } @@ -4231,10 +4231,10 @@ PHP_FUNCTION(imagepstext) array_init(return_value); - add_next_index_int(return_value, str_img->metrics.leftSideBearing); - add_next_index_int(return_value, str_img->metrics.descent); - add_next_index_int(return_value, str_img->metrics.rightSideBearing); - add_next_index_int(return_value, str_img->metrics.ascent); + add_next_index_long(return_value, str_img->metrics.leftSideBearing); + add_next_index_long(return_value, str_img->metrics.descent); + add_next_index_long(return_value, str_img->metrics.rightSideBearing); + add_next_index_long(return_value, str_img->metrics.ascent); } /* }}} */ @@ -4243,7 +4243,7 @@ PHP_FUNCTION(imagepstext) PHP_FUNCTION(imagepsbbox) { zval *fnt; - php_int_t sz = 0, sp = 0, wd = 0; + zend_long sz = 0, sp = 0, wd = 0; char *str; int i, space = 0, add_width = 0, char_width, amount_kern; int cur_x, cur_y, dx, dy; @@ -4258,7 +4258,7 @@ PHP_FUNCTION(imagepsbbox) ZEND_WRONG_PARAM_COUNT(); } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sri|iid", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) { return; } @@ -4330,10 +4330,10 @@ PHP_FUNCTION(imagepsbbox) /* printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_int(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); - add_next_index_int(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); - add_next_index_int(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); - add_next_index_int(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); + add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); } /* }}} */ #endif @@ -4423,7 +4423,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) { char *f_org, *f_dest; int f_org_len, f_dest_len; - php_int_t height, width, threshold; + zend_long height, width, threshold; gdImagePtr im_org, im_dest, im_tmp; char *fn_org = NULL; char *fn_dest = NULL; @@ -4437,10 +4437,10 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) int x, y; float x_ratio, y_ratio; #ifdef HAVE_GD_JPG - php_int_t ignore_warning; + zend_long ignore_warning; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppiii", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { return; } @@ -4635,9 +4635,9 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - php_int_t brightness, tmp; + zend_long brightness, tmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &SIM, &tmp, &brightness) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) { RETURN_FALSE; } @@ -4658,9 +4658,9 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - php_int_t contrast, tmp; + zend_long contrast, tmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &SIM, &tmp, &contrast) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) { RETURN_FALSE; } @@ -4681,10 +4681,10 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - php_int_t r,g,b,tmp; - php_int_t a = 0; + zend_long r,g,b,tmp; + zend_long a = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { RETURN_FALSE; } @@ -4759,11 +4759,11 @@ static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS) static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; - php_int_t tmp; + zend_long tmp; gdImagePtr im_src; double weight; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rid", &SIM, &tmp, &weight) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) { RETURN_FALSE; } @@ -4784,10 +4784,10 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS) { zval *IM; gdImagePtr im; - php_int_t tmp, blocksize; + zend_long tmp, blocksize; zend_bool mode = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii|b", &IM, &tmp, &blocksize, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) { RETURN_FALSE; } @@ -4811,7 +4811,7 @@ PHP_FUNCTION(imagefilter) zval *tmp; typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS); - php_int_t filtertype; + zend_long filtertype; image_filter filters[] = { php_image_filter_negate , @@ -4830,7 +4830,7 @@ PHP_FUNCTION(imagefilter) if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) { WRONG_PARAM_COUNT; - } else if (zend_parse_parameters(2 TSRMLS_CC, "ri", &tmp, &filtertype) == FAILURE) { + } else if (zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) { return; } @@ -4903,10 +4903,10 @@ PHP_FUNCTION(imageconvolution) PHP_FUNCTION(imageflip) { zval *IM; - php_int_t mode; + zend_long mode; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &mode) == FAILURE) { return; } @@ -4972,13 +4972,13 @@ PHP_FUNCTION(imagecrop) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") -1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.x = Z_IVAL(lval); + rect.x = Z_LVAL(lval); } else { - rect.x = Z_IVAL_P(tmp); + rect.x = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -4986,13 +4986,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.y = Z_IVAL(lval); + rect.y = Z_LVAL(lval); } else { - rect.y = Z_IVAL_P(tmp); + rect.y = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5000,13 +5000,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.width = Z_IVAL(lval); + rect.width = Z_LVAL(lval); } else { - rect.width = Z_IVAL_P(tmp); + rect.width = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5014,13 +5014,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.height = Z_IVAL(lval); + rect.height = Z_LVAL(lval); } else { - rect.height = Z_IVAL_P(tmp); + rect.height = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5042,13 +5042,13 @@ PHP_FUNCTION(imagecrop) PHP_FUNCTION(imagecropauto) { zval *IM; - php_int_t mode = -1; - php_int_t color = -1; + zend_long mode = -1; + zend_long color = -1; double threshold = 0.5f; gdImagePtr im; gdImagePtr im_crop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|idi", &IM, &mode, &threshold, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ldl", &IM, &mode, &threshold, &color) == FAILURE) { return; } @@ -5093,10 +5093,10 @@ PHP_FUNCTION(imagescale) gdImagePtr im; gdImagePtr im_scaled = NULL; int new_width, new_height; - php_int_t tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED; + zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED; gdInterpolationMethod method; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|ii", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) { return; } method = tmp_m; @@ -5147,8 +5147,8 @@ PHP_FUNCTION(imageaffine) for (i = 0; i < nelems; i++) { if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) { switch (Z_TYPE_P(zval_affine_elem)) { - case IS_INT: - affine[i] = Z_IVAL_P(zval_affine_elem); + case IS_LONG: + affine[i] = Z_LVAL_P(zval_affine_elem); break; case IS_DOUBLE: affine[i] = Z_DVAL_P(zval_affine_elem); @@ -5170,13 +5170,13 @@ PHP_FUNCTION(imageaffine) if (z_rect != NULL) { if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.x = Z_IVAL(lval); + rect.x = Z_LVAL(lval); } else { - rect.x = Z_IVAL_P(tmp); + rect.x = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -5184,13 +5184,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.y = Z_IVAL(lval); + rect.y = Z_LVAL(lval); } else { - rect.y = Z_IVAL_P(tmp); + rect.y = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5198,13 +5198,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.width = Z_IVAL(lval); + rect.width = Z_LVAL(lval); } else { - rect.width = Z_IVAL_P(tmp); + rect.width = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5212,13 +5212,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { + if (Z_TYPE_P(tmp) != IS_LONG) { zval lval; ZVAL_COPY(&lval, tmp); convert_to_int(&lval); - rect.height = Z_IVAL(lval); + rect.height = Z_LVAL(lval); } else { - rect.height = Z_IVAL_P(tmp); + rect.height = Z_LVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5250,12 +5250,12 @@ PHP_FUNCTION(imageaffine) PHP_FUNCTION(imageaffinematrixget) { double affine[6]; - php_int_t type; + zend_long type; zval *options = NULL; zval *tmp; int res = GD_FALSE, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z", &type, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &type, &options) == FAILURE) { return; } @@ -5365,8 +5365,8 @@ PHP_FUNCTION(imageaffinematrixconcat) for (i = 0; i < 6; i++) { if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_INT: - m1[i] = Z_IVAL_P(tmp); + case IS_LONG: + m1[i] = Z_LVAL_P(tmp); break; case IS_DOUBLE: m1[i] = Z_DVAL_P(tmp); @@ -5386,8 +5386,8 @@ PHP_FUNCTION(imageaffinematrixconcat) } if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_INT: - m2[i] = Z_IVAL_P(tmp); + case IS_LONG: + m2[i] = Z_LVAL_P(tmp); break; case IS_DOUBLE: m2[i] = Z_DVAL_P(tmp); @@ -5423,9 +5423,9 @@ PHP_FUNCTION(imagesetinterpolation) { zval *IM; gdImagePtr im; - php_int_t method = GD_BILINEAR_FIXED; + zend_long method = GD_BILINEAR_FIXED; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &IM, &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &IM, &method) == FAILURE) { return; } diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index da6cdef8e3..972d4f337c 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -79,7 +79,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, zval *imgind; char *file = NULL; int file_len = 0; - php_int_t quality, basefilter; + zend_long quality, basefilter; gdImagePtr im; int argc = ZEND_NUM_ARGS(); int q = -1, i; @@ -93,7 +93,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * from imagey<type>(). */ if (image_type == PHP_GDIMG_TYPE_XBM) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ii", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { return; } } else { @@ -103,7 +103,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * PHP_GDIMG_TYPE_WBM * PHP_GDIMG_TYPE_WEBP * */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ii", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { return; } } diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c index 59b9661481..fa3032d4d8 100644 --- a/ext/gettext/gettext.c +++ b/ext/gettext/gettext.c @@ -226,9 +226,9 @@ PHP_NAMED_FUNCTION(zif_dcgettext) { char *domain, *msgid, *msgstr; int domain_len, msgid_len; - php_int_t category; + zend_long category; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) { return; } @@ -281,9 +281,9 @@ PHP_NAMED_FUNCTION(zif_ngettext) { char *msgid1, *msgid2, *msgstr; int msgid1_len, msgid2_len; - php_int_t count; + zend_long count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { return; } @@ -305,9 +305,9 @@ PHP_NAMED_FUNCTION(zif_dngettext) { char *domain, *msgid1, *msgid2, *msgstr = NULL; int domain_len, msgid1_len, msgid2_len; - php_int_t count; + zend_long count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi", &domain, &domain_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl", &domain, &domain_len, &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { return; } @@ -331,11 +331,11 @@ PHP_NAMED_FUNCTION(zif_dcngettext) { char *domain, *msgid1, *msgid2, *msgstr = NULL; int domain_len, msgid1_len, msgid2_len; - php_int_t count, category; + zend_long count, category; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssii", &domain, &domain_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssll", &domain, &domain_len, &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count, &category) == FAILURE) { return; } diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index a8f49ad0ad..d9d9e3e3b1 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -298,7 +298,7 @@ if (IS_GMP(zval)) { \ #define INIT_GMP_RETVAL(gmpnumber) \ gmp_create(return_value, &gmpnumber TSRMLS_CC) -static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base); +static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base); static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC); static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC); @@ -311,14 +311,14 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC); typedef void (*gmp_unary_op_t)(mpz_ptr, mpz_srcptr); typedef int (*gmp_unary_opl_t)(mpz_srcptr); -typedef void (*gmp_unary_ui_op_t)(mpz_ptr, php_uint_t); +typedef void (*gmp_unary_ui_op_t)(mpz_ptr, zend_ulong); typedef void (*gmp_binary_op_t)(mpz_ptr, mpz_srcptr, mpz_srcptr); typedef int (*gmp_binary_opl_t)(mpz_srcptr, mpz_srcptr); -typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, php_uint_t); +typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, zend_ulong); typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); -typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, php_uint_t); +typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, zend_ulong); static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC); static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int check_b_zero TSRMLS_DC); @@ -407,9 +407,9 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* gmpnum = GET_GMP_FROM_ZVAL(readobj); gmp_strval(writeobj, gmpnum, 10); return SUCCESS; - case IS_INT: + case IS_LONG: gmpnum = GET_GMP_FROM_ZVAL(readobj); - ZVAL_INT(writeobj, mpz_get_si(gmpnum)); + ZVAL_LONG(writeobj, mpz_get_si(gmpnum)); return SUCCESS; case IS_DOUBLE: gmpnum = GET_GMP_FROM_ZVAL(readobj); @@ -452,7 +452,7 @@ static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */ /* }}} */ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2 TSRMLS_DC) { - php_int_t shift = zval_get_int(op2); + zend_long shift = zval_get_long(op2); if (shift < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shift cannot be negative"); @@ -463,7 +463,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva FETCH_GMP_ZVAL(gmpnum_op, op1, temp); INIT_GMP_RETVAL(gmpnum_result); - op(gmpnum_result, gmpnum_op, (php_uint_t) shift); + op(gmpnum_result, gmpnum_op, (zend_ulong) shift); FREE_GMP_TEMP(temp); } } @@ -523,7 +523,7 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { gmp_cmp(result, op1, op2 TSRMLS_CC); if (Z_TYPE_P(result) == IS_FALSE) { - ZVAL_INT(result, 1); + ZVAL_LONG(result, 1); } return SUCCESS; } @@ -550,7 +550,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_le PHP_VAR_SERIALIZE_DESTROY(serialize_data); *buffer = (unsigned char *) estrndup(buf.s->val, buf.s->len); *buf_len = buf.s->len; - STR_RELEASE(buf.s); + zend_string_release(buf.s); return SUCCESS; } @@ -631,9 +631,9 @@ ZEND_MINIT_FUNCTION(gmp) gmp_object_handlers.do_operation = gmp_do_operation; gmp_object_handlers.compare = gmp_compare; - REGISTER_INT_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); #ifdef mpir_version REGISTER_STRING_CONSTANT("GMP_MPIR_VERSION", (char *)mpir_version, CONST_CS | CONST_PERSISTENT); #endif @@ -679,10 +679,10 @@ ZEND_MODULE_INFO_D(gmp) static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) { switch (Z_TYPE_P(val)) { - case IS_INT: + case IS_LONG: case IS_FALSE: case IS_TRUE: { - mpz_set_si(gmpnumber, zval_get_int(val)); + mpz_set_si(gmpnumber, zval_get_long(val)); return SUCCESS; } case IS_STRING: { @@ -690,7 +690,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) int skip_lead = 0; int ret; - if (Z_STRSIZE_P(val) > 2) { + if (Z_STRLEN_P(val) > 2) { if (numstr[0] == '0') { if (numstr[1] == 'x' || numstr[1] == 'X') { base = 16; @@ -719,7 +719,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) } /* }}} */ -static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */ +static void gmp_strval(zval *result, mpz_t gmpnum, zend_long base) /* {{{ */ { int num_len; zend_string *str; @@ -729,7 +729,7 @@ static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */ num_len++; } - str = STR_ALLOC(num_len, 0); + str = zend_string_alloc(num_len, 0); mpz_get_str(str->val, base, gmpnum); /* @@ -755,11 +755,11 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; zend_bool use_si = 0; - php_int_t res; + zend_long res; FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (Z_TYPE_P(b_arg) == IS_INT) { + if (Z_TYPE_P(b_arg) == IS_LONG) { use_si = 1; temp_b.is_used = 0; } else { @@ -767,7 +767,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { } if (use_si) { - res = mpz_cmp_si(gmpnum_a, Z_IVAL_P(b_arg)); + res = mpz_cmp_si(gmpnum_a, Z_LVAL_P(b_arg)); } else { res = mpz_cmp(gmpnum_a, gmpnum_b); } @@ -775,7 +775,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); - RETURN_INT(res); + RETURN_LONG(res); } /* }}} */ @@ -790,7 +790,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { use_ui = 1; temp_b.is_used = 0; } else { @@ -800,7 +800,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_IVAL_P(b_arg) == 0); + b_is_zero = (Z_LVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -816,7 +816,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - gmp_ui_op(gmpnum_result, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg)); + gmp_ui_op(gmpnum_result, gmpnum_a, (zend_ulong) Z_LVAL_P(b_arg)); } else { gmp_op(gmpnum_result, gmpnum_a, gmpnum_b); } @@ -838,7 +838,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { /* use _ui function */ use_ui = 1; temp_b.is_used = 0; @@ -849,7 +849,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_IVAL_P(b_arg) == 0); + b_is_zero = (Z_LVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -870,7 +870,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval add_next_index_zval(return_value, &result2); if (use_ui) { - gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg)); + gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (zend_ulong) Z_LVAL_P(b_arg)); } else { gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b); } @@ -919,7 +919,7 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una mpz_ptr gmpnum_result; INIT_GMP_RETVAL(gmpnum_result); - gmp_op(gmpnum_result, zval_get_int(a_arg)); + gmp_op(gmpnum_result, zval_get_long(a_arg)); } /* }}} */ @@ -965,7 +965,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_INT(gmp_op(gmpnum_a)); + RETVAL_LONG(gmp_op(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -985,7 +985,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - RETVAL_INT(gmp_op(gmpnum_a, gmpnum_b)); + RETVAL_LONG(gmp_op(gmpnum_a, gmpnum_b)); FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); @@ -998,9 +998,9 @@ ZEND_FUNCTION(gmp_init) { zval *number_arg; mpz_ptr gmpnumber; - php_int_t base = 0; + zend_long base = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &number_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &number_arg, &base) == FAILURE) { return; } @@ -1028,9 +1028,9 @@ ZEND_FUNCTION(gmp_intval) } if (IS_GMP(gmpnumber_arg)) { - RETVAL_INT(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); + RETVAL_LONG(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); } else { - RETVAL_INT(zval_get_int(gmpnumber_arg)); + RETVAL_LONG(zval_get_long(gmpnumber_arg)); } } /* }}} */ @@ -1040,11 +1040,11 @@ ZEND_FUNCTION(gmp_intval) ZEND_FUNCTION(gmp_strval) { zval *gmpnumber_arg; - php_int_t base = 10; + zend_long base = 10; mpz_ptr gmpnum; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &base) == FAILURE) { return; } @@ -1097,9 +1097,9 @@ ZEND_FUNCTION(gmp_mul) ZEND_FUNCTION(gmp_div_qr) { zval *a_arg, *b_arg; - php_int_t round = GMP_ROUND_ZERO; + zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1125,9 +1125,9 @@ ZEND_FUNCTION(gmp_div_qr) ZEND_FUNCTION(gmp_div_r) { zval *a_arg, *b_arg; - php_int_t round = GMP_ROUND_ZERO; + zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1153,9 +1153,9 @@ ZEND_FUNCTION(gmp_div_r) ZEND_FUNCTION(gmp_div_q) { zval *a_arg, *b_arg; - php_int_t round = GMP_ROUND_ZERO; + zend_long round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1226,7 +1226,7 @@ ZEND_FUNCTION(gmp_fact) RETURN_FALSE; } } else { - if (zval_get_int(a_arg) < 0) { + if (zval_get_long(a_arg) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); RETURN_FALSE; } @@ -1243,9 +1243,9 @@ ZEND_FUNCTION(gmp_pow) zval *base_arg; mpz_ptr gmpnum_result, gmpnum_base; gmp_temp_t temp_base; - php_int_t exp; + zend_long exp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &base_arg, &exp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &base_arg, &exp) == FAILURE) { return; } @@ -1255,8 +1255,8 @@ ZEND_FUNCTION(gmp_pow) } INIT_GMP_RETVAL(gmpnum_result); - if (Z_TYPE_P(base_arg) == IS_INT && Z_IVAL_P(base_arg) >= 0) { - mpz_ui_pow_ui(gmpnum_result, Z_IVAL_P(base_arg), exp); + if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) { + mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp); } else { FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); mpz_pow_ui(gmpnum_result, gmpnum_base, exp); @@ -1280,7 +1280,7 @@ ZEND_FUNCTION(gmp_powm) FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); - if (Z_TYPE_P(exp_arg) == IS_INT && Z_IVAL_P(exp_arg) >= 0) { + if (Z_TYPE_P(exp_arg) == IS_LONG && Z_LVAL_P(exp_arg) >= 0) { use_ui = 1; temp_exp.is_used = 0; } else { @@ -1305,7 +1305,7 @@ ZEND_FUNCTION(gmp_powm) INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - mpz_powm_ui(gmpnum_result, gmpnum_base, (php_uint_t) Z_IVAL_P(exp_arg), gmpnum_mod); + mpz_powm_ui(gmpnum_result, gmpnum_base, (zend_ulong) Z_LVAL_P(exp_arg), gmpnum_mod); } else { mpz_powm(gmpnum_result, gmpnum_base, gmpnum_exp, gmpnum_mod); FREE_GMP_TEMP(temp_exp); @@ -1380,11 +1380,11 @@ ZEND_FUNCTION(gmp_sqrtrem) ZEND_FUNCTION(gmp_root) { zval *a_arg; - php_int_t nth; + zend_long nth; mpz_ptr gmpnum_a, gmpnum_result; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { return; } @@ -1412,12 +1412,12 @@ ZEND_FUNCTION(gmp_root) ZEND_FUNCTION(gmp_rootrem) { zval *a_arg; - php_int_t nth; + zend_long nth; mpz_ptr gmpnum_a, gmpnum_result1, gmpnum_result2; gmp_temp_t temp_a; zval result1, result2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { return; } @@ -1479,16 +1479,16 @@ ZEND_FUNCTION(gmp_prob_prime) { zval *gmpnumber_arg; mpz_ptr gmpnum_a; - php_int_t reps = 10; + zend_long reps = 10; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &reps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &reps) == FAILURE) { return; } FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a); - RETVAL_INT(mpz_probab_prime_p(gmpnum_a, reps)); + RETVAL_LONG(mpz_probab_prime_p(gmpnum_a, reps)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1604,7 +1604,7 @@ ZEND_FUNCTION(gmp_sign) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_INT(mpz_sgn(gmpnum_a)); + RETVAL_LONG(mpz_sgn(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1613,10 +1613,10 @@ ZEND_FUNCTION(gmp_sign) Gets random number */ ZEND_FUNCTION(gmp_random) { - php_int_t limiter = 20; + zend_long limiter = 20; mpz_ptr gmpnum_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &limiter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limiter) == FAILURE) { return; } @@ -1684,11 +1684,11 @@ ZEND_FUNCTION(gmp_xor) ZEND_FUNCTION(gmp_setbit) { zval *a_arg; - php_int_t index; + zend_long index; zend_bool set = 1; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { return; } @@ -1712,10 +1712,10 @@ ZEND_FUNCTION(gmp_setbit) ZEND_FUNCTION(gmp_clrbit) { zval *a_arg; - php_int_t index; + zend_long index; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &a_arg, gmp_ce, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &a_arg, gmp_ce, &index) == FAILURE){ return; } @@ -1734,11 +1734,11 @@ ZEND_FUNCTION(gmp_clrbit) ZEND_FUNCTION(gmp_testbit) { zval *a_arg; - php_int_t index; + zend_long index; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &index) == FAILURE){ return; } @@ -1776,9 +1776,9 @@ ZEND_FUNCTION(gmp_scan0) zval *a_arg; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - php_int_t start; + zend_long start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ return; } @@ -1789,7 +1789,7 @@ ZEND_FUNCTION(gmp_scan0) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_INT(mpz_scan0(gmpnum_a, start)); + RETVAL_LONG(mpz_scan0(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1801,9 +1801,9 @@ ZEND_FUNCTION(gmp_scan1) zval *a_arg; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - php_int_t start; + zend_long start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ return; } @@ -1814,7 +1814,7 @@ ZEND_FUNCTION(gmp_scan1) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_INT(mpz_scan1(gmpnum_a, start)); + RETVAL_LONG(mpz_scan1(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 07e63d3f65..1af01ef265 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -161,7 +161,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_ ops->hash_update(context, (unsigned char *) data, data_len); } - digest = STR_ALLOC(ops->digest_size, 0); + digest = zend_string_alloc(ops->digest_size, 0); ops->hash_final((unsigned char *) digest->val, context); efree(context); @@ -169,11 +169,11 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_ digest->val[ops->digest_size] = 0; RETURN_STR(digest); } else { - zend_string *hex_digest = STR_SAFE_ALLOC(ops->digest_size, 2, 0, 0); + zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0); php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size); hex_digest->val[2 * ops->digest_size] = 0; - STR_RELEASE(digest); + zend_string_release(digest); RETURN_STR(hex_digest); } } @@ -225,7 +225,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops * php_hash_string_xor_char(K, K, 0x36, ops->block_size); } -static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const php_int_t data_size) { +static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const zend_long data_size) { ops->hash_init(context); ops->hash_update(context, key, ops->block_size); ops->hash_update(context, data, data_size); @@ -264,7 +264,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, context = emalloc(ops->context_size); K = emalloc(ops->block_size); - digest = STR_ALLOC(ops->digest_size, 0); + digest = zend_string_alloc(ops->digest_size, 0); php_hash_hmac_prep_key(K, ops, context, (unsigned char *) key, key_len); @@ -295,11 +295,11 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, digest->val[ops->digest_size] = 0; RETURN_STR(digest); } else { - zend_string *hex_digest = STR_SAFE_ALLOC(ops->digest_size, 2, 0, 0); + zend_string *hex_digest = zend_string_safe_alloc(ops->digest_size, 2, 0, 0); php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, ops->digest_size); hex_digest->val[2 * ops->digest_size] = 0; - STR_RELEASE(digest); + zend_string_release(digest); RETURN_STR(hex_digest); } } @@ -330,12 +330,12 @@ PHP_FUNCTION(hash_init) { char *algo, *key = NULL; int algo_len, key_len = 0, argc = ZEND_NUM_ARGS(); - php_int_t options = 0; + zend_long options = 0; void *context; const php_hash_ops *ops; php_hash_data *hash; - if (zend_parse_parameters(argc TSRMLS_CC, "s|is", &algo, &algo_len, &options, &key, &key_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, &options, &key, &key_len) == FAILURE) { return; } @@ -417,9 +417,9 @@ PHP_FUNCTION(hash_update_stream) zval *zhash, *zstream; php_hash_data *hash; php_stream *stream = NULL; - php_int_t length = -1, didread = 0; + zend_long length = -1, didread = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &zhash, &zstream, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zhash, &zstream, &length) == FAILURE) { return; } @@ -428,7 +428,7 @@ PHP_FUNCTION(hash_update_stream) while (length) { char buf[1024]; - php_int_t n, toread = 1024; + zend_long n, toread = 1024; if (length > 0 && toread > length) { toread = length; @@ -436,14 +436,14 @@ PHP_FUNCTION(hash_update_stream) if ((n = php_stream_read(stream, buf, toread)) <= 0) { /* Nada mas */ - RETURN_INT(didread); + RETURN_LONG(didread); } hash->ops->hash_update(hash->context, (unsigned char *) buf, n); length -= n; didread += n; } - RETURN_INT(didread); + RETURN_LONG(didread); } /* }}} */ @@ -497,7 +497,7 @@ PHP_FUNCTION(hash_final) ZEND_FETCH_RESOURCE(hash, php_hash_data*, zhash, -1, PHP_HASH_RESNAME, php_hash_le_hash); digest_len = hash->ops->digest_size; - digest = STR_ALLOC(digest_len, 0); + digest = zend_string_alloc(digest_len, 0); hash->ops->hash_final((unsigned char *) digest->val, hash->context); if (hash->options & PHP_HASH_HMAC) { int i; @@ -534,11 +534,11 @@ PHP_FUNCTION(hash_final) if (raw_output) { RETURN_STR(digest); } else { - zend_string *hex_digest = STR_SAFE_ALLOC(digest_len, 2, 0, 0); + zend_string *hex_digest = zend_string_safe_alloc(digest_len, 2, 0, 0); php_hash_bin2hex(hex_digest->val, (unsigned char *) digest->val, digest_len); hex_digest->val[2 * digest_len] = 0; - STR_RELEASE(digest); + zend_string_release(digest); RETURN_STR(hex_digest); } } @@ -589,7 +589,7 @@ PHP_FUNCTION(hash_algos) array_init(return_value); ZEND_HASH_FOREACH_STR_KEY(&php_hash_hashtable, str) { - add_next_index_str(return_value, STR_COPY(str)); + add_next_index_str(return_value, zend_string_copy(str)); } ZEND_HASH_FOREACH_END(); } /* }}} */ @@ -602,13 +602,13 @@ PHP_FUNCTION(hash_pbkdf2) zend_string *returnval; char *algo, *salt, *pass = NULL; unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL; - php_int_t loops, i, j, algo_len, pass_len, iterations, length = 0, digest_length = 0; + zend_long loops, i, j, algo_len, pass_len, iterations, length = 0, digest_length = 0; int salt_len = 0; zend_bool raw_output = 0; const php_hash_ops *ops; void *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|ib", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { return; } @@ -655,10 +655,10 @@ PHP_FUNCTION(hash_pbkdf2) } digest_length = length; if (!raw_output) { - digest_length = (php_int_t) ceil((float) length / 2.0); + digest_length = (zend_long) ceil((float) length / 2.0); } - loops = (php_int_t) ceil((float) digest_length / (float) ops->digest_size); + loops = (zend_long) ceil((float) digest_length / (float) ops->digest_size); result = safe_emalloc(loops, ops->digest_size, 0); @@ -674,7 +674,7 @@ PHP_FUNCTION(hash_pbkdf2) computed_salt[salt_len + 2] = (unsigned char) ((i & 0xFF00) >> 8); computed_salt[salt_len + 3] = (unsigned char) (i & 0xFF); - php_hash_hmac_round(digest, ops, context, K1, computed_salt, (php_int_t) salt_len + 4); + php_hash_hmac_round(digest, ops, context, K1, computed_salt, (zend_long) salt_len + 4); php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); /* } */ @@ -707,7 +707,7 @@ PHP_FUNCTION(hash_pbkdf2) efree(digest); efree(temp); - returnval = STR_ALLOC(length, 0); + returnval = zend_string_alloc(length, 0); if (raw_output) { memcpy(returnval->val, result, length); } else { @@ -743,7 +743,7 @@ PHP_FUNCTION(hash_equals) RETURN_FALSE; } - if (Z_STRSIZE_P(known_zval) != Z_STRSIZE_P(user_zval)) { + if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) { RETURN_FALSE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(hash_equals) user_str = Z_STRVAL_P(user_zval); /* This is security sensitive code. Do not optimize this for speed. */ - for (j = 0; j < Z_STRSIZE_P(known_zval); j++) { + for (j = 0; j < Z_STRLEN_P(known_zval); j++) { result |= known_str[j] ^ user_str[j]; } @@ -819,7 +819,7 @@ static void mhash_init(INIT_FUNC_ARGS) } len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name)); - zend_register_int_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); + zend_register_long_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); } zend_register_internal_module(&mhash_module_entry TSRMLS_CC); } @@ -829,7 +829,7 @@ static void mhash_init(INIT_FUNC_ARGS) PHP_FUNCTION(mhash) { zval *z_algorithm; - php_int_t algorithm; + zend_long algorithm; if (zend_parse_parameters(1 TSRMLS_CC, "z", &z_algorithm) == FAILURE) { return; @@ -837,7 +837,7 @@ PHP_FUNCTION(mhash) SEPARATE_ZVAL(z_algorithm); convert_to_int_ex(z_algorithm); - algorithm = Z_IVAL_P(z_algorithm); + algorithm = Z_LVAL_P(z_algorithm); /* need to convert the first parameter from int constant to string algorithm name */ if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) { @@ -861,9 +861,9 @@ PHP_FUNCTION(mhash) Gets the name of hash */ PHP_FUNCTION(mhash_get_hash_name) { - php_int_t algorithm; + zend_long algorithm; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) { return; } @@ -884,7 +884,7 @@ PHP_FUNCTION(mhash_count) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_INT(MHASH_NUM_ALGOS - 1); + RETURN_LONG(MHASH_NUM_ALGOS - 1); } /* }}} */ @@ -892,9 +892,9 @@ PHP_FUNCTION(mhash_count) Gets the block size of hash */ PHP_FUNCTION(mhash_get_block_size) { - php_int_t algorithm; + zend_long algorithm; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) { return; } RETVAL_FALSE; @@ -904,7 +904,7 @@ PHP_FUNCTION(mhash_get_block_size) if (algorithm_lookup.mhash_name) { const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name)); if (ops) { - RETVAL_INT(ops->digest_size); + RETVAL_LONG(ops->digest_size); } } } @@ -917,13 +917,13 @@ PHP_FUNCTION(mhash_get_block_size) Generates a key using hash functions */ PHP_FUNCTION(mhash_keygen_s2k) { - php_int_t algorithm, l_bytes; + zend_long algorithm, l_bytes; int bytes; char *password, *salt; int password_len, salt_len; char padded_salt[SALT_SIZE]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "issi", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) { return; } @@ -1044,7 +1044,7 @@ PHP_MINIT_FUNCTION(hash) PHP_HASH_HAVAL_REGISTER(5,224); PHP_HASH_HAVAL_REGISTER(5,256); - REGISTER_INT_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); #ifdef PHP_MHASH_BC mhash_init(INIT_FUNC_ARGS_PASSTHRU); diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index e8c1543055..42c559d971 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -55,7 +55,7 @@ typedef struct _php_hash_data { const php_hash_ops *ops; void *context; - php_int_t options; + zend_long options; unsigned char *key; } php_hash_data; diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 6eb0fc0701..b38d755701 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -60,7 +60,7 @@ #include "ext/standard/quot_print.h" #define _php_iconv_memequal(a, b, c) \ - ((c) == sizeof(php_uint_t) ? *((php_uint_t *)(a)) == *((php_uint_t *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) + ((c) == sizeof(zend_ulong) ? *((zend_ulong *)(a)) == *((zend_ulong *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1) @@ -198,9 +198,9 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc); -static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc); +static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, zend_long offset, zend_long len, const char *enc); -static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, php_int_t offset, const char *enc); +static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, zend_long offset, const char *enc); static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc); @@ -300,8 +300,8 @@ PHP_MINIT_FUNCTION(miconv) #endif REGISTER_STRING_CONSTANT("ICONV_VERSION", version, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); if (php_iconv_stream_filter_register_factory(TSRMLS_C) != PHP_ICONV_ERR_SUCCESS) { return FAILURE; @@ -431,7 +431,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c } if (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) { - php_int_t len; + zend_long len; char *p = strstr(get_output_encoding(TSRMLS_C), "//"); if (p) { @@ -453,7 +453,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c if (out) { output_context->out.data = estrndup(out->val, out->len); output_context->out.used = out->len; - STR_FREE(out); + zend_string_free(out); } else { output_context->out.data = NULL; output_context->out.used = 0; @@ -580,7 +580,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, return PHP_ICONV_ERR_UNKNOWN; } - out_buffer = STR_ALLOC(out_size, 0); + out_buffer = zend_string_alloc(out_size, 0); out_p = out_buffer->val; #ifdef NETWARE @@ -591,13 +591,13 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, &out_p, &out_left); if (result == (size_t)(-1)) { - STR_FREE(out_buffer); + zend_string_free(out_buffer); return PHP_ICONV_ERR_UNKNOWN; } if (out_left < 8) { size_t pos = out_p - out_buffer->val; - out_buffer = STR_REALLOC(out_buffer, out_size + 8, 0); + out_buffer = zend_string_realloc(out_buffer, out_size + 8, 0); out_p = out_buffer->val + pos; out_size += 7; out_left += 7; @@ -607,7 +607,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, result = iconv(cd, NULL, NULL, &out_p, &out_left); if (result == (size_t)(-1)) { - STR_FREE(out_buffer); + zend_string_free(out_buffer); return PHP_ICONV_ERR_UNKNOWN; } @@ -645,7 +645,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, out_left = in_len + 32; /* Avoid realloc() most cases */ out_size = 0; bsz = out_left; - out_buf = STR_ALLOC(bsz, 0); + out_buf = zend_string_alloc(bsz, 0); out_p = out_buf->val; while (in_left > 0) { @@ -656,7 +656,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, /* converted string is longer than out buffer */ bsz += in_len; - out_buf = STR_REALLOC(out_buf, bsz, 0); + out_buf = zend_string_realloc(out_buf, bsz, 0); out_p = out_buf->val; out_p += out_size; out_left = bsz - out_size; @@ -678,7 +678,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, if (errno == E2BIG) { bsz += 16; - out_buf = STR_REALLOC(out_buf, bsz, 0); + out_buf = zend_string_realloc(out_buf, bsz, 0); out_p = out_buf->val; out_p += out_size; out_left = bsz - out_size; @@ -708,7 +708,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, default: /* other error */ retval = PHP_ICONV_ERR_UNKNOWN; - STR_FREE(out_buf); + zend_string_free(out_buf); return PHP_ICONV_ERR_UNKNOWN; } } @@ -806,7 +806,7 @@ static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, s /* {{{ _php_iconv_substr() */ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, - const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc) + const char *str, size_t nbytes, zend_long offset, zend_long len, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES]; @@ -821,7 +821,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, size_t out_left; php_size_t cnt; - php_int_t total_len; + zend_long total_len; err = _php_iconv_strlen(&total_len, str, nbytes, enc); if (err != PHP_ICONV_ERR_SUCCESS) { @@ -890,7 +890,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, } } - if ((php_int_t)cnt >= offset) { + if ((zend_long)cnt >= offset) { if (cd2 == (iconv_t)NULL) { cd2 = iconv_open(enc, GENERIC_SUPERSET_NAME); @@ -954,7 +954,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, - php_int_t offset, const char *enc) + zend_long offset, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES]; @@ -982,7 +982,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, if (err != PHP_ICONV_ERR_SUCCESS) { if (ndl_buf != NULL) { - STR_FREE(ndl_buf); + zend_string_free(ndl_buf); } return err; } @@ -991,7 +991,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, if (cd == (iconv_t)(-1)) { if (ndl_buf != NULL) { - STR_FREE(ndl_buf); + zend_string_free(ndl_buf); } #if ICONV_SUPPORTS_ERRNO if (errno == EINVAL) { @@ -1126,7 +1126,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, } if (ndl_buf) { - STR_FREE(ndl_buf); + zend_string_free(ndl_buf); } iconv_close(cd); @@ -1335,7 +1335,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn smart_str_appendl(pretval, "?=", sizeof("?=") - 1); char_cnt -= 2; - STR_RELEASE(encoded); + zend_string_release(encoded); encoded = NULL; } break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */ @@ -1454,7 +1454,7 @@ out: iconv_close(cd_pl); } if (encoded != NULL) { - STR_RELEASE(encoded); + zend_string_release(encoded); } if (buf != NULL) { efree(buf); @@ -1836,7 +1836,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st } err = _php_iconv_appendl(pretval, decoded_text->val, decoded_text->len, cd); - STR_RELEASE(decoded_text); + zend_string_release(decoded_text); if (err != PHP_ICONV_ERR_SUCCESS) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { @@ -2054,7 +2054,7 @@ PHP_FUNCTION(iconv_strlen) err = _php_iconv_strlen(&retval, str->val, str->len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { - RETVAL_INT(retval); + RETVAL_LONG(retval); } else { RETVAL_FALSE; } @@ -2068,13 +2068,13 @@ PHP_FUNCTION(iconv_substr) char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; zend_string *str; - php_int_t offset, length = 0; + zend_long offset, length = 0; php_iconv_err_t err; smart_str retval = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|is", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|ls", &str, &offset, &length, &charset, &charset_len) == FAILURE) { RETURN_FALSE; @@ -2108,13 +2108,13 @@ PHP_FUNCTION(iconv_strpos) int charset_len = 0; zend_string *haystk; zend_string *ndl; - php_int_t offset = 0; + zend_long offset = 0; php_iconv_err_t err; php_size_t retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|is", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ls", &haystk, &ndl, &offset, &charset, &charset_len) == FAILURE) { RETURN_FALSE; @@ -2139,7 +2139,7 @@ PHP_FUNCTION(iconv_strpos) _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { - RETVAL_INT((php_int_t)retval); + RETVAL_LONG((zend_long)retval); } else { RETVAL_FALSE; } @@ -2179,7 +2179,7 @@ PHP_FUNCTION(iconv_strrpos) _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { - RETVAL_INT((php_int_t)retval); + RETVAL_LONG((zend_long)retval); } else { RETVAL_FALSE; } @@ -2199,7 +2199,7 @@ PHP_FUNCTION(iconv_mime_encode) const char *in_charset = get_internal_encoding(TSRMLS_C); const char *out_charset = in_charset; - php_int_t line_len = 76; + zend_long line_len = 76; const char *lfchars = "\r\n"; php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; @@ -2214,7 +2214,7 @@ PHP_FUNCTION(iconv_mime_encode) zval *pzval; if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) { - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { switch (Z_STRVAL_P(pzval)[0]) { case 'B': case 'b': scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; @@ -2228,24 +2228,24 @@ PHP_FUNCTION(iconv_mime_encode) } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL) { - if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { in_charset = Z_STRVAL_P(pzval); } } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL) { - if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { out_charset = Z_STRVAL_P(pzval); } } @@ -2253,13 +2253,13 @@ PHP_FUNCTION(iconv_mime_encode) if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-length", sizeof("line-length") - 1)) != NULL) { zval val; - if (Z_TYPE_P(pzval) != IS_INT) { + if (Z_TYPE_P(pzval) != IS_LONG) { ZVAL_DUP(&val, pzval); convert_to_int(&val); pzval = &val; } - line_len = Z_IVAL_P(pzval); + line_len = Z_LVAL_P(pzval); } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) { @@ -2305,13 +2305,13 @@ PHP_FUNCTION(iconv_mime_decode) zend_string *encoded_str; char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - php_int_t mode = 0; + zend_long mode = 0; smart_str retval = {0}; php_iconv_err_t err; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &encoded_str, &mode, &charset, &charset_len) == FAILURE) { RETURN_FALSE; @@ -2345,13 +2345,13 @@ PHP_FUNCTION(iconv_mime_decode_headers) zend_string *encoded_str; char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - php_int_t mode = 0; + zend_long mode = 0; char *enc_str_tmp; php_size_t enc_str_len_tmp; php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &encoded_str, &mode, &charset, &charset_len) == FAILURE) { RETURN_FALSE; @@ -2461,7 +2461,7 @@ PHP_NAMED_FUNCTION(php_if_iconv) RETVAL_STR(out_buffer); } else { if (out_buffer != NULL) { - STR_FREE(out_buffer); + zend_string_free(out_buffer); } RETURN_FALSE; } @@ -2485,17 +2485,17 @@ PHP_FUNCTION(iconv_set_encoding) } if(!strcasecmp("input_encoding", type)) { - name = STR_INIT("iconv.input_encoding", sizeof("iconv.input_encoding") - 1, 0); + name = zend_string_init("iconv.input_encoding", sizeof("iconv.input_encoding") - 1, 0); } else if(!strcasecmp("output_encoding", type)) { - name = STR_INIT("iconv.output_encoding", sizeof("iconv.output_encoding") - 1, 0); + name = zend_string_init("iconv.output_encoding", sizeof("iconv.output_encoding") - 1, 0); } else if(!strcasecmp("internal_encoding", type)) { - name = STR_INIT("iconv.internal_encoding", sizeof("iconv.internal_encoding") - 1, 0); + name = zend_string_init("iconv.internal_encoding", sizeof("iconv.internal_encoding") - 1, 0); } else { RETURN_FALSE; } retval = zend_alter_ini_entry(name, charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(name); + zend_string_release(name); if (retval == SUCCESS) { RETURN_TRUE; diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6e33e463ae..7e56de668a 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -770,12 +770,12 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist) if (strncmp(qlist->name, "STORAGE", 7) == 0) { /* this is to add backwards compatibility */ - add_assoc_int_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_int_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_long_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_long_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); } - add_assoc_int_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_int_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_long_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_long_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); add_assoc_zval_ex(return_value, qlist->name, strlen(qlist->name), &t_map); } } @@ -864,7 +864,7 @@ PHP_MINIT_FUNCTION(imap) #endif /* lets allow NIL */ - REGISTER_INT_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); /* plug in our gets */ mail_parameters(NIL, SET_GETS, (void *) NIL); @@ -876,30 +876,30 @@ PHP_MINIT_FUNCTION(imap) mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) FG(default_socket_timeout)); /* timeout constants */ - REGISTER_INT_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); /* Open Options */ - REGISTER_INT_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); /* debug protocol negotiations */ - REGISTER_INT_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); /* read-only open */ - REGISTER_INT_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); /* anonymous open of newsgroup */ - REGISTER_INT_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); /* short (elt-only) caching */ - REGISTER_INT_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); /* don't pass up events (internal use) */ - REGISTER_INT_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); /* return driver prototype */ - REGISTER_INT_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); /* half-open (IMAP connect but no select) */ - REGISTER_INT_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* silently expunge recycle stream */ - REGISTER_INT_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); /* don't do non-secure authentication */ /* @@ -910,111 +910,111 @@ PHP_MINIT_FUNCTION(imap) options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of this file */ - REGISTER_INT_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* expunge silently */ /* Fetch options */ - REGISTER_INT_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID */ - REGISTER_INT_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); /* peek at data */ - REGISTER_INT_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); /* NOT flag for header lines fetch */ - REGISTER_INT_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); /* text can be internal strings */ - REGISTER_INT_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); /* IMAP prefetch text when fetching header */ /* Flagging options */ - REGISTER_INT_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_INT_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); /* don't return results */ - REGISTER_INT_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); /* set vs. clear */ /* Copy options */ - REGISTER_INT_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_INT_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); /* delete from source after copying */ /* Search/sort options */ - REGISTER_INT_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); /* return UID */ - REGISTER_INT_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); /* free search program after finished */ - REGISTER_INT_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); /* no search prefetching */ - REGISTER_INT_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); /* free sort program after finished */ - REGISTER_INT_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); /* don't do server-based sort */ /* Status options */ - REGISTER_INT_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); /* number of messages */ - REGISTER_INT_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); /* number of recent messages */ - REGISTER_INT_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); /* number of unseen messages */ - REGISTER_INT_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); /* next UID to be assigned */ - REGISTER_INT_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ - REGISTER_INT_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ /* Bits for mm_list() and mm_lsub() */ - REGISTER_INT_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); #ifdef LATT_REFERRAL - REGISTER_INT_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASCHILDREN - REGISTER_INT_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASNOCHILDREN - REGISTER_INT_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); #endif /* Sort functions */ - REGISTER_INT_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); /* date */ - REGISTER_INT_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); /* arrival date */ - REGISTER_INT_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); /* from */ - REGISTER_INT_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); /* subject */ - REGISTER_INT_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); /* to */ - REGISTER_INT_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); /* cc */ - REGISTER_INT_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); /* size */ - REGISTER_INT_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); /* TYPETEXT unformatted text TYPEMULTIPART multiple part @@ -1027,12 +1027,12 @@ PHP_MINIT_FUNCTION(imap) TYPEOTHER unknown */ - REGISTER_INT_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); /* ENC7BIT 7 bit SMTP semantic data ENC8BIT 8 bit SMTP semantic data @@ -1042,9 +1042,9 @@ PHP_MINIT_FUNCTION(imap) ENCOTHER unknown */ - REGISTER_INT_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); /* GC_ELT message cache elements GC_ENV ENVELOPEs and BODYs @@ -1173,7 +1173,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if ((disabled_auth_method = zend_hash_str_find(HASH_OF(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) { switch (Z_TYPE_P(disabled_auth_method)) { case IS_STRING: - if (Z_STRSIZE_P(disabled_auth_method) > 1) { + if (Z_STRLEN_P(disabled_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(disabled_auth_method)); } break; @@ -1189,7 +1189,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) for (i = 0; i < nelems; i++) { if ((z_auth_method = zend_hash_index_find(Z_ARRVAL_P(disabled_auth_method), i)) != NULL) { if (Z_TYPE_P(z_auth_method) == IS_STRING) { - if (Z_STRSIZE_P(z_auth_method) > 1) { + if (Z_STRLEN_P(z_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(z_auth_method)); } } else { @@ -1199,7 +1199,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } break; - case IS_INT: + case IS_LONG: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -1326,20 +1326,20 @@ PHP_FUNCTION(imap_append) return; } - regex = STR_INIT("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0); + regex = zend_string_init("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/", sizeof("/[0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/") - 1, 0); if (internal_date) { /* Make sure the given internal_date string matches the RFC specifiedformat */ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC))== NULL) { - STR_FREE(regex); + zend_string_free(regex); RETURN_FALSE; } - STR_FREE(regex); + zend_string_free(regex); php_pcre_match_impl(pce, internal_date, internal_date_len, return_value, subpats, global, 0, regex_flags, start_offset TSRMLS_CC); - if (!Z_IVAL_P(return_value)) { + if (!Z_LVAL_P(return_value)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted"); internal_date = NULL; } @@ -1370,7 +1370,7 @@ PHP_FUNCTION(imap_num_msg) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_INT(imap_le_struct->imap_stream->nmsgs); + RETURN_LONG(imap_le_struct->imap_stream->nmsgs); } /* }}} */ @@ -1404,7 +1404,7 @@ PHP_FUNCTION(imap_num_recent) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_INT(imap_le_struct->imap_stream->recent); + RETURN_LONG(imap_le_struct->imap_stream->recent); } /* }}} */ @@ -1906,7 +1906,7 @@ PHP_FUNCTION(imap_list_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_int(&mboxob, "attributes", cur->attributes); + add_property_long(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -1981,8 +1981,8 @@ PHP_FUNCTION(imap_check) add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); } else { RETURN_FALSE; } @@ -2101,7 +2101,7 @@ PHP_FUNCTION(imap_headerinfo) snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size); add_property_string(return_value, "Size", dummy); - add_property_int(return_value, "udate", mail_longdate(cache)); + add_property_long(return_value, "udate", mail_longdate(cache)); if (en->from && fromlength) { fulladdress[0] = 0x00; @@ -2211,7 +2211,7 @@ PHP_FUNCTION(imap_lsub_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_int(&mboxob, "attributes", cur->attributes); + add_property_long(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -2424,7 +2424,7 @@ PHP_FUNCTION(imap_savebody) switch (Z_TYPE_P(out)) { - case IS_INT: + case IS_LONG: case IS_RESOURCE: close_stream = 0; php_stream_from_zval(writer, out); @@ -2581,15 +2581,15 @@ PHP_FUNCTION(imap_mailboxmsginfo) } msize = msize + cache->rfc822_size; } - add_property_int(return_value, "Unread", unreadmsg); - add_property_int(return_value, "Deleted", deletedmsg); - add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_int(return_value, "Size", msize); + add_property_long(return_value, "Unread", unreadmsg); + add_property_long(return_value, "Deleted", deletedmsg); + add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_long(return_value, "Size", msize); rfc822_date(date); add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); } /* }}} */ @@ -2929,7 +2929,7 @@ PHP_FUNCTION(imap_utf7_encode) } /* allocate output buffer */ - out = STR_ALLOC(outlen, 0); + out = zend_string_alloc(outlen, 0); /* encode input string */ outp = (unsigned char*)out->val; @@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_sort) array_init(return_value); if (slst != NIL && slst != 0) { for (sl = slst; *sl; sl++) { - add_next_index_int(return_value, *sl); + add_next_index_long(return_value, *sl); } fs_give ((void **) &slst); } @@ -3193,7 +3193,7 @@ PHP_FUNCTION(imap_uid) RETURN_FALSE; } - RETURN_INT(mail_uid(imap_le_struct->imap_stream, msgno)); + RETURN_LONG(mail_uid(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3211,7 +3211,7 @@ PHP_FUNCTION(imap_msgno) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_INT(mail_msgno(imap_le_struct->imap_stream, msgno)); + RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3234,21 +3234,21 @@ PHP_FUNCTION(imap_status) object_init(return_value); if (mail_status(imap_le_struct->imap_stream, mbx, flags)) { - add_property_int(return_value, "flags", IMAPG(status_flags)); + add_property_long(return_value, "flags", IMAPG(status_flags)); if (IMAPG(status_flags) & SA_MESSAGES) { - add_property_int(return_value, "messages", IMAPG(status_messages)); + add_property_long(return_value, "messages", IMAPG(status_messages)); } if (IMAPG(status_flags) & SA_RECENT) { - add_property_int(return_value, "recent", IMAPG(status_recent)); + add_property_long(return_value, "recent", IMAPG(status_recent)); } if (IMAPG(status_flags) & SA_UNSEEN) { - add_property_int(return_value, "unseen", IMAPG(status_unseen)); + add_property_long(return_value, "unseen", IMAPG(status_unseen)); } if (IMAPG(status_flags) & SA_UIDNEXT) { - add_property_int(return_value, "uidnext", IMAPG(status_uidnext)); + add_property_long(return_value, "uidnext", IMAPG(status_uidnext)); } if (IMAPG(status_flags) & SA_UIDVALIDITY) { - add_property_int(return_value, "uidvalidity", IMAPG(status_uidvalidity)); + add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity)); } } else { RETURN_FALSE; @@ -3288,49 +3288,49 @@ PHP_FUNCTION(imap_bodystruct) RETURN_FALSE; } if (body->type <= TYPEMAX) { - add_property_int(return_value, "type", body->type); + add_property_long(return_value, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_int(return_value, "encoding", body->encoding); + add_property_long(return_value, "encoding", body->encoding); } if (body->subtype) { - add_property_int(return_value, "ifsubtype", 1); + add_property_long(return_value, "ifsubtype", 1); add_property_string(return_value, "subtype", body->subtype); } else { - add_property_int(return_value, "ifsubtype", 0); + add_property_long(return_value, "ifsubtype", 0); } if (body->description) { - add_property_int(return_value, "ifdescription", 1); + add_property_long(return_value, "ifdescription", 1); add_property_string(return_value, "description", body->description); } else { - add_property_int(return_value, "ifdescription", 0); + add_property_long(return_value, "ifdescription", 0); } if (body->id) { - add_property_int(return_value, "ifid", 1); + add_property_long(return_value, "ifid", 1); add_property_string(return_value, "id", body->id); } else { - add_property_int(return_value, "ifid", 0); + add_property_long(return_value, "ifid", 0); } if (body->size.lines) { - add_property_int(return_value, "lines", body->size.lines); + add_property_long(return_value, "lines", body->size.lines); } if (body->size.bytes) { - add_property_int(return_value, "bytes", body->size.bytes); + add_property_long(return_value, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_int(return_value, "ifdisposition", 1); + add_property_long(return_value, "ifdisposition", 1); add_property_string(return_value, "disposition", body->disposition.type); } else { - add_property_int(return_value, "ifdisposition", 0); + add_property_long(return_value, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_int(return_value, "ifdparameters", 1); + add_property_long(return_value, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -3340,12 +3340,12 @@ PHP_FUNCTION(imap_bodystruct) } while ((dpar = dpar->next)); add_assoc_object(return_value, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_int(return_value, "ifdparameters", 0); + add_property_long(return_value, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_int(return_value, "ifparameters", 1); + add_property_long(return_value, "ifparameters", 1); array_init(¶metres); do { @@ -3361,7 +3361,7 @@ PHP_FUNCTION(imap_bodystruct) } while ((par = par->next)); } else { object_init(¶metres); - add_property_int(return_value, "ifparameters", 0); + add_property_long(return_value, "ifparameters", 0); } add_assoc_object(return_value, "parameters", ¶metres TSRMLS_CC); } @@ -3436,16 +3436,16 @@ PHP_FUNCTION(imap_fetch_overview) if (env->in_reply_to) { add_property_string(&myoverview, "in_reply_to", env->in_reply_to); } - add_property_int(&myoverview, "size", elt->rfc822_size); - add_property_int(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); - add_property_int(&myoverview, "msgno", i); - add_property_int(&myoverview, "recent", elt->recent); - add_property_int(&myoverview, "flagged", elt->flagged); - add_property_int(&myoverview, "answered", elt->answered); - add_property_int(&myoverview, "deleted", elt->deleted); - add_property_int(&myoverview, "seen", elt->seen); - add_property_int(&myoverview, "draft", elt->draft); - add_property_int(&myoverview, "udate", mail_longdate(elt)); + add_property_long(&myoverview, "size", elt->rfc822_size); + add_property_long(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); + add_property_long(&myoverview, "msgno", i); + add_property_long(&myoverview, "recent", elt->recent); + add_property_long(&myoverview, "flagged", elt->flagged); + add_property_long(&myoverview, "answered", elt->answered); + add_property_long(&myoverview, "deleted", elt->deleted); + add_property_long(&myoverview, "seen", elt->seen); + add_property_long(&myoverview, "draft", elt->draft); + add_property_long(&myoverview, "udate", mail_longdate(elt)); add_next_index_object(return_value, &myoverview TSRMLS_CC); } } @@ -3474,7 +3474,7 @@ PHP_FUNCTION(imap_mail_compose) } #define PHP_RFC822_PARSE_ADRLIST(target, value) \ - str_copy = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); \ + str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \ rfc822_parse_adrlist(target, str_copy, "NO HOST"); \ efree(str_copy); @@ -3530,9 +3530,9 @@ PHP_FUNCTION(imap_mail_compose) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) { custom_headers_param = mail_newbody_parameter(); convert_to_string_ex(env_data); - custom_headers_param->value = (char *) fs_get(Z_STRSIZE_P(env_data) + 1); + custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1); custom_headers_param->attribute = NULL; - memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRSIZE_P(env_data) + 1); + memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1); custom_headers_param->next = tmp_param; tmp_param = custom_headers_param; } ZEND_HASH_FOREACH_END(); @@ -3554,11 +3554,11 @@ PHP_FUNCTION(imap_mail_compose) if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->type = (short) Z_IVAL_P(pvalue); + bod->type = (short) Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->encoding = (short) Z_IVAL_P(pvalue); + bod->encoding = (short) Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3575,8 +3575,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3597,8 +3597,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3607,8 +3607,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3617,9 +3617,9 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); - bod->contents.text.size = Z_STRSIZE_P(pvalue); + bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); + bod->contents.text.size = Z_STRLEN_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); @@ -3627,11 +3627,11 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->size.lines = Z_IVAL_P(pvalue); + bod->size.lines = Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->size.bytes = Z_IVAL_P(pvalue); + bod->size.bytes = Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3641,7 +3641,7 @@ PHP_FUNCTION(imap_mail_compose) short type = -1; if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { convert_to_int_ex(pvalue); - type = (short) Z_IVAL_P(pvalue); + type = (short) Z_LVAL_P(pvalue); } if (!toppart) { @@ -3661,13 +3661,13 @@ PHP_FUNCTION(imap_mail_compose) if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->encoding = (short) Z_IVAL_P(pvalue); + bod->encoding = (short) Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); tmp_param = mail_newbody_parameter(); - tmp_param->value = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); - memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); + tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); + memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); tmp_param->attribute = cpystr("CHARSET"); tmp_param->next = bod->parameter; bod->parameter = tmp_param; @@ -3679,8 +3679,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *)fs_get(Z_STRSIZE_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); + disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3701,8 +3701,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3711,8 +3711,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3721,9 +3721,9 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); - bod->contents.text.size = Z_STRSIZE_P(pvalue); + bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); + bod->contents.text.size = Z_STRLEN_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); @@ -3731,11 +3731,11 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->size.lines = Z_IVAL_P(pvalue); + bod->size.lines = Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { convert_to_int_ex(pvalue); - bod->size.bytes = Z_IVAL_P(pvalue); + bod->size.bytes = Z_LVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -4101,7 +4101,7 @@ PHP_FUNCTION(imap_search) cur = IMAPG(imap_messages); while (cur != NIL) { - add_next_index_int(return_value, cur->msgid); + add_next_index_long(return_value, cur->msgid); cur = cur->next; } mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail)); @@ -4390,7 +4390,7 @@ static zend_string* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC) } address[0] = 0; rfc822_write_address(address, addresslist); - return STR_INIT(address, strlen(address), 0); + return zend_string_init(address, strlen(address), 0); } /* }}} */ #endif @@ -4513,53 +4513,53 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) PART *part; if (body->type <= TYPEMAX) { - add_property_int(arg, "type", body->type); + add_property_long(arg, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_int(arg, "encoding", body->encoding); + add_property_long(arg, "encoding", body->encoding); } if (body->subtype) { - add_property_int(arg, "ifsubtype", 1); + add_property_long(arg, "ifsubtype", 1); add_property_string(arg, "subtype", body->subtype); } else { - add_property_int(arg, "ifsubtype", 0); + add_property_long(arg, "ifsubtype", 0); } if (body->description) { - add_property_int(arg, "ifdescription", 1); + add_property_long(arg, "ifdescription", 1); add_property_string(arg, "description", body->description); } else { - add_property_int(arg, "ifdescription", 0); + add_property_long(arg, "ifdescription", 0); } if (body->id) { - add_property_int(arg, "ifid", 1); + add_property_long(arg, "ifid", 1); add_property_string(arg, "id", body->id); } else { - add_property_int(arg, "ifid", 0); + add_property_long(arg, "ifid", 0); } if (body->size.lines) { - add_property_int(arg, "lines", body->size.lines); + add_property_long(arg, "lines", body->size.lines); } if (body->size.bytes) { - add_property_int(arg, "bytes", body->size.bytes); + add_property_long(arg, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_int(arg, "ifdisposition", 1); + add_property_long(arg, "ifdisposition", 1); add_property_string(arg, "disposition", body->disposition.type); } else { - add_property_int(arg, "ifdisposition", 0); + add_property_long(arg, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_int(arg, "ifdparameters", 1); + add_property_long(arg, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -4569,12 +4569,12 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((dpar = dpar->next)); add_assoc_object(arg, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_int(arg, "ifdparameters", 0); + add_property_long(arg, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_int(arg, "ifparameters", 1); + add_property_long(arg, "ifparameters", 1); array_init(¶metres); do { @@ -4590,7 +4590,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((par = par->next)); } else { object_init(¶metres); - add_property_int(arg, "ifparameters", 0); + add_property_long(arg, "ifparameters", 0); } add_assoc_object(arg, "parameters", ¶metres TSRMLS_CC); @@ -4627,24 +4627,24 @@ static void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes /* define "#.num" */ snprintf(buf, 25, "%ld.num", thisNode); - add_assoc_int(tree, buf, cur->num); + add_assoc_long(tree, buf, cur->num); snprintf(buf, 25, "%ld.next", thisNode); if(cur->next) { (*numNodes)++; - add_assoc_int(tree, buf, *numNodes); + add_assoc_long(tree, buf, *numNodes); build_thread_tree_helper(cur->next, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_int(tree, buf, 0); + add_assoc_long(tree, buf, 0); } snprintf(buf, 25, "%ld.branch", thisNode); if(cur->branch) { (*numNodes)++; - add_assoc_int(tree, buf, *numNodes); + add_assoc_long(tree, buf, *numNodes); build_thread_tree_helper(cur->branch, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_int(tree, buf, 0); + add_assoc_long(tree, buf, 0); } } /* }}} */ @@ -4733,7 +4733,7 @@ PHP_FUNCTION(imap_timeout) } timeout = (long) mail_parameters(NIL, timeout_type, NIL); - RETURN_INT(timeout); + RETURN_LONG(timeout); } else if (timeout >= 0) { switch (ttype) { case 1: diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c index 13265c7745..ac7d69363b 100644 --- a/ext/interbase/ibase_blobs.c +++ b/ext/interbase/ibase_blobs.c @@ -135,7 +135,7 @@ int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob TSRMLS_DC) /* {{{ convert_to_string_ex(string_arg); - for (rem_cnt = Z_STRSIZE_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRLEN_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -339,7 +339,7 @@ PHP_FUNCTION(ibase_blob_get) convert_to_int_ex(len_arg); - if (_php_ibase_blob_get(return_value, ib_blob, Z_IVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { + if (_php_ibase_blob_get(return_value, ib_blob, Z_LVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } } @@ -460,14 +460,14 @@ PHP_FUNCTION(ibase_blob_info) array_init(return_value); - add_index_int(return_value, 0, bl_info.total_length); - add_assoc_int(return_value, "length", bl_info.total_length); + add_index_long(return_value, 0, bl_info.total_length); + add_assoc_long(return_value, "length", bl_info.total_length); - add_index_int(return_value, 1, bl_info.num_segments); - add_assoc_int(return_value, "numseg", bl_info.num_segments); + add_index_long(return_value, 1, bl_info.num_segments); + add_assoc_long(return_value, "numseg", bl_info.num_segments); - add_index_int(return_value, 2, bl_info.max_segment); - add_assoc_int(return_value, "maxseg", bl_info.max_segment); + add_index_long(return_value, 2, bl_info.max_segment); + add_assoc_long(return_value, "maxseg", bl_info.max_segment); add_index_bool(return_value, 3, bl_info.bl_stream); add_assoc_bool(return_value, "stream", bl_info.bl_stream); diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index f8eb3b8521..150512faf4 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -178,7 +178,7 @@ PHP_FUNCTION(ibase_wait_event) isc_event_counts(occurred_event, buffer_size, event_buffer, result_buffer); for (i = 0; i < event_count; ++i) { if (occurred_event[i]) { - zend_string *result = STR_INIT(events[i], strlen(events[i]), 0); + zend_string *result = zend_string_init(events[i], strlen(events[i]), 0); _php_ibase_event_free(event_buffer,result_buffer); efree(args); RETURN_STR(result); @@ -298,7 +298,7 @@ PHP_FUNCTION(ibase_set_event_handler) } convert_to_int_ex(&args[0]); - link_res_id = Z_IVAL(args[0]); + link_res_id = Z_LVAL(args[0]); } else { /* callback, event_1 [, ... event_15] @@ -319,10 +319,10 @@ PHP_FUNCTION(ibase_set_event_handler) /* get the callback */ if (!zend_is_callable(cb_arg, 0, &cb_name TSRMLS_CC)) { _php_ibase_module_error("Callback argument %s is not a callable function" TSRMLS_CC, cb_name->val); - STR_RELEASE(cb_name); + zend_string_release(cb_name); RETURN_FALSE; } - STR_RELEASE(cb_name); + zend_string_release(cb_name); /* allocate the event resource */ event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0); diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c index 13306c78eb..66c66db6b4 100644 --- a/ext/interbase/ibase_query.c +++ b/ext/interbase/ibase_query.c @@ -29,8 +29,8 @@ #include "php_interbase.h" #include "php_ibase_includes.h" -#define ISC_INT_MIN INT_MIN -#define ISC_INT_MAX INT_MAX +#define ISC_LONG_MIN INT_MIN +#define ISC_LONG_MAX INT_MAX #define QUERY_RESULT 1 #define EXECUTE_RESULT 2 @@ -498,7 +498,7 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / *(short*) buf = (short) l; break; case SQL_LONG: - if (l > ISC_INT_MAX || l < ISC_INT_MIN) { + if (l > ISC_LONG_MAX || l < ISC_LONG_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } @@ -535,26 +535,26 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / case SQL_SHORT: convert_to_int(val); - if (Z_IVAL_P(val) > SHRT_MAX || Z_IVAL_P(val) < SHRT_MIN) { + if (Z_LVAL_P(val) > SHRT_MAX || Z_LVAL_P(val) < SHRT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } - *(short *) buf = (short) Z_IVAL_P(val); + *(short *) buf = (short) Z_LVAL_P(val); break; case SQL_LONG: convert_to_int(val); #if (SIZEOF_LONG > 4) - if (Z_IVAL_P(val) > ISC_INT_MAX || Z_IVAL_P(val) < ISC_INT_MIN) { + if (Z_LVAL_P(val) > ISC_LONG_MAX || Z_LVAL_P(val) < ISC_LONG_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } #endif - *(ISC_LONG *) buf = (ISC_LONG) Z_IVAL_P(val); + *(ISC_LONG *) buf = (ISC_LONG) Z_LVAL_P(val); break; case SQL_INT64: #if (SIZEOF_LONG >= 8) convert_to_int(val); - *(long *) buf = Z_IVAL_P(val); + *(long *) buf = Z_LVAL_P(val); #else convert_to_string(val); if (!sscanf(Z_STRVAL_P(val), "%" LL_MASK "d", &l)) { @@ -664,7 +664,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRSIZE_P(b_var) == 0); + force_null = (Z_STRLEN_P(b_var) == 0); } if (! force_null) break; @@ -689,9 +689,9 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - if (Z_TYPE_P(b_var) == IS_INT) { + if (Z_TYPE_P(b_var) == IS_LONG) { struct tm *res; - res = php_gmtime_r(&Z_IVAL_P(b_var), &t); + res = php_gmtime_r(&Z_LVAL_P(b_var), &t); if (!res) { return FAILURE; } @@ -734,7 +734,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ convert_to_string(b_var); - if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || + if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { ibase_blob ib_blob = { NULL, BLOB_INPUT }; @@ -762,7 +762,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ if (Z_TYPE_P(b_var) != IS_ARRAY) { convert_to_string(b_var); - if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || + if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { _php_ibase_module_error("Parameter %d: invalid array ID" TSRMLS_CC,i+1); @@ -799,7 +799,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ /* we end up here if none of the switch cases handled the field */ convert_to_string(b_var); var->sqldata = Z_STRVAL_P(b_var); - var->sqllen = Z_STRSIZE_P(b_var); + var->sqllen = Z_STRLEN_P(b_var); var->sqltype = SQL_TEXT; } /* for */ return rv; @@ -1022,7 +1022,7 @@ static int _php_ibase_exec(INTERNAL_FUNCTION_PARAMETERS, ibase_result **ib_resul if (!ib_query->out_sqlda) { /* no result set is being returned */ if (affected_rows) { - RETVAL_INT(affected_rows); + RETVAL_LONG(affected_rows); } else { RETVAL_TRUE; } @@ -1228,7 +1228,7 @@ PHP_FUNCTION(ibase_affected_rows) trans = ib_link->tr_list->trans; } } - RETURN_INT(trans->affected_rows); + RETURN_LONG(trans->affected_rows); } /* }}} */ @@ -1281,7 +1281,7 @@ PHP_FUNCTION(ibase_num_rows) while (result[i] != isc_info_end && i < result_size) { short len = (short)isc_vax_integer(&result[i+1],2); if (result[i] == isc_info_req_select_count) { - RETURN_INT(isc_vax_integer(&result[i+3],len)); + RETURN_LONG(isc_vax_integer(&result[i+3],len)); } i += len+3; } @@ -1354,7 +1354,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{ n = *(ISC_LONG *) data; _sql_long: if (scale == 0) { - ZVAL_INT(val,n); + ZVAL_LONG(val,n); } else { long f = (long) scales[-scale]; @@ -1396,7 +1396,7 @@ format_date_time: t.tm_zone = tzname[0]; #endif if (flag & PHP_IBASE_UNIXTIME) { - ZVAL_INT(val, mktime(&t)); + ZVAL_LONG(val, mktime(&t)); } else { #if HAVE_STRFTIME l = strftime(string_data, sizeof(string_data), format, &t); @@ -1463,7 +1463,7 @@ static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_siz if (ib_array->ar_desc.array_desc_dtype == blr_varying || ib_array->ar_desc.array_desc_dtype == blr_varying2) { - Z_STRSIZE_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); + Z_STRLEN_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); } } return SUCCESS; @@ -1904,9 +1904,9 @@ PHP_FUNCTION(ibase_num_fields) } if (sqlda == NULL) { - RETURN_INT(0); + RETURN_LONG(0); } else { - RETURN_INT(sqlda->sqld); + RETURN_LONG(sqlda->sqld); } } /* }}} */ @@ -2055,9 +2055,9 @@ PHP_FUNCTION(ibase_num_params) ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query); if (ib_query->in_sqlda == NULL) { - RETURN_INT(0); + RETURN_LONG(0); } else { - RETURN_INT(ib_query->in_sqlda->sqld); + RETURN_LONG(ib_query->in_sqlda->sqld); } } /* }}} */ diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c index a38ebcdf73..95f068e7ff 100644 --- a/ext/interbase/ibase_service.c +++ b/ext/interbase/ibase_service.c @@ -67,67 +67,67 @@ void php_ibase_service_minit(INIT_FUNC_ARGS) /* {{{ */ "interbase service manager handle", module_number); /* backup options */ - REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); /* restore options */ - REGISTER_INT_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); /* manage options */ - REGISTER_INT_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); /* repair options */ - REGISTER_INT_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); /* db info arguments */ - REGISTER_INT_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); /* server info arguments */ - REGISTER_INT_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); } /* }}} */ @@ -343,12 +343,12 @@ query_loop: int len; case isc_spb_num_att: - add_assoc_int(return_value, "attachments", isc_vax_integer(result,4)); + add_assoc_long(return_value, "attachments", isc_vax_integer(result,4)); result += 4; break; case isc_spb_num_db: - add_assoc_int(return_value, "databases", isc_vax_integer(result,4)); + add_assoc_long(return_value, "databases", isc_vax_integer(result,4)); result += 4; break; @@ -398,12 +398,12 @@ query_loop: break; case isc_spb_sec_userid: - add_assoc_int(&user, "user_id", isc_vax_integer(result, 4)); + add_assoc_long(&user, "user_id", isc_vax_integer(result, 4)); result += 4; break; case isc_spb_sec_groupid: - add_assoc_int(&user, "group_id", isc_vax_integer(result, 4)); + add_assoc_long(&user, "group_id", isc_vax_integer(result, 4)); result += 4; break; } diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index 13513cefc6..4df47392fa 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -495,7 +495,7 @@ PHP_FUNCTION(ibase_errcode) } if (IBG(sql_code) != 0) { - RETURN_INT(IBG(sql_code)); + RETURN_LONG(IBG(sql_code)); } RETURN_FALSE; } @@ -735,23 +735,23 @@ PHP_MINIT_FUNCTION(ibase) le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, LE_PLINK, module_number); le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, LE_TRANS, module_number); - REGISTER_INT_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ - REGISTER_INT_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ + REGISTER_LONG_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); /* transactions */ - REGISTER_INT_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); php_ibase_query_minit(INIT_FUNC_ARGS_PASSTHRU); php_ibase_blobs_minit(INIT_FUNC_ARGS_PASSTHRU); @@ -1195,7 +1195,7 @@ PHP_FUNCTION(ibase_trans) tpb_len = 0; convert_to_int_ex(&args[i]); - trans_argl = Z_IVAL(args[i]); + trans_argl = Z_LVAL(args[i]); if (trans_argl != PHP_IBASE_DEFAULT) { last_tpb[tpb_len++] = isc_tpb_version3; @@ -1475,7 +1475,7 @@ PHP_FUNCTION(ibase_gen_id) RETURN_STRINGL(res, l, 0); } #endif - RETURN_INT((long)result); + RETURN_LONG((long)result); } /* }}} */ diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c index d37e077240..5a53df8b6b 100644 --- a/ext/interbase/php_ibase_udf.c +++ b/ext/interbase/php_ibase_udf.c @@ -231,7 +231,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_short: if (argv[i]->dsc_scale == 0) { - ZVAL_INT(&args[i], *(short*)argv[i]->dsc_address); + ZVAL_LONG(&args[i], *(short*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(short*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -240,7 +240,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_long: if (argv[i]->dsc_scale == 0) { - ZVAL_INT(&args[i], *(ISC_LONG*)argv[i]->dsc_address); + ZVAL_LONG(&args[i], *(ISC_LONG*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(ISC_LONG*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -251,7 +251,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) l = *(ISC_INT64*)argv[i]->dsc_address; if (argv[i]->dsc_scale == 0 && l <= LONG_MAX && l >= LONG_MIN) { - ZVAL_INT(&args[i], (long)l); + ZVAL_LONG(&args[i], (long)l); } else { ZVAL_DOUBLE(&args[i], ((double)l)/scales[-argv[i]->dsc_scale]); } @@ -307,9 +307,9 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) /* return whatever type we got back from the callback: let DB handle conversion */ switch (Z_TYPE(return_value)) { - case IS_INT: + case IS_LONG: r->dsc_dtype = dtype_long; - *(long*)r->dsc_address = Z_IVAL(return_value); + *(long*)r->dsc_address = Z_LVAL(return_value); r->dsc_length = sizeof(long); break; @@ -329,7 +329,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case IS_STRING: r->dsc_dtype = dtype_varying; memcpy(res->vary_string, Z_STRVAL(return_value), - (res->vary_length = min(r->dsc_length-2,Z_STRSIZE(return_value)))); + (res->vary_length = min(r->dsc_length-2,Z_STRLEN(return_value)))); r->dsc_length = res->vary_length+2; break; } diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 7c06af792c..ea3a305dd9 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -121,7 +121,7 @@ static zend_object *BreakIterator_clone_obj(zval *object TSRMLS_DC) "Could not clone BreakIterator", 0 TSRMLS_CC); err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { bio_new->biter = new_biter; ZVAL_COPY(&bio_new->text, &bio_orig->text); @@ -338,36 +338,36 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); - zend_declare_class_constant_int(BreakIterator_ce_ptr, + zend_declare_class_constant_long(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); /* Declare constants that are defined in the C header */ -#define BREAKITER_DECL_INT_CONST(name) \ - zend_declare_class_constant_int(BreakIterator_ce_ptr, #name, \ +#define BREAKITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) - BREAKITER_DECL_INT_CONST(WORD_NONE); - BREAKITER_DECL_INT_CONST(WORD_NONE_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_NUMBER); - BREAKITER_DECL_INT_CONST(WORD_NUMBER_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_LETTER); - BREAKITER_DECL_INT_CONST(WORD_LETTER_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_KANA); - BREAKITER_DECL_INT_CONST(WORD_KANA_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_IDEO); - BREAKITER_DECL_INT_CONST(WORD_IDEO_LIMIT); - - BREAKITER_DECL_INT_CONST(LINE_SOFT); - BREAKITER_DECL_INT_CONST(LINE_SOFT_LIMIT); - BREAKITER_DECL_INT_CONST(LINE_HARD); - BREAKITER_DECL_INT_CONST(LINE_HARD_LIMIT); - - BREAKITER_DECL_INT_CONST(SENTENCE_TERM); - BREAKITER_DECL_INT_CONST(SENTENCE_TERM_LIMIT); - BREAKITER_DECL_INT_CONST(SENTENCE_SEP); - BREAKITER_DECL_INT_CONST(SENTENCE_SEP_LIMIT); - -#undef BREAKITER_DECL_INT_CONST + BREAKITER_DECL_LONG_CONST(WORD_NONE); + BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_LETTER); + BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_KANA); + BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_IDEO); + BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_LONG_CONST(LINE_SOFT); + BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_LONG_CONST(LINE_HARD); + BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_LONG_CONST /* Create and register 'RuleBasedBreakIterator' class. */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index c04e33e11b..d8f18f99f3 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -67,7 +67,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) int32_t pos = biter->next(); if (pos != BreakIterator::DONE) { - ZVAL_INT(&zoi_iter->current, (php_int_t)pos); + ZVAL_LONG(&zoi_iter->current, (zend_long)pos); } //else we've reached the end of the enum, nothing more is required } @@ -77,7 +77,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) zoi_with_current *zoi_iter = (zoi_with_current*)iter; int32_t pos = biter->first(); - ZVAL_INT(&zoi_iter->current, (php_int_t)pos); + ZVAL_LONG(&zoi_iter->current, (zend_long)pos); } static zend_object_iterator_funcs breakiterator_iterator_funcs = { @@ -137,7 +137,7 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { /* the actual work is done in move_forward and rewind */ - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) @@ -168,14 +168,14 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_ * No need to do anything, the engine increments ->index */ const char *s = Z_STRVAL(bio->text); - int32_t slen = Z_STRSIZE(bio->text); + int32_t slen = Z_STRLEN(bio->text); zend_string *res; if (next == BreakIterator::DONE) { next = slen; } assert(next <= slen && next >= cur); - res = STR_ALLOC(next - cur, 0); + res = zend_string_alloc(next - cur, 0); memcpy(res->val, &s[cur], res->len); res->val[res->len] = '\0'; @@ -315,7 +315,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; #define PARTSITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_int(IntlPartsIterator_ce_ptr, #name, \ + zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index a8c32cc8d4..af380e44fd 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32( int32_t res = (bio->biter->*func)(); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } static void _breakiter_int32_ret_int32( @@ -217,11 +217,11 @@ static void _breakiter_int32_ret_int32( INTERNAL_FUNCTION_PARAMETERS) { char *msg; - php_int_t arg; + zend_long arg; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { spprintf(&msg, 0, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); @@ -240,7 +240,7 @@ static void _breakiter_int32_ret_int32( int32_t res = (bio->biter->*func)((int32_t)arg); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_first) @@ -308,7 +308,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current) int32_t res = bio->biter->current(); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_following) @@ -327,11 +327,11 @@ U_CFUNC PHP_FUNCTION(breakiter_preceding) U_CFUNC PHP_FUNCTION(breakiter_is_boundary) { - php_int_t offset; + zend_long offset; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &offset) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); @@ -349,16 +349,16 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) UBool res = bio->biter->isBoundary((int32_t)offset); - RETURN_BOOL((php_int_t)res); + RETURN_BOOL((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_get_locale) { - php_int_t locale_type; + zend_long locale_type; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &locale_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -382,11 +382,11 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { - php_int_t key_type = 0; + zend_long key_type = 0; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &key_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -422,7 +422,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code) if (bio == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)BREAKITER_ERROR_CODE(bio)); + RETURN_LONG((zend_long)BREAKITER_ERROR_CODE(bio)); } U_CFUNC PHP_FUNCTION(breakiter_get_error_message) diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp index 142cc28342..bffd1ee5cf 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -22,7 +22,7 @@ //copied from cmemory.h, which is not public typedef union { - php_int_t t1; + zend_long t1; double t2; void *t3; } UAlignedMemory; diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp index a12924afef..a833cf1853 100644 --- a/ext/intl/breakiterator/codepointiterator_methods.cpp +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -40,5 +40,5 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_INT(fetch_cpbi(bio)->getLastCodePoint()); + RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); } diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 5755b0adb8..098f8ab3cc 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -151,7 +151,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_INT(fetch_rbbi(bio)->getRuleStatus()); + RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); } U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) @@ -189,7 +189,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) array_init_size(return_value, num_rules); for (int32_t i = 0; i < num_rules; i++) { - add_next_index_int(return_value, rules[i]); + add_next_index_long(return_value, rules[i]); } delete[] rules; } @@ -218,7 +218,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) RETURN_FALSE; } - zend_string *ret_rules = STR_ALLOC(rules_len, 0); + zend_string *ret_rules = zend_string_alloc(rules_len, 0); memcpy(ret_rules->val, rules, rules_len); ret_rules->val[rules_len] = '\0'; diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index af4f53907f..58375f8196 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -102,7 +102,7 @@ static zend_object *Calendar_clone_obj(zval *object TSRMLS_DC) "Could not clone IntlCalendar", 0 TSRMLS_CC); err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { co_new->ucal = newCalendar; } @@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) const char *name = debug_info_fields[i].name; int32_t res = cal->get(debug_info_fields[i].field, uec); if (U_SUCCESS(uec)) { - add_assoc_int(&zfields, name, (php_int_t)res); + add_assoc_long(&zfields, name, (zend_long)res); } else { add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec))); } @@ -489,57 +489,57 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) } /* Declare 'IntlCalendar' class constants */ -#define CALENDAR_DECL_INT_CONST(name, val) \ - zend_declare_class_constant_int(Calendar_ce_ptr, name, sizeof(name) - 1, \ +#define CALENDAR_DECL_LONG_CONST(name, val) \ + zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - CALENDAR_DECL_INT_CONST("FIELD_ERA", UCAL_ERA); - CALENDAR_DECL_INT_CONST("FIELD_YEAR", UCAL_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_MONTH", UCAL_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_DATE", UCAL_DATE); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_AM_PM", UCAL_AM_PM); - CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_INT_CONST("FIELD_MINUTE", UCAL_MINUTE); - CALENDAR_DECL_INT_CONST("FIELD_SECOND", UCAL_SECOND); - CALENDAR_DECL_INT_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); - CALENDAR_DECL_INT_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); - CALENDAR_DECL_INT_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); - CALENDAR_DECL_INT_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); - CALENDAR_DECL_INT_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); - CALENDAR_DECL_INT_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); - CALENDAR_DECL_INT_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); - CALENDAR_DECL_INT_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); - - CALENDAR_DECL_INT_CONST("DOW_SUNDAY", UCAL_SUNDAY); - CALENDAR_DECL_INT_CONST("DOW_MONDAY", UCAL_MONDAY); - CALENDAR_DECL_INT_CONST("DOW_TUESDAY", UCAL_TUESDAY); - CALENDAR_DECL_INT_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); - CALENDAR_DECL_INT_CONST("DOW_THURSDAY", UCAL_THURSDAY); - CALENDAR_DECL_INT_CONST("DOW_FRIDAY", UCAL_FRIDAY); - CALENDAR_DECL_INT_CONST("DOW_SATURDAY", UCAL_SATURDAY); + CALENDAR_DECL_LONG_CONST("FIELD_ERA", UCAL_ERA); + CALENDAR_DECL_LONG_CONST("FIELD_YEAR", UCAL_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_MONTH", UCAL_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_DATE", UCAL_DATE); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_AM_PM", UCAL_AM_PM); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_MINUTE", UCAL_MINUTE); + CALENDAR_DECL_LONG_CONST("FIELD_SECOND", UCAL_SECOND); + CALENDAR_DECL_LONG_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); + CALENDAR_DECL_LONG_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); + CALENDAR_DECL_LONG_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); + CALENDAR_DECL_LONG_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); + CALENDAR_DECL_LONG_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); + CALENDAR_DECL_LONG_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); + + CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); + CALENDAR_DECL_LONG_CONST("DOW_MONDAY", UCAL_MONDAY); + CALENDAR_DECL_LONG_CONST("DOW_TUESDAY", UCAL_TUESDAY); + CALENDAR_DECL_LONG_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); + CALENDAR_DECL_LONG_CONST("DOW_THURSDAY", UCAL_THURSDAY); + CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY); + CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); #endif #if U_ICU_VERSION_MAJOR_NUM >= 49 - CALENDAR_DECL_INT_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); - CALENDAR_DECL_INT_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); - CALENDAR_DECL_INT_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); + CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); + CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); + CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); #endif } /* }}} */ diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 23fb376604..0d808f36fd 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -219,12 +219,12 @@ static void _php_intlcal_field_uec_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - php_int_t field; + zend_long field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -244,7 +244,7 @@ static void _php_intlcal_field_uec_ret_in32t_method( (UCalendarDateFields)field, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get) @@ -295,12 +295,12 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time) U_CFUNC PHP_FUNCTION(intlcal_add) { - php_int_t field, + zend_long field, amount; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { + "Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_add: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -399,7 +399,7 @@ U_CFUNC PHP_FUNCTION(intlcal_before) U_CFUNC PHP_FUNCTION(intlcal_set) { - php_int_t arg1, arg2, arg3, arg4, arg5, arg6; + zend_long arg1, arg2, arg3, arg4, arg5, arg6; zval args_a[7] = {0}, *args = args_a; int i; @@ -423,7 +423,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) if (variant == 4 || zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii|iiii", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, + "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: bad arguments", 0 TSRMLS_CC); @@ -431,7 +431,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) } for (i = 0; i < variant; i++) { - if (Z_IVAL(args[i]) < INT32_MIN || Z_IVAL(args[i]) > INT32_MAX) { + if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: at least one of the arguments has an absolute " "value that is too large", 0 TSRMLS_CC); @@ -462,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) U_CFUNC PHP_FUNCTION(intlcal_roll) { - php_int_t field, + zend_long field, value; zval args_a[3] = {0}, *args = args_a; @@ -488,7 +488,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) } bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { + "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -524,7 +524,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) { zval args_a[2] = {0}, *args = &args_a[0]; - php_int_t field; + zend_long field; int variant; CALENDAR_METHOD_INIT_VARS; @@ -547,7 +547,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) } variant = 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - getThis(), "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_clear: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -572,12 +572,12 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) U_CFUNC PHP_FUNCTION(intlcal_field_difference) { - php_int_t field; + zend_long field; double when; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Odi", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { + "Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_field_difference: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -596,7 +596,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference) INTL_METHOD_CHECK_STATUS(co, "intlcal_field_difference: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_actual_maximum) @@ -614,11 +614,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_actual_minimum) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) { - php_uint_t dow; + zend_ulong dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_day_of_week_type: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -637,7 +637,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_day_of_week_type: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } #endif @@ -658,7 +658,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } static void _php_intlcal_field_ret_in32t_method( @@ -666,12 +666,12 @@ static void _php_intlcal_field_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - php_int_t field; + zend_long field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -690,7 +690,7 @@ static void _php_intlcal_field_ret_in32t_method( int32_t result = (co->ucal->*func)((UCalendarDateFields)field); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_greatest_minimum) @@ -707,11 +707,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_least_maximum) U_CFUNC PHP_FUNCTION(intlcal_get_locale) { - php_int_t locale_type; + zend_long locale_type; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -756,7 +756,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_minimum) @@ -807,11 +807,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) { - php_int_t dow; + zend_long dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_weekend_transition: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -830,7 +830,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_weekend_transition: " "Error calling ICU method"); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } #endif @@ -898,11 +898,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient) U_CFUNC PHP_FUNCTION(intlcal_is_set) { - php_int_t field; + zend_long field; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_is_set: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -953,11 +953,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend) U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week) { - php_int_t dow; + zend_long dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_first_day_of_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -997,11 +997,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) { - php_int_t num_days; + zend_long num_days; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &num_days) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1064,7 +1064,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_INT(co->ucal->getRepeatedWallTimeOption()); + RETURN_LONG(co->ucal->getRepeatedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) @@ -1080,16 +1080,16 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_INT(co->ucal->getSkippedWallTimeOption()); + RETURN_LONG(co->ucal->getSkippedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) { - php_int_t option; + zend_long option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1110,11 +1110,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) { - php_int_t option; + zend_long option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1179,7 +1179,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); - if (Z_TYPE(zv_timestamp) != IS_INT) { + if (Z_TYPE(zv_timestamp) != IS_LONG) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: bad DateTime; call to " "DateTime::getTimestamp() failed", 0 TSRMLS_CC); @@ -1209,7 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) "error creating ICU Calendar object", 0 TSRMLS_CC); goto error; } - cal->setTime(((UDate)Z_IVAL(zv_timestamp)) * 1000., status); + cal->setTime(((UDate)Z_LVAL(zv_timestamp)) * 1000., status); if (U_FAILURE(status)) { /* time zone was adopted by cal; should not be deleted here */ delete cal; @@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (co == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co)); + RETURN_LONG((zend_long)CALENDAR_ERROR_CODE(co)); } U_CFUNC PHP_FUNCTION(intlcal_get_error_message) diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 09ad390b96..9c243502fe 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -43,7 +43,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) *args = &args_a[0]; char *locale = NULL; int locale_len; - php_int_t largs[6]; + zend_long largs[6]; UErrorCode status = U_ZERO_ERROR; int variant; intl_error_reset(NULL TSRMLS_CC); @@ -242,11 +242,11 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year) { - php_int_t year; + zend_long year; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { + "Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_is_leap_year: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c index 08da6d3831..eff9568de1 100644 --- a/ext/intl/collator/collator.c +++ b/ext/intl/collator/collator.c @@ -38,9 +38,9 @@ void collator_register_constants( INIT_FUNC_ARGS ) return; } - #define COLLATOR_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); - #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); + #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UColAttributeValue constants */ COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT ); diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c index a0a4bf8df3..72446f51a7 100644 --- a/ext/intl/collator/collator_attr.c +++ b/ext/intl/collator/collator_attr.c @@ -33,12 +33,12 @@ */ PHP_FUNCTION( collator_get_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -53,7 +53,7 @@ PHP_FUNCTION( collator_get_attribute ) value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) ); COLLATOR_CHECK_STATUS( co, "Error getting attribute value" ); - RETURN_INT( value ); + RETURN_LONG( value ); } /* }}} */ @@ -64,12 +64,12 @@ PHP_FUNCTION( collator_get_attribute ) */ PHP_FUNCTION( collator_set_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &object, Collator_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -112,7 +112,7 @@ PHP_FUNCTION( collator_get_strength ) COLLATOR_METHOD_FETCH_OBJECT; /* Get current strength and return it. */ - RETURN_INT( ucol_getStrength( co->ucoll ) ); + RETURN_LONG( ucol_getStrength( co->ucoll ) ); } /* }}} */ @@ -123,12 +123,12 @@ PHP_FUNCTION( collator_get_strength ) */ PHP_FUNCTION( collator_set_strength ) { - php_int_t strength; + zend_long strength; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &strength ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index 497061e157..4384558ac6 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -119,7 +119,7 @@ PHP_FUNCTION( collator_compare ) efree( ustr2 ); /* Return result of the comparison. */ - RETURN_INT( result ); + RETURN_LONG( result ); } /* }}} */ diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 89224d0341..5a572067f6 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -41,7 +41,7 @@ /* {{{ collator_convert_hash_item_from_utf8_to_utf16 */ static void collator_convert_hash_item_from_utf8_to_utf16( - HashTable* hash, zval *hashData, zend_string *hashKey, php_uint_t hashIndex, + HashTable* hash, zval *hashData, zend_string *hashKey, zend_ulong hashIndex, UErrorCode* status ) { const char* old_val; @@ -55,7 +55,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRSIZE_P( hashData ); + old_val_len = Z_STRLEN_P( hashData ); /* Convert it from UTF-8 to UTF-16LE and save the result to new_val[_len]. */ intl_convert_utf8_to_utf16( &new_val, &new_val_len, old_val, old_val_len, status ); @@ -67,13 +67,13 @@ static void collator_convert_hash_item_from_utf8_to_utf16( //??? efree(new_val); /* hack to fix use of initialized value */ - Z_STRSIZE(znew_val) = Z_STRSIZE(znew_val) - UBYTES(1); + Z_STRLEN(znew_val) = Z_STRLEN(znew_val) - UBYTES(1); if( hashKey) { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_INT */ + else /* hashKeyType == HASH_KEY_IS_LONG */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -82,7 +82,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( /* {{{ collator_convert_hash_item_from_utf16_to_utf8 */ static void collator_convert_hash_item_from_utf16_to_utf8( - HashTable* hash, zval * hashData, zend_string* hashKey, php_uint_t hashIndex, + HashTable* hash, zval * hashData, zend_string* hashKey, zend_ulong hashIndex, UErrorCode* status ) { const char* old_val; @@ -96,7 +96,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRSIZE_P( hashData ); + old_val_len = Z_STRLEN_P( hashData ); /* Convert it from UTF-16LE to UTF-8 and save the result to new_val[_len]. */ intl_convert_utf16_to_utf8( &new_val, &new_val_len, @@ -113,7 +113,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_INT */ + else /* hashKeyType == HASH_KEY_IS_LONG */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -125,7 +125,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( */ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* status ) { - php_uint_t hashIndex; + zend_ulong hashIndex; zval *hashData; zend_string *hashKey; @@ -144,7 +144,7 @@ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* stat */ void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* status ) { - php_uint_t hashIndex; + zend_ulong hashIndex; zend_string *hashKey; zval *hashData; @@ -176,7 +176,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv ) /* Convert to utf8 then. */ intl_convert_utf16_to_utf8( &str, &str_len, - (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRSIZE_P(utf16_zval) ), &status ); + (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRLEN_P(utf16_zval) ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error converting utf16 to utf8 in collator_convert_zval_utf16_to_utf8()" ); @@ -207,7 +207,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( utf8_zval ), Z_STRSIZE_P( utf8_zval ), + Z_STRVAL_P( utf8_zval ), Z_STRLEN_P( utf8_zval ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_zstr_utf8_to_utf16()" ); @@ -282,7 +282,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv TSRMLS_DC ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( zstr ), Z_STRSIZE_P( zstr ), + Z_STRVAL_P( zstr ), Z_STRLEN_P( zstr ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" ); @@ -320,7 +320,7 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval_ptr_dtor( num ); num = rv; - ZVAL_INT( num, 0 ); + ZVAL_LONG( num, 0 ); } return num; @@ -338,9 +338,9 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval* collator_convert_string_to_double( zval* str, zval *rv ) { zval* num = collator_convert_string_to_number( str, rv ); - if( Z_TYPE_P(num) == IS_INT ) + if( Z_TYPE_P(num) == IS_LONG ) { - ZVAL_DOUBLE( num, Z_IVAL_P( num ) ); + ZVAL_DOUBLE( num, Z_LVAL_P( num ) ); } return num; @@ -359,7 +359,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv ) zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) { int is_numeric = 0; - php_int_t lval = 0; + zend_long lval = 0; double dval = 0; if( Z_TYPE_P( str ) != IS_STRING ) @@ -367,10 +367,10 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) COLLATOR_CONVERT_RETURN_FAILED( str ); } - if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRSIZE_P(str) ), &lval, &dval, 1 ) ) ) + if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) ) { - if( is_numeric == IS_INT ) { - ZVAL_INT(rv, lval); + if( is_numeric == IS_LONG ) { + ZVAL_LONG(rv, lval); } if( is_numeric == IS_DOUBLE ) ZVAL_DOUBLE(rv, dval); diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c index acfa43c498..91bc25d077 100644 --- a/ext/intl/collator/collator_error.c +++ b/ext/intl/collator/collator_error.c @@ -48,7 +48,7 @@ PHP_FUNCTION( collator_get_error_code ) RETURN_FALSE; /* Return collator's last error code. */ - RETURN_INT( COLLATOR_ERROR_CODE( co ) ); + RETURN_LONG( COLLATOR_ERROR_CODE( co ) ); } /* }}} */ diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index f92133e3d5..34668bb5a8 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -125,15 +125,15 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */ * * Ignores `locale' stuff. */ -static php_int_t collator_u_strtol(nptr, endptr, base) +static zend_long collator_u_strtol(nptr, endptr, base) const UChar *nptr; UChar **endptr; register int base; { register const UChar *s = nptr; - register php_uint_t acc; + register zend_ulong acc; register UChar c; - register php_uint_t cutoff; + register zend_ulong cutoff; register int neg = 0, any, cutlim; if (s == NULL) { @@ -184,9 +184,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(php_uint_t)PHP_INT_MIN : PHP_INT_MAX; - cutlim = cutoff % (php_uint_t)base; - cutoff /= (php_uint_t)base; + cutoff = neg ? -(zend_ulong)PHP_INT_MIN : PHP_INT_MAX; + cutlim = cutoff % (zend_ulong)base; + cutoff /= (zend_ulong)base; for (acc = 0, any = 0;; c = *s++) { if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) c -= 0x30 /*'0'*/; @@ -222,9 +222,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base) /* {{{ collator_is_numeric] * Taken from PHP6:is_numeric_unicode() */ -zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ) +zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors ) { - php_int_t local_lval; + zend_long local_lval; double local_dval; UChar *end_ptr_long, *end_ptr_double; int conv_base=10; @@ -245,7 +245,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double if (lval) { *lval = local_lval; } - return IS_INT; + return IS_LONG; } else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.' && *str != '-') { /* ignore partial string matches */ return 0; } @@ -288,7 +288,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double return IS_DOUBLE; } else if (end_ptr_long && lval) { *lval = local_lval; - return IS_INT; + return IS_LONG; } } return 0; diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h index bd5ccfdd26..d7aa12ce46 100644 --- a/ext/intl/collator/collator_is_numeric.h +++ b/ext/intl/collator/collator_is_numeric.h @@ -21,6 +21,6 @@ #include <php.h> #include <unicode/uchar.h> -zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ); +zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors ); #endif // COLLATOR_IS_NUMERIC_H diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c index 786719c131..dd37cc75db 100644 --- a/ext/intl/collator/collator_locale.c +++ b/ext/intl/collator/collator_locale.c @@ -33,13 +33,13 @@ */ PHP_FUNCTION( collator_get_locale ) { - php_int_t type = 0; + zend_long type = 0; char* locale_name = NULL; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 1d9c955fda..0856b580be 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -27,7 +27,7 @@ #include "intl_convert.h" #if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED) -typedef php_int_t ptrdiff_t; +typedef zend_long ptrdiff_t; #endif /** @@ -80,10 +80,10 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2 } /* Compare the strings using ICU. */ - ZVAL_INT(result, ucol_strcoll( + ZVAL_LONG(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); } else { @@ -190,10 +190,10 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM co = Z_INTL_COLLATOR_P(&INTL_G(current_collator)); /* Compare the strings using ICU. */ - ZVAL_INT(result, ucol_strcoll( + ZVAL_LONG(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); zval_ptr_dtor( str1_p ); zval_ptr_dtor( str2_p ); @@ -234,9 +234,9 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC ) convert_to_int(&result); - if( Z_IVAL(result) < 0 ) + if( Z_LVAL(result) < 0 ) return -1; - else if( Z_IVAL(result) > 0 ) + else if( Z_LVAL(result) > 0 ) return 1; return 0; @@ -258,7 +258,7 @@ static int collator_cmp_sort_keys( const void *p1, const void *p2 TSRMLS_DC ) /* {{{ collator_get_compare_function * Choose compare function according to sort flags. */ -static collator_compare_func_t collator_get_compare_function( const php_int_t sort_flags ) +static collator_compare_func_t collator_get_compare_function( const zend_long sort_flags ) { collator_compare_func_t func; @@ -290,12 +290,12 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS ) zval saved_collator; zval* array = NULL; HashTable* hash = NULL; - php_int_t sort_flags = COLLATOR_SORT_REGULAR; + zend_long sort_flags = COLLATOR_SORT_REGULAR; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|l", &object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -424,7 +424,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) /* Process string values only. */ if( Z_TYPE_P( hashData ) == IS_STRING ) { - intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRSIZE_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); + intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRLEN_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) { diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 885d08cd2c..783611e02f 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -127,7 +127,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, if (millis) { ZVAL_STRING(&zfuncname, "getTimestamp"); if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_INT) { + != SUCCESS || Z_TYPE(retval) != IS_LONG) { spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, @@ -137,7 +137,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, return FAILURE; } - *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval); + *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); zval_ptr_dtor(&zfuncname); } @@ -174,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) { double rv = NAN; - php_int_t lv; + zend_long lv; int type; char *message; @@ -184,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS switch (Z_TYPE_P(z)) { case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0); + type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); if (type == IS_DOUBLE) { rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_INT) { + } else if (type == IS_LONG) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { spprintf(&message, 0, "%s: string '%s' is not numeric, " @@ -198,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS efree(message); } break; - case IS_INT: - rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z); + case IS_LONG: + rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); break; case IS_DOUBLE: rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index cfe46ce75a..ff28bdb456 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -238,7 +238,7 @@ static PHP_METHOD(IntlIterator, key) if (ii->iterator->funcs->get_current_key) { ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC); } else { - RETURN_INT(ii->iterator->index); + RETURN_LONG(ii->iterator->index); } } diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index 126c9cc35b..f7b739555e 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -28,7 +28,7 @@ */ PHP_FUNCTION( intl_get_error_code ) { - RETURN_INT( intl_error_get_code( NULL TSRMLS_CC ) ); + RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) ); } /* }}} */ @@ -48,10 +48,10 @@ PHP_FUNCTION( intl_get_error_message ) */ PHP_FUNCTION( intl_is_failure ) { - php_int_t err_code; + zend_long err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -70,10 +70,10 @@ PHP_FUNCTION( intl_is_failure ) */ PHP_FUNCTION( intl_error_name ) { - php_int_t err_code; + zend_long err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -91,7 +91,7 @@ PHP_FUNCTION( intl_error_name ) */ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) { - #define INTL_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) /* Warnings */ INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING ); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 868e3bc90d..aabb9c3400 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -62,10 +62,10 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr /* }}} */ /* {{{ php_converter_default_callback */ -static void php_converter_default_callback(zval *return_value, zval *zobj, php_int_t reason, zval *error TSRMLS_DC) { +static void php_converter_default_callback(zval *return_value, zval *zobj, zend_long reason, zval *error TSRMLS_DC) { ZVAL_DEREF(error); zval_dtor(error); - ZVAL_INT(error, U_ZERO_ERROR); + ZVAL_LONG(error, U_ZERO_ERROR); /* Basic functionality so children can call parent::toUCallback() */ switch (reason) { case UCNV_UNASSIGNED: @@ -81,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_INT(error, U_INVALID_STATE_ERROR); + ZVAL_LONG(error, U_INVALID_STATE_ERROR); RETVAL_STRINGL(chars, chars_len); return; } @@ -99,7 +99,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_INT(error, uerror); + ZVAL_LONG(error, uerror); } RETVAL_STRINGL(chars, chars_len); } @@ -117,10 +117,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_toUCallback_arginfo, 0, ZEND_RETURN_VALUE, ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, toUCallback) { - php_int_t reason; + zend_long reason; zval *source, *codeUnits, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &reason, &source, &codeUnits, &error) == FAILURE) { return; } @@ -139,10 +139,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_fromUCallback_arginfo, 0, ZEND_RETURN_VALUE ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, fromUCallback) { - php_int_t reason; + zend_long reason; zval *source, *codePoint, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &reason, &source, &codePoint, &error) == FAILURE) { return; } @@ -152,7 +152,7 @@ static PHP_METHOD(UConverter, fromUCallback) { /* }}} */ /* {{{ php_converter_check_limits */ -static inline zend_bool php_converter_check_limits(php_converter_object *objval, php_int_t available, php_int_t needed TSRMLS_DC) { +static inline zend_bool php_converter_check_limits(php_converter_object *objval, zend_long available, zend_long needed TSRMLS_DC) { if (available < needed) { php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %pd bytes needed, %pd available", needed, available); return 0; @@ -169,9 +169,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_NULL: /* Code unit is being skipped */ return; - case IS_INT: + case IS_LONG: { - php_int_t lval = Z_IVAL_P(val); + zend_long lval = Z_LVAL_P(val); if ((lval < 0) || (lval > 0x10FFFF)) { php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval); return; @@ -194,7 +194,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_STRING: { const char *strval = Z_STRVAL_P(val); - int i = 0, strlen = Z_STRSIZE_P(val); + int i = 0, strlen = Z_STRLEN_P(val); while((i != strlen) && TARGET_CHECK(args, 1)) { UChar c; @@ -233,10 +233,10 @@ static void php_converter_to_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_INT(&zargs[0], reason); + ZVAL_LONG(&zargs[0], reason); ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source); ZVAL_STRINGL(&zargs[2], codeUnits, length); - ZVAL_INT(&zargs[3], *pErrorCode); + ZVAL_LONG(&zargs[3], *pErrorCode); objval->to_cb.param_count = 4; objval->to_cb.params = zargs; @@ -250,10 +250,10 @@ static void php_converter_to_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_INT) { - *pErrorCode = Z_IVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { - *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_LONG) { + *pErrorCode = Z_LVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { + *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -269,14 +269,14 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni case IS_NULL: /* Ignore */ return; - case IS_INT: + case IS_LONG: if (TARGET_CHECK(args, 1)) { - *(args->target++) = Z_IVAL_P(val); + *(args->target++) = Z_LVAL_P(val); } return; case IS_STRING: { - int vallen = Z_STRSIZE_P(val); + int vallen = Z_STRLEN_P(val); if (TARGET_CHECK(args, vallen)) { memcpy(args->target, Z_STRVAL_P(val), vallen); args->target += vallen; @@ -312,16 +312,16 @@ static void php_converter_from_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_INT(&zargs[0], reason); + ZVAL_LONG(&zargs[0], reason); array_init(&zargs[1]); i = 0; while (i < length) { UChar32 c; U16_NEXT(codeUnits, i, length, c); - add_next_index_int(&zargs[1], c); + add_next_index_long(&zargs[1], c); } - ZVAL_INT(&zargs[2], codePoint); - ZVAL_INT(&zargs[3], *pErrorCode); + ZVAL_LONG(&zargs[2], codePoint); + ZVAL_LONG(&zargs[3], *pErrorCode); objval->from_cb.param_count = 4; objval->from_cb.params = zargs; @@ -335,10 +335,10 @@ static void php_converter_from_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_INT) { - *pErrorCode = Z_IVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { - *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_LONG) { + *pErrorCode = Z_LVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { + *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -512,7 +512,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter * RETURN_FALSE; } - RETURN_INT(t); + RETURN_LONG(t); } /* }}} */ @@ -731,9 +731,9 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_reasontext_arginfo, 0, ZEND_RETURN_VALUE, 0 ZEND_ARG_INFO(0, reason) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, reasonText) { - php_int_t reason; + zend_long reason; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &reason) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &reason) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "UConverter::reasonText(): bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -824,13 +824,13 @@ static PHP_METHOD(UConverter, transcode) { (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); } if (U_SUCCESS(error) && (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); } } @@ -871,7 +871,7 @@ static PHP_METHOD(UConverter, getErrorCode) { RETURN_FALSE; } - RETURN_INT(intl_error_get_code(&(objval->error) TSRMLS_CC)); + RETURN_LONG(intl_error_get_code(&(objval->error) TSRMLS_CC)); } /* }}} */ @@ -1081,7 +1081,7 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { err_msg = intl_error_get_message(&oldobj->error TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_RELEASE(err_msg); + zend_string_release(err_msg); return retval; } @@ -1098,8 +1098,8 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { } /* }}} */ -#define CONV_REASON_CONST(v) zend_declare_class_constant_int(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) -#define CONV_TYPE_CONST(v) zend_declare_class_constant_int(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_REASON_CONST(v) zend_declare_class_constant_long(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_TYPE_CONST(v) zend_declare_class_constant_long(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) /* {{{ php_converter_minit */ int php_converter_minit(INIT_FUNC_ARGS) { diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index c51b33144b..eedc60040e 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -34,11 +34,11 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) return; } - #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); /* UDateFormatStyle constants */ DATEFORMATTER_EXPOSE_CLASS_CONST( FULL ); @@ -85,7 +85,7 @@ PHP_FUNCTION( datefmt_get_error_code ) dfo = Z_INTL_DATEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(dfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) ); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 0ee5412a90..b2f34b9c24 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -48,7 +48,7 @@ PHP_FUNCTION( datefmt_get_datetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." ); - RETURN_INT(dfo->date_type ); + RETURN_LONG(dfo->date_type ); } /* }}} */ @@ -74,7 +74,7 @@ PHP_FUNCTION( datefmt_get_timetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." ); - RETURN_INT(dfo->time_type ); + RETURN_LONG(dfo->time_type ); } /* }}} */ @@ -170,12 +170,12 @@ PHP_FUNCTION( datefmt_set_pattern ) PHP_FUNCTION( datefmt_get_locale ) { char *loc; - php_int_t loc_type =ULOC_ACTUAL_LOCALE; + zend_long loc_type =ULOC_ACTUAL_LOCALE; DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index 4446922252..5f63d33143 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -160,7 +160,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) RETURN_FALSE; } - RETURN_INT(dfo->calendar); + RETURN_LONG(dfo->calendar); } /* }}} */ @@ -220,7 +220,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar) DATE_FORMAT_METHOD_FETCH_OBJECT; Calendar *cal; - php_int_t cal_type; + zend_long cal_type; bool cal_owned; Locale locale = Locale::createFromName(dfo->requested_locale); // getting the actual locale from the DateFormat is not enough diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 5242c5f5ac..67b61bd067 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -43,11 +43,11 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char *locale_str; int locale_len = 0; Locale locale; - php_int_t date_type = 0; - php_int_t time_type = 0; + zend_long date_type = 0; + zend_long time_type = 0; zval *calendar_zv = NULL; Calendar *calendar = NULL; - php_int_t calendar_type; + zend_long calendar_type; bool calendar_owned; zval *timezone_zv = NULL; TimeZone *timezone = NULL; @@ -61,7 +61,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) intl_error_reset(NULL TSRMLS_CC); object = return_value; /* Parse parameters. */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|zzs", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|zzs", &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 38ec4101aa..dd9b64d4ee 100644 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -71,21 +71,21 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, } if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) { - if(Z_TYPE_P(ele_value) != IS_INT) { + if(Z_TYPE_P(ele_value) != IS_LONG) { spprintf(&message, 0, "datefmt_format: parameter array contains " "a non-integer element for key '%s'", key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - if (Z_IVAL_P(ele_value) > INT32_MAX || - Z_IVAL_P(ele_value) < INT32_MIN) { + if (Z_LVAL_P(ele_value) > INT32_MAX || + Z_LVAL_P(ele_value) < INT32_MIN) { spprintf(&message, 0, "datefmt_format: value %pd is out of " "bounds for a 32-bit integer in key '%s'", - Z_IVAL_P(ele_value), key_name); + Z_LVAL_P(ele_value), key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - result = Z_IVAL_P(ele_value); + result = Z_LVAL_P(ele_value); } } } diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index 58d9af2772..564867f017 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -46,10 +46,10 @@ static const DateFormat::EStyle valid_styles[] = { }; static bool valid_format(zval *z) { - if (Z_TYPE_P(z) == IS_INT) { - php_int_t lval = Z_IVAL_P(z); + if (Z_TYPE_P(z) == IS_LONG) { + zend_long lval = Z_LVAL_P(z); for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { - if ((php_int_t)valid_styles[i] == lval) { + if ((zend_long)valid_styles[i] == lval) { return true; } } @@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = (DateFormat::EStyle)Z_IVAL_P(z); + dateStyle = (DateFormat::EStyle)Z_LVAL_P(z); zend_hash_move_forward_ex(ht, &pos); z = zend_hash_get_current_data_ex(ht, &pos); @@ -113,18 +113,18 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "second element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - timeStyle = (DateFormat::EStyle)Z_IVAL_P(z); - } else if (Z_TYPE_P(format) == IS_INT) { + timeStyle = (DateFormat::EStyle)Z_LVAL_P(z); + } else if (Z_TYPE_P(format) == IS_LONG) { if (!valid_format(format)) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the date/time format type is invalid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = timeStyle = (DateFormat::EStyle)Z_IVAL_P(format); + dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format); } else { convert_to_string_ex(format); - if (Z_STRSIZE_P(format) == 0) { + if (Z_STRLEN_P(format) == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the format is empty", 0 TSRMLS_CC); RETURN_FALSE; @@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) if (pattern) { df = new SimpleDateFormat( - UnicodeString(Z_STRVAL_P(format), Z_STRSIZE_P(format), + UnicodeString(Z_STRVAL_P(format), Z_STRLEN_P(format), UnicodeString::kInvariant), Locale::createFromName(locale_str), status); diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp index 680df46f42..92296be97a 100644 --- a/ext/intl/dateformat/dateformat_helpers.cpp +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -33,7 +33,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - php_int_t& cal_int_type, + zend_long& cal_int_type, bool& calendar_owned TSRMLS_DC) { char *msg; @@ -47,10 +47,10 @@ int datefmt_process_calendar_arg(zval* calendar_zv, cal_int_type = UCAL_GREGORIAN; - } else if (Z_TYPE_P(calendar_zv) == IS_INT) { + } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { - php_int_t v = Z_IVAL_P(calendar_zv); - if (v != (php_int_t)UCAL_TRADITIONAL && v != (php_int_t)UCAL_GREGORIAN) { + zend_long v = Z_LVAL_P(calendar_zv); + if (v != (zend_long)UCAL_TRADITIONAL && v != (zend_long)UCAL_GREGORIAN) { spprintf(&msg, 0, "%s: invalid value for calendar type; it must be " "one of IntlDateFormatter::TRADITIONAL (locale's default " "calendar) or IntlDateFormatter::GREGORIAN. " @@ -59,14 +59,14 @@ int datefmt_process_calendar_arg(zval* calendar_zv, intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); return FAILURE; - } else if (v == (php_int_t)UCAL_TRADITIONAL) { + } else if (v == (zend_long)UCAL_TRADITIONAL) { cal = Calendar::createInstance(locale, status); } else { //UCAL_GREGORIAN cal = new GregorianCalendar(locale, status); } calendar_owned = true; - cal_int_type = Z_IVAL_P(calendar_zv); + cal_int_type = Z_LVAL_P(calendar_zv); } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && instanceof_function_ex(Z_OBJCE_P(calendar_zv), diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h index 0c5647b0ab..ca88da008a 100644 --- a/ext/intl/dateformat/dateformat_helpers.h +++ b/ext/intl/dateformat/dateformat_helpers.h @@ -32,7 +32,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - php_int_t& cal_int_type, + zend_long& cal_int_type, bool& calendar_owned TSRMLS_DC); #endif /* DATEFORMAT_HELPERS_H */ diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index eb28a39ba2..79c2a2f7c0 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -57,24 +57,24 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex if(result > LONG_MAX || result < -LONG_MAX) { ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result)); } else { - ZVAL_INT(return_value, (php_int_t)result); + ZVAL_LONG(return_value, (zend_long)result); } } /* }}} */ -static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, php_int_t calendar_field, char* key_name TSRMLS_DC) +static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name TSRMLS_DC) { - php_int_t calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); + zend_long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" ); if( strcmp(key_name, CALENDAR_YEAR )==0 ){ /* since tm_year is years from 1900 */ - add_assoc_int( return_value, key_name,( calendar_field_val-1900) ); + add_assoc_long( return_value, key_name,( calendar_field_val-1900) ); }else if( strcmp(key_name, CALENDAR_WDAY )==0 ){ /* since tm_wday starts from 0 whereas ICU WDAY start from 1 */ - add_assoc_int( return_value, key_name,( calendar_field_val-1) ); + add_assoc_long( return_value, key_name,( calendar_field_val-1) ); }else{ - add_assoc_int( return_value, key_name, calendar_field_val ); + add_assoc_long( return_value, key_name, calendar_field_val ); } } @@ -86,7 +86,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex UCalendar *parsed_calendar = NULL; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; - php_int_t isInDST = 0; + zend_long isInDST = 0; /* Convert timezone to UTF-16. */ intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo)); @@ -116,7 +116,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex /* Is in DST? */ isInDST = ucal_inDaylightTime(parsed_calendar , &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." ); - add_assoc_int( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); + add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); } /* }}} */ @@ -147,7 +147,7 @@ PHP_FUNCTION(datefmt_parse) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); convert_to_int(z_parse_pos); - parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); + parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -155,7 +155,7 @@ PHP_FUNCTION(datefmt_parse) internal_parse_to_timestamp( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if(z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_INT(z_parse_pos, parse_pos); + ZVAL_LONG(z_parse_pos, parse_pos); } } /* }}} */ @@ -186,7 +186,7 @@ PHP_FUNCTION(datefmt_localtime) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); convert_to_int(z_parse_pos); - parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); + parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -194,7 +194,7 @@ PHP_FUNCTION(datefmt_localtime) internal_parse_to_localtime( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if (z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_INT(z_parse_pos, parse_pos); + ZVAL_LONG(z_parse_pos, parse_pos); } } /* }}} */ diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c index 2c3ffaa569..12cbb6c75b 100644 --- a/ext/intl/formatter/formatter.c +++ b/ext/intl/formatter/formatter.c @@ -40,9 +40,9 @@ void formatter_register_constants( INIT_FUNC_ARGS ) zend_error(E_ERROR, "NumberFormatter class not defined"); } - #define FORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); - #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); + #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UNumberFormatStyle constants */ FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL ); diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index 1a1409448a..4869fdf294 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -32,7 +32,7 @@ */ PHP_FUNCTION( numfmt_get_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ @@ -72,7 +72,7 @@ PHP_FUNCTION( numfmt_get_attribute ) if(value == -1) { INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR; } else { - RETVAL_INT(value); + RETVAL_LONG(value); } break; case UNUM_ROUNDING_INCREMENT: @@ -101,7 +101,7 @@ PHP_FUNCTION( numfmt_get_attribute ) */ PHP_FUNCTION( numfmt_get_text_attribute ) { - php_int_t attribute; + zend_long attribute; UChar value_buf[64]; int value_buf_size = USIZE( value_buf ); UChar* value = value_buf; @@ -109,7 +109,7 @@ PHP_FUNCTION( numfmt_get_text_attribute ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -145,12 +145,12 @@ PHP_FUNCTION( numfmt_get_text_attribute ) */ PHP_FUNCTION( numfmt_set_attribute ) { - php_int_t attribute; + zend_long attribute; zval *value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -183,7 +183,7 @@ PHP_FUNCTION( numfmt_set_attribute ) case UNUM_MAX_SIGNIFICANT_DIGITS: case UNUM_LENIENT_PARSE: convert_to_int_ex(value); - unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_IVAL_P(value)); + unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value)); break; case UNUM_ROUNDING_INCREMENT: convert_to_double_ex(value); @@ -209,13 +209,13 @@ PHP_FUNCTION( numfmt_set_text_attribute ) { int slength = 0; UChar *svalue = NULL; - php_int_t attribute; + zend_long attribute; char *value; int len; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -249,14 +249,14 @@ PHP_FUNCTION( numfmt_set_text_attribute ) */ PHP_FUNCTION( numfmt_get_symbol ) { - php_int_t symbol; + zend_long symbol; UChar value_buf[4]; UChar *value = value_buf; int length = USIZE(value_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, NumberFormatter_ce_ptr, &symbol ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -297,7 +297,7 @@ PHP_FUNCTION( numfmt_get_symbol ) */ PHP_FUNCTION( numfmt_set_symbol ) { - php_int_t symbol; + zend_long symbol; char* value = NULL; int value_len = 0; UChar* svalue = 0; @@ -305,7 +305,7 @@ PHP_FUNCTION( numfmt_set_symbol ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -426,12 +426,12 @@ PHP_FUNCTION( numfmt_set_pattern ) */ PHP_FUNCTION( numfmt_get_locale ) { - php_int_t type = ULOC_ACTUAL_LOCALE; + zend_long type = ULOC_ACTUAL_LOCALE; char* loc; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, NumberFormatter_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index 8a8f251dcc..abae435ca2 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -33,14 +33,14 @@ PHP_FUNCTION( numfmt_format ) { zval *number; - php_int_t type = FORMAT_TYPE_DEFAULT; + zend_long type = FORMAT_TYPE_DEFAULT; UChar format_buf[32]; UChar* formatted = format_buf; int formatted_len = USIZE(format_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|l", &object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -57,9 +57,9 @@ PHP_FUNCTION( numfmt_format ) convert_scalar_to_number_ex(number); } - if(Z_TYPE_P(number) == IS_INT) { + if(Z_TYPE_P(number) == IS_LONG) { /* take INT32 on 32-bit, int64 on 64-bit */ - type = (sizeof(php_int_t) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; + type = (sizeof(zend_long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; } else if(Z_TYPE_P(number) == IS_DOUBLE) { type = FORMAT_TYPE_DOUBLE; } else { @@ -67,7 +67,7 @@ PHP_FUNCTION( numfmt_format ) } } - if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_INT) { + if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) { SEPARATE_ZVAL_IF_NOT_REF(number); convert_scalar_to_number(number TSRMLS_CC ); } @@ -75,12 +75,12 @@ PHP_FUNCTION( numfmt_format ) switch(type) { case FORMAT_TYPE_INT32: convert_to_int_ex(number); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); formatted = eumalloc(formatted_len); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { efree(formatted); @@ -91,7 +91,7 @@ PHP_FUNCTION( numfmt_format ) case FORMAT_TYPE_INT64: { - int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_IVAL_P(number); + int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_LVAL_P(number); formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index f24df76f51..5e790999e4 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -30,13 +30,13 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char* locale; char* pattern = NULL; int locale_len = 0, pattern_len = 0; - php_int_t style; + zend_long style; UChar* spattern = NULL; int spattern_len = 0; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "si|s", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -125,7 +125,7 @@ PHP_FUNCTION( numfmt_get_error_code ) nfo = Z_INTL_NUMBERFORMATTER_P(object); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(nfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) ); } /* }}} */ diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index b7cf36945b..12c9465bc3 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -36,7 +36,7 @@ */ PHP_FUNCTION( numfmt_parse ) { - php_int_t type = FORMAT_TYPE_DOUBLE; + zend_long type = FORMAT_TYPE_DOUBLE; UChar* sstr = NULL; int sstr_len = 0; char* str = NULL; @@ -50,7 +50,7 @@ PHP_FUNCTION( numfmt_parse ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|iz/!", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|lz/!", &object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -69,7 +69,7 @@ PHP_FUNCTION( numfmt_parse ) if(zposition) { ZVAL_DEREF(zposition); convert_to_int(zposition); - position = (int32_t)Z_IVAL_P( zposition ); + position = (int32_t)Z_LVAL_P( zposition ); position_p = &position; } @@ -82,14 +82,14 @@ PHP_FUNCTION( numfmt_parse ) switch(type) { case FORMAT_TYPE_INT32: val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - RETVAL_INT(val32); + RETVAL_LONG(val32); break; case FORMAT_TYPE_INT64: val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) { RETVAL_DOUBLE(val64); } else { - RETVAL_INT((php_int_t)val64); + RETVAL_LONG((zend_long)val64); } break; case FORMAT_TYPE_DOUBLE: @@ -107,7 +107,7 @@ PHP_FUNCTION( numfmt_parse ) #endif if(zposition) { zval_dtor(zposition); - ZVAL_INT(zposition, position); + ZVAL_LONG(zposition, position); } if (sstr) { @@ -158,14 +158,14 @@ PHP_FUNCTION( numfmt_parse_currency ) if(zposition) { ZVAL_DEREF(zposition); convert_to_int(zposition); - position = (int32_t)Z_IVAL_P( zposition ); + position = (int32_t)Z_LVAL_P( zposition ); position_p = &position; } number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo)); if(zposition) { zval_dtor(zposition); - ZVAL_INT(zposition, position); + ZVAL_LONG(zposition, position); } if (sstr) { efree(sstr); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 3968508c51..f8dc9895e5 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -44,9 +44,9 @@ */ void grapheme_register_constants( INIT_FUNC_ARGS ) { - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen) ret_len = grapheme_ascii_check(string, string_len); if ( ret_len >= 0 ) - RETURN_INT(ret_len); + RETURN_LONG(ret_len); /* convert the string to UTF-16. */ status = U_ZERO_ERROR; @@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen) } if (ret_len >= 0) { - RETVAL_INT(ret_len); + RETVAL_LONG(ret_len); } else { RETVAL_FALSE; } @@ -111,11 +111,11 @@ PHP_FUNCTION(grapheme_strpos) unsigned char *haystack, *needle; int haystack_len, needle_len; unsigned char *found; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int ret_pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: unable to parse input param", 0 TSRMLS_CC ); @@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos) /* if it is there, and if the haystack is ascii, we are all done */ if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) { - RETURN_INT(found - haystack); + RETURN_LONG(found - haystack); } /* do utf16 part of the strpos */ ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -178,12 +178,12 @@ PHP_FUNCTION(grapheme_stripos) unsigned char *haystack, *needle, *haystack_dup, *needle_dup; int haystack_len, needle_len; unsigned char *found; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_stripos: unable to parse input param", 0 TSRMLS_CC ); @@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos) efree(needle_dup); if (found) { - RETURN_INT(found - haystack_dup); + RETURN_LONG(found - haystack_dup); } /* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */ @@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -252,12 +252,12 @@ PHP_FUNCTION(grapheme_strrpos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos) if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } /* if the needle was ascii too, we are done */ @@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -322,12 +322,12 @@ PHP_FUNCTION(grapheme_strripos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos) efree(needle_dup); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } /* if the needle was ascii too, we are done */ @@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -401,7 +401,7 @@ PHP_FUNCTION(grapheme_substr) unsigned char *str, *sub_str; UChar *ustr; int str_len, sub_str_len, ustr_len; - php_int_t lstart = 0, length = 0; + zend_long lstart = 0, length = 0; int32_t start = 0; int iter_val; UErrorCode status; @@ -410,7 +410,7 @@ PHP_FUNCTION(grapheme_substr) int sub_str_start_pos, sub_str_end_pos; int32_t (*iter_func)(UBreakIterator *); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (char **)&str, &str_len, &lstart, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: unable to parse input param", 0 TSRMLS_CC ); @@ -816,17 +816,17 @@ PHP_FUNCTION(grapheme_extract) unsigned char *str, *pstr; UChar *ustr; int str_len, ustr_len; - php_int_t size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ - php_int_t lstart = 0; /* starting position in str in bytes */ + zend_long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ + zend_long lstart = 0; /* starting position in str in bytes */ int32_t start = 0; - php_int_t extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; + zend_long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; UErrorCode status; unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE]; UBreakIterator* bi = NULL; int ret_pos; zval *next = NULL; /* return offset of next part of the string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: unable to parse input param", 0 TSRMLS_CC ); @@ -846,7 +846,7 @@ PHP_FUNCTION(grapheme_extract) /* initialize next */ SEPARATE_ZVAL(next); zval_dtor(next); - ZVAL_INT(next, lstart); + ZVAL_LONG(next, lstart); } } @@ -898,9 +898,9 @@ PHP_FUNCTION(grapheme_extract) */ if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) { - php_int_t nsize = ( size < str_len ? size : str_len ); + zend_long nsize = ( size < str_len ? size : str_len ); if ( NULL != next ) { - ZVAL_INT(next, start+nsize); + ZVAL_LONG(next, start+nsize); } RETURN_STRINGL(((char *)pstr), nsize); } @@ -943,7 +943,7 @@ PHP_FUNCTION(grapheme_extract) ubrk_close(bi); if ( NULL != next ) { - ZVAL_INT(next, start+ret_pos); + ZVAL_LONG(next, start+ret_pos); } RETURN_STRINGL(((char *)pstr), ret_pos); diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h index 576e524b16..235d043818 100644 --- a/ext/intl/grapheme/grapheme_util.h +++ b/ext/intl/grapheme/grapheme_util.h @@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */ -#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (php_int_t) max_len : offset >= (php_int_t) max_len) ) +#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (zend_long) max_len : offset >= (zend_long) max_len) ) #endif // GRAPHEME_GRAPHEME_UTIL_H diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 96bec482a1..8075c86124 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -51,56 +51,56 @@ void idn_register_constants( INIT_FUNC_ARGS ) /* Option to prohibit processing of unassigned codepoints in the input and do not check if the input conforms to STD-3 ASCII rules. */ - REGISTER_INT_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); /* Option to allow processing of unassigned codepoints in the input */ - REGISTER_INT_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); /* Option to check if input conforms to STD-3 ASCII rules */ - REGISTER_INT_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API /* Option to check for whether the input conforms to the BiDi rules. * Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */ - REGISTER_INT_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); /* Option to check for whether the input conforms to the CONTEXTJ rules. * Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */ - REGISTER_INT_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToASCII(). * By default, ToASCII() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToUnicode(). * By default, ToUnicode() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); #endif /* VARIANTS */ - REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API - REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_46_API /* PINFO ERROR CODES */ - REGISTER_INT_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); #endif } /* }}} */ @@ -140,14 +140,14 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, UIDNA *uts46; int32_t len; int32_t buffer_capac = 255; /* no domain name may exceed this */ - zend_string *buffer = STR_ALLOC(buffer_capac, 0); + zend_string *buffer = zend_string_alloc(buffer_capac, 0); UIDNAInfo info = UIDNA_INFO_INITIALIZER; int buffer_used = 0; uts46 = uidna_openUTS46(option, &status); if (php_intl_idn_check_status(status, "failed to open UIDNA instance", mode TSRMLS_CC) == FAILURE) { - STR_FREE(buffer); + zend_string_free(buffer); RETURN_FALSE; } @@ -161,7 +161,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, if (php_intl_idn_check_status(status, "failed to convert name", mode TSRMLS_CC) == FAILURE) { uidna_close(uts46); - STR_FREE(buffer); + zend_string_free(buffer); RETURN_FALSE; } if (len >= 255) { @@ -190,11 +190,11 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, } add_assoc_bool_ex(idna_info, "isTransitionalDifferent", sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent); - add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (php_int_t)info.errors); + add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (zend_long)info.errors); } if (!buffer_used) { - STR_FREE(buffer); + zend_string_free(buffer); } uidna_close(uts46); @@ -265,13 +265,13 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) { char *domain; int domain_len; - php_int_t option = 0, + zend_long option = 0, variant = INTL_IDN_VARIANT_2003; zval *idna_info = NULL; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iiz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|llz/", &domain, &domain_len, &option, &variant, &idna_info) == FAILURE) { php_intl_bad_args("bad arguments", mode TSRMLS_CC); RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */ diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h index cf83e6d7ee..9424571d02 100644 --- a/ext/intl/intl_common.h +++ b/ext/intl/intl_common.h @@ -39,6 +39,6 @@ #define UCHARS(len) ((len) / sizeof(UChar)) #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str) -#define INTL_Z_STRSIZE_P(str) UCHARS( Z_STRSIZE_P(str) ) +#define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) ) #endif /* INTL_COMMON_H */ diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index a94b076511..5c082ce190 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) if( pe->line > 0 ) { smart_str_appends( &ret, "on line " ); - smart_str_append_int( &ret, (php_int_t ) pe->line ); + smart_str_append_long( &ret, (zend_long ) pe->line ); any = 1; } if( pe->offset >= 0 ) { @@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) smart_str_appends( &ret, "at " ); smart_str_appends( &ret, "offset " ); - smart_str_append_int( &ret, (php_int_t ) pe->offset ); + smart_str_append_long( &ret, (zend_long ) pe->offset ); any = 1; } diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c index fa8edddfa3..921e6e589f 100644 --- a/ext/intl/locale/locale.c +++ b/ext/intl/locale/locale.c @@ -39,8 +39,8 @@ void locale_register_constants( INIT_FUNC_ARGS ) return; } - #define LOCALE_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); + #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE ); diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 34e7374969..f1821a6ada 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -241,9 +241,9 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) len = strlen(locale_name); } - ini_name = STR_INIT(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); + ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); zend_alter_ini_entry(ini_name, locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); RETURN_TRUE; } @@ -782,7 +782,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_ /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); return SUCCESS; } @@ -822,7 +822,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix( loc_name , key_name); smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); return SUCCESS; } else if(Z_TYPE_P(ele_value) == IS_ARRAY ) { HashTable *arr = HASH_OF(ele_value); @@ -836,7 +836,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRSIZE_P(data)); + smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data)); } ZEND_HASH_FOREACH_END(); return SUCCESS; } else { @@ -869,7 +869,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , cur_key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); } } /* end of for */ } /* end of else */ @@ -1439,7 +1439,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC); LOOKUP_CLEAN_RETURN(NULL); } - cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRSIZE_P(ele_value)); + cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value)); result = strToMatch(Z_STRVAL_P(ele_value), cur_arr[cur_arr_len*2]); if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag", 0 TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index cfe6538f0a..b9f6c7a369 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 188e6580f7..3b7bdda78e 100644 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -30,7 +30,7 @@ typedef struct { // formatter handling UMessageFormat* umsgf; char* orig_format; - php_uint_t orig_format_len; + zend_ulong orig_format_len; HashTable* arg_types; int tz_set; /* if we've already the time zone in sub-formats */ } msgformat_data; diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 3be80791ba..50527b7f06 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, for (int i = 0; i < parts_count; i++) { const Formattable::Type t = types[i]; - if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) { + if (zend_hash_index_update_mem(ret, (zend_ulong)i, (void*)&t, sizeof(t)) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); break; @@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, "Found part with negative number", 0 TSRMLS_CC); continue; } - if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (zend_ulong)argNumber)) == NULL) { /* not found already; create new entry in HT */ Formattable::Type bogusType = Formattable::kObject; - if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (zend_ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); continue; @@ -388,7 +388,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, // Key related variables zend_string *str_index; - php_uint_t num_index; + zend_ulong num_index; ZEND_HASH_FOREACH_KEY_VAL(args, num_index, str_index, elem) { Formattable& formattable = fargs[argNum]; @@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, /* Process key and retrieve type */ if (str_index == NULL) { /* includes case where index < 0 because it's exposed as unsigned */ - if (num_index > (php_uint_t)INT32_MAX) { + if (num_index > (zend_ulong)INT32_MAX) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found negative or too large array key", 0 TSRMLS_CC); continue; @@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index); key.append(temp, len); - storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index); + storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index); } else { //string; assumed to be in UTF-8 intl_stringFromChar(key, str_index->val, str_index->len, &err.code); @@ -447,7 +447,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, UnicodeString *text = new UnicodeString(); intl_stringFromChar(*text, - Z_STRVAL_P(elem), Z_STRSIZE_P(elem), &err.code); + Z_STRVAL_P(elem), Z_STRLEN_P(elem), &err.code); if (U_FAILURE(err.code)) { char *message; @@ -466,14 +466,14 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, double d; if (Z_TYPE_P(elem) == IS_DOUBLE) { d = Z_DVAL_P(elem); - } else if (Z_TYPE_P(elem) == IS_INT) { - d = (double)Z_IVAL_P(elem); + } else if (Z_TYPE_P(elem) == IS_LONG) { + d = (double)Z_LVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); d = (Z_TYPE_P(elem) == IS_DOUBLE) ? Z_DVAL_P(elem) - : (double)Z_IVAL_P(elem); + : (double)Z_LVAL_P(elem); } formattable.setDouble(d); break; @@ -491,14 +491,14 @@ retry_klong: } else { tInt32 = (int32_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_INT) { - if (Z_IVAL_P(elem) > INT32_MAX || - Z_IVAL_P(elem) < INT32_MIN) { + } else if (Z_TYPE_P(elem) == IS_LONG) { + if (Z_LVAL_P(elem) > INT32_MAX || + Z_LVAL_P(elem) < INT32_MIN) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found PHP integer with absolute value too large " "for 32 bit integer argument", 0 TSRMLS_CC); } else { - tInt32 = (int32_t)Z_IVAL_P(elem); + tInt32 = (int32_t)Z_LVAL_P(elem); } } else { SEPARATE_ZVAL_IF_NOT_REF(elem); @@ -521,9 +521,9 @@ retry_kint64: } else { tInt64 = (int64_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_INT) { + } else if (Z_TYPE_P(elem) == IS_LONG) { /* assume long is not wider than 64 bits */ - tInt64 = (int64_t)Z_IVAL_P(elem); + tInt64 = (int64_t)Z_LVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); @@ -569,8 +569,8 @@ retry_kint64: case IS_FALSE: convert_to_int_ex(elem); /* Intentional fallthrough */ - case IS_INT: - formattable.setInt64((int64_t)Z_IVAL_P(elem)); + case IS_LONG: + formattable.setInt64((int64_t)Z_LVAL_P(elem)); break; case IS_NULL: formattable.setInt64((int64_t)0); @@ -658,7 +658,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh break; case Formattable::kLong: - ZVAL_INT(&(*args)[i], fargs[i].getLong()); + ZVAL_LONG(&(*args)[i], fargs[i].getLong()); break; case Formattable::kInt64: @@ -666,7 +666,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { - ZVAL_INT(&(*args)[i], (php_int_t)aInt64); + ZVAL_LONG(&(*args)[i], (zend_long)aInt64); } break; diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c index cbc680e7aa..f06a3e685c 100644 --- a/ext/intl/normalizer/normalizer.c +++ b/ext/intl/normalizer/normalizer.c @@ -37,9 +37,9 @@ void normalizer_register_constants( INIT_FUNC_ARGS ) return; } - #define NORMALIZER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); - #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* Normalization form constants */ NORMALIZER_EXPOSE_CLASS_CONST( NONE ); diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c index ad600c1b55..9eb8befa7f 100644 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -34,7 +34,7 @@ PHP_FUNCTION( normalizer_normalize ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - php_int_t form = NORMALIZER_DEFAULT; + zend_long form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -53,7 +53,7 @@ PHP_FUNCTION( normalizer_normalize ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", &input, &input_len, &form ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -174,7 +174,7 @@ PHP_FUNCTION( normalizer_is_normalized ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - php_int_t form = NORMALIZER_DEFAULT; + zend_long form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -186,7 +186,7 @@ PHP_FUNCTION( normalizer_is_normalized ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", &input, &input_len, &form) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index f837bf9d78..9ca225ab88 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -910,7 +910,7 @@ PHP_MINIT_FUNCTION( intl ) /* For the default locale php.ini setting */ REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS); #ifdef U_ICU_DATA_VERSION REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS); diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index 1ee496402f..86a75cb335 100644 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -50,7 +50,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl) collator_compare_func_t compare_func; UBreakIterator* grapheme_iterator; intl_error g_error; - php_int_t error_level; + zend_long error_level; zend_bool use_exceptions; ZEND_END_MODULE_GLOBALS(intl) diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index b13ee901f4..1232a42868 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -32,7 +32,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so const int32_t* vfield; int32_t ilen; int i; - php_int_t lfield; + zend_long lfield; ResourceBundle_object* newrb; restype = ures_getType( source->child ); @@ -53,7 +53,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so case URES_INT: lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) ); INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value"); - ZVAL_INT( return_value, lfield ); + ZVAL_LONG( return_value, lfield ); break; case URES_INT_VECTOR: @@ -61,7 +61,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value"); array_init( return_value ); for (i=0; i<ilen; i++) { - add_next_index_int( return_value, vfield[i] ); + add_next_index_long( return_value, vfield[i] ); } break; diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 5975c26607..e2f821ef2c 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -177,9 +177,9 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ intl_error_reset( NULL TSRMLS_CC ); RESOURCEBUNDLE_METHOD_FETCH_OBJECT; - if(Z_TYPE_P(offset) == IS_INT) { + if(Z_TYPE_P(offset) == IS_LONG) { is_numeric = 1; - meindex = Z_IVAL_P(offset); + meindex = Z_LVAL_P(offset); rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) ); } else if(Z_TYPE_P(offset) == IS_STRING) { mekey = Z_STRVAL_P(offset); @@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get ) /* }}} */ /* {{{ resourcebundle_array_count */ -int resourcebundle_array_count(zval *object, php_int_t *count TSRMLS_DC) +int resourcebundle_array_count(zval *object, zend_long *count TSRMLS_DC) { ResourceBundle_object *rb; RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; @@ -299,7 +299,7 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_FETCH_OBJECT; len = ures_getSize( rb->me ); - RETURN_INT( len ); + RETURN_LONG( len ); } /* {{{ arginfo_resourcebundle_getlocales */ @@ -372,7 +372,7 @@ PHP_FUNCTION( resourcebundle_get_error_code ) rb = Z_INTL_RESOURCEBUNDLE_P( object ); - RETURN_INT(INTL_DATA_ERROR_CODE(rb)); + RETURN_LONG(INTL_DATA_ERROR_CODE(rb)); } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c index 79149cb234..bdedfd15bc 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.c +++ b/ext/intl/resourcebundle/resourcebundle_iterator.c @@ -109,7 +109,7 @@ static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key T if (iterator->is_table) { ZVAL_STRING(key, iterator->currentkey); } else { - ZVAL_INT(key, iterator->i); + ZVAL_LONG(key, iterator->i); } } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h index 0c0849eddd..32818f847f 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.h +++ b/ext/intl/resourcebundle/resourcebundle_iterator.h @@ -25,10 +25,10 @@ typedef struct { zend_object_iterator intern; ResourceBundle_object *subject; zend_bool is_table; - php_int_t length; + zend_long length; zval current; char *currentkey; - php_int_t i; + zend_long i; } ResourceBundle_iterator; zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref TSRMLS_DC ); diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c index 747654a53b..42a014a90e 100644 --- a/ext/intl/spoofchecker/spoofchecker.c +++ b/ext/intl/spoofchecker/spoofchecker.c @@ -35,7 +35,7 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS) return; } - #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); + #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE) diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index 57b3bdffc9..64c641ae10 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -47,7 +47,7 @@ PHP_METHOD(Spoofchecker, isSuspicious) if (error_code) { zval_dtor(error_code); - ZVAL_INT(error_code, ret); + ZVAL_LONG(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -80,7 +80,7 @@ PHP_METHOD(Spoofchecker, areConfusable) if (error_code) { zval_dtor(error_code); - ZVAL_INT(error_code, ret); + ZVAL_LONG(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -115,10 +115,10 @@ PHP_METHOD(Spoofchecker, setAllowedLocales) */ PHP_METHOD(Spoofchecker, setChecks) { - php_int_t checks; + zend_long checks; SPOOFCHECKER_METHOD_INIT_VARS; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &checks)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &checks)) { return; } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index a0651d5352..623a643c49 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -180,7 +180,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, gottenId; UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */ convert_to_string_ex(zv_timezone); - if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRSIZE_P(zv_timezone), + if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone), &status) == FAILURE) { spprintf(&message, 0, "%s: Time zone identifier given is not a " "valid UTF-8 string", func); @@ -249,7 +249,7 @@ static zend_object *TimeZone_clone_obj(zval *object TSRMLS_DC) "Could not clone IntlTimeZone", 0 TSRMLS_CC); err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { to_new->utimezone = newTimeZone; } @@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) return debug_info; } - ZVAL_INT(&zv, (php_int_t)rawOffset); + ZVAL_LONG(&zv, (zend_long)rawOffset); zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); - ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset)); + ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset)); zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; @@ -513,26 +513,26 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D) /* Declare 'IntlTimeZone' class constants */ -#define TIMEZONE_DECL_INT_CONST(name, val) \ - zend_declare_class_constant_int(TimeZone_ce_ptr, name, sizeof(name) - 1, \ +#define TIMEZONE_DECL_LONG_CONST(name, val) \ + zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT", TimeZone::SHORT); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG", TimeZone::LONG); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); - TIMEZONE_DECL_INT_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); + TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); #endif #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 - TIMEZONE_DECL_INT_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); - TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); - TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); + TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); + TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); + TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); #endif /* Declare 'IntlTimeZone' class properties */ diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 4dbb6ddda3..9bbd182dee 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -159,34 +159,34 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration) if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) { se = TimeZone::createEnumeration(); - } else if (Z_TYPE_P(arg) == IS_INT) { + } else if (Z_TYPE_P(arg) == IS_LONG) { int_offset: - if (Z_IVAL_P(arg) < (php_int_t)INT32_MIN || - Z_IVAL_P(arg) > (php_int_t)INT32_MAX) { + if (Z_LVAL_P(arg) < (zend_long)INT32_MIN || + Z_LVAL_P(arg) > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_enumeration: value is out of range", 0 TSRMLS_CC); RETURN_FALSE; } else { - se = TimeZone::createEnumeration((int32_t) Z_IVAL_P(arg)); + se = TimeZone::createEnumeration((int32_t) Z_LVAL_P(arg)); } } else if (Z_TYPE_P(arg) == IS_DOUBLE) { double_offset: convert_to_int_ex(arg); goto int_offset; } else if (Z_TYPE_P(arg) == IS_OBJECT || Z_TYPE_P(arg) == IS_STRING) { - php_int_t lval; + zend_long lval; double dval; convert_to_string_ex(arg); - switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) { case IS_DOUBLE: SEPARATE_ZVAL(arg); zval_dtor(arg); ZVAL_DOUBLE(arg, dval); goto double_offset; - case IS_INT: + case IS_LONG: SEPARATE_ZVAL(arg); zval_dtor(arg); - ZVAL_INT(arg, lval); + ZVAL_LONG(arg, lval); goto int_offset; } /* else call string version */ @@ -228,13 +228,13 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) } int32_t result = TimeZone::countEquivalentIDs(id); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) { - php_int_t zoneType, + zend_long zoneType, offset_arg; char *region = NULL; int region_len = 0; @@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) != FAILURE && Z_TYPE_P(zvoffset) == IS_NULL; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s!i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s!l", &zoneType, ®ion, ®ion_len, &offset_arg) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: bad arguments", 0 TSRMLS_CC); @@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) } if (ZEND_NUM_ARGS() == 3) { - if (offset_arg < (php_int_t)INT32_MIN || offset_arg > (php_int_t)INT32_MAX) { + if (offset_arg < (zend_long)INT32_MIN || offset_arg > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: offset out of bounds", 0 TSRMLS_CC); RETURN_FALSE; @@ -383,12 +383,12 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id) { char *str_id; int str_id_len; - php_int_t index; + zend_long index; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str_id, &str_id_len, &index) == FAILURE || - index < (php_int_t)INT32_MIN || index > (php_int_t)INT32_MAX) { + index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_equivalent_id: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -485,10 +485,10 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset) ZVAL_DEREF(rawOffsetArg); zval_dtor(rawOffsetArg); - ZVAL_INT(rawOffsetArg, rawOffset); + ZVAL_LONG(rawOffsetArg, rawOffset); ZVAL_DEREF(dstOffsetArg); zval_dtor(dstOffsetArg); - ZVAL_INT(dstOffsetArg, dstOffset); + ZVAL_LONG(dstOffsetArg, dstOffset); RETURN_TRUE; } @@ -506,7 +506,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_INT(to->utimezone->getRawOffset()); + RETURN_LONG(to->utimezone->getRawOffset()); } U_CFUNC PHP_FUNCTION(intltz_has_same_rules) @@ -545,13 +545,13 @@ static const TimeZone::EDisplayType display_types[] = { U_CFUNC PHP_FUNCTION(intltz_get_display_name) { zend_bool daylight = 0; - php_int_t display_type = TimeZone::LONG; + zend_long display_type = TimeZone::LONG; const char *locale_str = NULL; int dummy = 0; TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "O|bis!", &object, TimeZone_ce_ptr, &daylight, &display_type, + "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type, &locale_str, &dummy) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: bad arguments", 0 TSRMLS_CC); @@ -603,7 +603,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_INT((php_int_t)to->utimezone->getDSTSavings()); + RETURN_LONG((zend_long)to->utimezone->getDSTSavings()); } U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) @@ -646,7 +646,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code) if (to == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)TIMEZONE_ERROR_CODE(to)); + RETURN_LONG((zend_long)TIMEZONE_ERROR_CODE(to)); } U_CFUNC PHP_FUNCTION(intltz_get_error_message) diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 88e1225654..5f698e2b90 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -35,9 +35,9 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) return; } - #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_INT_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) - #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); - #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ + #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_LONG_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) + #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); + #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ /* Normalization form constants */ TRANSLITERATOR_EXPOSE_CLASS_CONST( FORWARD ); diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index e5f26f2829..ff299a8f38 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -183,7 +183,7 @@ err: err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) TSRMLS_CC ); php_error_docref( NULL TSRMLS_CC, E_ERROR, "%s", err_msg->val ); - STR_FREE( err_msg ); /* if it's changed into a warning */ + zend_string_free( err_msg ); /* if it's changed into a warning */ /* do not destroy tempz; we need to return something */ } } @@ -223,7 +223,7 @@ static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, in TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) { retval = NULL; /* fallback to read_property */ } @@ -247,7 +247,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type, if( ( type != BP_VAR_R && type != BP_VAR_IS ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); retval = &EG( uninitialized_zval ); @@ -272,7 +272,7 @@ static void Transliterator_write_property( zval *object, zval *member, zval *val if( ( EG( scope ) != Transliterator_ce_ptr ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); } diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index c4f620f9ca..e2b1929216 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -27,7 +27,7 @@ #include <zend_exceptions.h> -static int create_transliterator( char *str_id, int str_id_len, php_int_t direction, zval *object TSRMLS_DC ) +static int create_transliterator( char *str_id, int str_id_len, zend_long direction, zval *object TSRMLS_DC ) { Transliterator_object *to; UChar *ustr_id = NULL; @@ -105,14 +105,14 @@ PHP_FUNCTION( transliterator_create ) { char *str_id; int str_id_len; - php_int_t direction = TRANSLITERATOR_FORWARD; + zend_long direction = TRANSLITERATOR_FORWARD; int res; TRANSLITERATOR_METHOD_INIT_VARS; (void) to; /* unused */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str_id, &str_id_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -139,14 +139,14 @@ PHP_FUNCTION( transliterator_create_from_rules ) int str_rules_len; UChar *ustr_rules = NULL; int32_t ustr_rules_len = 0; - php_int_t direction = TRANSLITERATOR_FORWARD; + zend_long direction = TRANSLITERATOR_FORWARD; UParseError parse_error = {0, -1}; UTransliterator *utrans; UChar id[] = {0x52, 0x75, 0x6C, 0x65, 0x73, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */ TRANSLITERATOR_METHOD_INIT_VARS; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str_rules, &str_rules_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -307,7 +307,7 @@ PHP_FUNCTION( transliterator_transliterate ) int32_t ustr_len = 0, capacity, uresult_len; - php_int_t start = 0, + zend_long start = 0, limit = -1; int success = 0; zval tmp_object; @@ -320,7 +320,7 @@ PHP_FUNCTION( transliterator_transliterate ) { /* in non-OOP version, accept both a transliterator and a string */ zval *arg1; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ii", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ll", &arg1, &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -342,20 +342,20 @@ PHP_FUNCTION( transliterator_transliterate ) convert_to_string( arg1 ); } object = &tmp_object; - res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRSIZE_P( arg1 ), + res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ), TRANSLITERATOR_FORWARD, object TSRMLS_CC ); if( res == FAILURE ) { zend_string *message = intl_error_get_message( NULL TSRMLS_CC ); php_error_docref0( NULL TSRMLS_CC, E_WARNING, "Could not create " "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), message->val ); - STR_FREE( message ); + zend_string_free( message ); /* don't set U_ILLEGAL_ARGUMENT_ERROR to allow fetching of inner error */ goto cleanup; } } } - else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", + else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -497,7 +497,7 @@ PHP_FUNCTION( transliterator_get_error_code ) if (to == NULL ) RETURN_FALSE; - RETURN_INT( (php_int_t) TRANSLITERATOR_ERROR_CODE( to ) ); + RETURN_LONG( (zend_long) TRANSLITERATOR_ERROR_CODE( to ) ); } /* }}} */ diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index f2a1ee4dda..a9f1b0a7ae 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -293,7 +293,7 @@ static int dehexchar(char c) static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC) { - if (type == IS_INT) + if (type == IS_LONG) { zend_bool bigint = 0; @@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM buf->s->len--; } - if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) { - if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits); + if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) { + if (buf->s->len == MAX_LENGTH_OF_LONG - 1) { + int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) { bigint = 1; @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_INT(z, strtol(buf->s->val, NULL, 10)); + ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -373,7 +373,7 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16) && ((unsigned char) buf->s->val[buf->s->len - 1] & 0xc0) == 0x80) { /* found surrogate pair */ - php_uint_t utf32; + zend_ulong utf32; utf32 = (((buf->s->val[buf->s->len - 2] & 0xf) << 16) | ((buf->s->val[buf->s->len - 1] & 0x3f) << 10) @@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_INT; + } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_LONG; smart_str_appendc(&buf, next_char); - } else if (type == IS_INT && next_state == E1) { + } else if (type == IS_LONG && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { diff --git a/ext/json/json.c b/ext/json/json.c index 60893fe1ea..cbdec32d88 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -93,29 +93,29 @@ static PHP_MINIT_FUNCTION(json) INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface); php_json_serializable_ce = zend_register_internal_interface(&ce TSRMLS_CC); - REGISTER_INT_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -177,7 +177,7 @@ static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */ i = myht ? zend_hash_num_elements(myht) : 0; if (i > 0) { zend_string *key; - php_uint_t index, idx; + zend_ulong index, idx; idx = 0; ZEND_HASH_FOREACH_KEY(myht, index, key) { @@ -252,7 +252,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) if (i > 0) { zend_string *key; zval *data; - php_uint_t index; + zend_ulong index; HashTable *tmp_ht; ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) { @@ -308,7 +308,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) json_pretty_print_indent(buf, options TSRMLS_CC); smart_str_appendc(buf, '"'); - smart_str_append_int(buf, (php_int_t) index); + smart_str_append_long(buf, (zend_long) index); smart_str_appendc(buf, '"'); smart_str_appendc(buf, ':'); @@ -395,11 +395,11 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR if (options & PHP_JSON_NUMERIC_CHECK) { double d; int type; - php_int_t p; + zend_long p; if ((type = is_numeric_string(s, len, &p, &d, 0)) != 0) { - if (type == IS_INT) { - smart_str_append_int(buf, p); + if (type == IS_LONG) { + smart_str_append_long(buf, p); } else if (type == IS_DOUBLE) { if (!zend_isinf(d) && !zend_isnan(d)) { char *tmp; @@ -602,8 +602,8 @@ again: smart_str_appendl(buf, "false", 5); break; - case IS_INT: - smart_str_append_int(buf, Z_IVAL_P(val)); + case IS_LONG: + smart_str_append_long(buf, Z_LVAL_P(val)); break; case IS_DOUBLE: @@ -624,7 +624,7 @@ again: break; case IS_STRING: - json_escape_string(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val), options TSRMLS_CC); + json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC); break; case IS_OBJECT: @@ -651,7 +651,7 @@ again: } /* }}} */ -PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC) /* {{{ */ +PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, zend_long depth TSRMLS_DC) /* {{{ */ { int utf16_len; unsigned short *utf16; @@ -678,7 +678,7 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, if (!parse_JSON_ex(jp, return_value, utf16, utf16_len, options TSRMLS_CC)) { double d; int type, overflow_info; - php_int_t p; + zend_long p; char *trim = str; int trim_len = str_len; @@ -710,8 +710,8 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, } if ((type = is_numeric_string_ex(trim, trim_len, &p, &d, 0, &overflow_info)) != 0) { - if (type == IS_INT) { - RETVAL_INT(p); + if (type == IS_LONG) { + RETVAL_LONG(p); } else if (type == IS_DOUBLE) { if (options & PHP_JSON_BIGINT_AS_STRING && overflow_info) { /* Within an object or array, a numeric literal is assumed @@ -758,10 +758,10 @@ static PHP_FUNCTION(json_encode) { zval *parameter; smart_str buf = {0}; - php_int_t options = 0; - php_int_t depth = JSON_PARSER_DEFAULT_DEPTH; + zend_long options = 0; + zend_long depth = JSON_PARSER_DEFAULT_DEPTH; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", ¶meter, &options, &depth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", ¶meter, &options, &depth) == FAILURE) { return; } @@ -788,10 +788,10 @@ static PHP_FUNCTION(json_decode) char *str; int str_len; zend_bool assoc = 0; /* return JS objects as PHP objects by default */ - php_int_t depth = JSON_PARSER_DEFAULT_DEPTH; - php_int_t options = 0; + zend_long depth = JSON_PARSER_DEFAULT_DEPTH; + zend_long options = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bii", &str, &str_len, &assoc, &depth, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) { return; } @@ -820,7 +820,7 @@ static PHP_FUNCTION(json_last_error) return; } - RETURN_INT(JSON_G(error_code)); + RETURN_LONG(JSON_G(error_code)); } /* }}} */ diff --git a/ext/json/php_json.h b/ext/json/php_json.h index b42aecba7d..59d65ec3c8 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -50,7 +50,7 @@ ZEND_END_MODULE_GLOBALS(json) #endif PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC); -PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC); +PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, zend_long depth TSRMLS_DC); extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; @@ -74,7 +74,7 @@ extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; #define PHP_JSON_OBJECT_AS_ARRAY (1<<0) #define PHP_JSON_BIGINT_AS_STRING (1<<1) -static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, php_int_t depth TSRMLS_DC) +static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth TSRMLS_DC) { php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC); } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 98600897ac..71e6ac4aac 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -147,65 +147,65 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_INI_ENTRIES(); /* Constants to be used with deref-parameter in php_ldap_do_search() */ - REGISTER_INT_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); /* Constants to be used with ldap_modify_batch() */ - REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* LDAP options */ - REGISTER_INT_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_NETWORK_TIMEOUT - REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); #elif defined (LDAP_X_OPT_CONNECT_TIMEOUT) - REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_INT_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_RESTART - REGISTER_INT_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_HOST_NAME - REGISTER_INT_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_MATCHED_DN - REGISTER_INT_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_INT_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_DEBUG_LEVEL - REGISTER_INT_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); #endif #ifdef HAVE_LDAP_SASL - REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); #endif #ifdef ORALDAP - REGISTER_INT_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_INT_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); @@ -295,11 +295,11 @@ PHP_FUNCTION(ldap_connect) { char *host = NULL; int hostlen; - php_int_t port = 389; /* Default port */ + zend_long port = 389; /* Default port */ #ifdef HAVE_ORALDAP char *wallet = NULL, *walletpasswd = NULL; int walletlen = 0, walletpasswdlen = 0; - php_int_t authmode = GSLC_SSL_NO_AUTH; + zend_long authmode = GSLC_SSL_NO_AUTH; int ssl=0; #endif ldap_linkdata *ld; @@ -310,7 +310,7 @@ PHP_FUNCTION(ldap_connect) WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sissi", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { RETURN_FALSE; } @@ -318,7 +318,7 @@ PHP_FUNCTION(ldap_connect) ssl = 1; } #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|si", &host, &hostlen, &port) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &hostlen, &port) != SUCCESS) { RETURN_FALSE; } #endif @@ -610,7 +610,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) { zval *link, *base_dn, *filter, *attrs = NULL, *attr; - php_int_t attrsonly, sizelimit, timelimit, deref; + zend_long attrsonly, sizelimit, timelimit, deref; char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL; ldap_linkdata *ld = NULL; LDAPMessage *ldap_res; @@ -618,7 +618,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1; int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|aiiii", &link, &base_dn, &filter, &attrs, &attrsonly, + if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|allll", &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) { return; } @@ -870,7 +870,7 @@ PHP_FUNCTION(ldap_count_entries) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result); - RETURN_INT(ldap_count_entries(ld->link, ldap_result)); + RETURN_LONG(ldap_count_entries(ld->link, ldap_result)); } /* }}} */ @@ -957,7 +957,7 @@ PHP_FUNCTION(ldap_get_entries) num_entries = ldap_count_entries(ldap, ldap_result); array_init(return_value); - add_assoc_int(return_value, "count", num_entries); + add_assoc_long(return_value, "count", num_entries); if (num_entries == 0) { return; @@ -981,7 +981,7 @@ PHP_FUNCTION(ldap_get_entries) num_values = ldap_count_values_len(ldap_value); array_init(&tmp2); - add_assoc_int(&tmp2, "count", num_values); + add_assoc_long(&tmp2, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1003,7 +1003,7 @@ PHP_FUNCTION(ldap_get_entries) } #endif - add_assoc_int(&tmp1, "count", num_attrib); + add_assoc_long(&tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); add_assoc_string(&tmp1, "dn", dn); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -1018,7 +1018,7 @@ PHP_FUNCTION(ldap_get_entries) ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry); } - add_assoc_int(return_value, "count", num_entries); + add_assoc_long(return_value, "count", num_entries); } /* }}} */ @@ -1031,9 +1031,9 @@ PHP_FUNCTION(ldap_first_attribute) ldap_linkdata *ld; ldap_resultentry *resultentry; char *attribute; - php_int_t dummy_ber; + zend_long dummy_ber; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { return; } @@ -1059,9 +1059,9 @@ PHP_FUNCTION(ldap_next_attribute) ldap_linkdata *ld; ldap_resultentry *resultentry; char *attribute; - php_int_t dummy_ber; + zend_long dummy_ber; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { return; } @@ -1119,7 +1119,7 @@ PHP_FUNCTION(ldap_get_attributes) num_values = ldap_count_values_len(ldap_value); array_init(&tmp); - add_assoc_int(&tmp, "count", num_values); + add_assoc_long(&tmp, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1140,7 +1140,7 @@ PHP_FUNCTION(ldap_get_attributes) } #endif - add_assoc_int(return_value, "count", num_attrib); + add_assoc_long(return_value, "count", num_attrib); } /* }}} */ @@ -1174,7 +1174,7 @@ PHP_FUNCTION(ldap_get_values_len) add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len); } - add_assoc_int(return_value, "count", num_values); + add_assoc_long(return_value, "count", num_values); ldap_value_free_len(ldap_value_len); } @@ -1214,11 +1214,11 @@ PHP_FUNCTION(ldap_get_dn) Splits DN into its component parts */ PHP_FUNCTION(ldap_explode_dn) { - php_int_t with_attrib; + zend_long with_attrib; char *dn, **ldap_value; int i, count, dn_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &dn, &dn_len, &with_attrib) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &dn, &dn_len, &with_attrib) != SUCCESS) { return; } @@ -1233,7 +1233,7 @@ PHP_FUNCTION(ldap_explode_dn) array_init(return_value); - add_assoc_int(return_value, "count", count); + add_assoc_long(return_value, "count", count); for (i = 0; i<count; i++) { add_index_string(return_value, i, ldap_value[i]); } @@ -1280,7 +1280,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) int i, j, num_attribs, num_values, dn_len; int *num_berval; zend_string *attribute; - php_uint_t index; + zend_ulong index; int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) { @@ -1338,7 +1338,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) if ((num_values == 1) && (Z_TYPE_P(value) != IS_ARRAY)) { convert_to_string_ex(value); ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRSIZE_P(value); + ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value); ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_P(value); } else { for (j = 0; j < num_values; j++) { @@ -1351,7 +1351,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(ivalue); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(ivalue); ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_P(ivalue); } } @@ -1539,10 +1539,10 @@ PHP_FUNCTION(ldap_modify_batch) /* perform validation */ { zend_string *modkey; - php_int_t modtype; + zend_long modtype; /* to store the wrongly-typed keys */ - php_uint_t tmpUlong; + zend_ulong tmpUlong; /* make sure the DN contains no NUL bytes */ if (_ldap_strlen_max(dn, dn_len) != dn_len) { @@ -1552,7 +1552,7 @@ PHP_FUNCTION(ldap_modify_batch) /* make sure the top level is a normal array */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods)); - if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_INT) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed"); RETURN_FALSE; } @@ -1604,19 +1604,19 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } - if (Z_STRSIZE_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRSIZE_P(modinfo))) { + if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes"); RETURN_FALSE; } } else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) { - if (Z_TYPE_P(modinfo) != IS_INT) { + if (Z_TYPE_P(modinfo) != IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long"); RETURN_FALSE; } /* is the value in range? */ - modtype = Z_IVAL_P(modinfo); + modtype = Z_LVAL_P(modinfo); if ( modtype != LDAP_MODIFY_BATCH_ADD && modtype != LDAP_MODIFY_BATCH_REMOVE && @@ -1656,7 +1656,7 @@ PHP_FUNCTION(ldap_modify_batch) } /* are its keys integers? */ - if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_INT) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed"); RETURN_FALSE; } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_modify_batch) _ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals); /* map the modification type */ - switch (Z_IVAL_P(modtype)) { + switch (Z_LVAL_P(modtype)) { case LDAP_MODIFY_BATCH_ADD: oper = LDAP_MOD_ADD; break; @@ -1718,9 +1718,9 @@ PHP_FUNCTION(ldap_modify_batch) /* fill in the basic info */ ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRSIZE_P(attrib)); + ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib)); - if (Z_IVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { + if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { /* no values */ ldap_mods[i]->mod_bvalues = NULL; } @@ -1739,8 +1739,8 @@ PHP_FUNCTION(ldap_modify_batch) ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0); /* fill it */ - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(modval); - ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRSIZE_P(modval)); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval); + ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval)); } /* NULL-terminate values */ @@ -1800,7 +1800,7 @@ PHP_FUNCTION(ldap_errno) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - RETURN_INT(_get_lderrno(ld->link)); + RETURN_LONG(_get_lderrno(ld->link)); } /* }}} */ @@ -1808,9 +1808,9 @@ PHP_FUNCTION(ldap_errno) Convert error number to error string */ PHP_FUNCTION(ldap_err2str) { - php_int_t perrno; + zend_long perrno; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perrno) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perrno) != SUCCESS) { return; } @@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_compare) } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno)); - RETURN_INT(-1); + RETURN_LONG(-1); } /* }}} */ @@ -1908,9 +1908,9 @@ PHP_FUNCTION(ldap_get_option) { zval *link, *retval; ldap_linkdata *ld; - php_int_t option; + zend_long option; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/", &link, &option, &retval) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/", &link, &option, &retval) != SUCCESS) { return; } @@ -1934,7 +1934,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_INT(retval, val); + ZVAL_LONG(retval, val); } break; #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: @@ -1951,7 +1951,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_INT(retval, timeout->tv_sec); + ZVAL_LONG(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) @@ -1963,7 +1963,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_INT(retval, (timeout / 1000)); + ZVAL_LONG(retval, (timeout / 1000)); } break; #endif /* options with string value */ @@ -2013,9 +2013,9 @@ PHP_FUNCTION(ldap_set_option) zval *link, *newval; ldap_linkdata *ld; LDAP *ldap; - php_int_t option; + zend_long option; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ziz", &link, &option, &newval) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlz", &link, &option, &newval) != SUCCESS) { return; } @@ -2040,7 +2040,7 @@ PHP_FUNCTION(ldap_set_option) int val; convert_to_int_ex(newval); - val = Z_IVAL_P(newval); + val = Z_LVAL_P(newval); if (ldap_set_option(ldap, option, &val)) { RETURN_FALSE; } @@ -2051,7 +2051,7 @@ PHP_FUNCTION(ldap_set_option) struct timeval timeout; convert_to_int_ex(newval); - timeout.tv_sec = Z_IVAL_P(newval); + timeout.tv_sec = Z_LVAL_P(newval); timeout.tv_usec = 0; if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; @@ -2063,7 +2063,7 @@ PHP_FUNCTION(ldap_set_option) int timeout; convert_to_int_ex(newval); - timeout = 1000 * Z_IVAL_P(newval); /* Convert to milliseconds */ + timeout = 1000 * Z_LVAL_P(newval); /* Convert to milliseconds */ if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } @@ -2138,7 +2138,7 @@ PHP_FUNCTION(ldap_set_option) if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) { convert_to_string_ex(val); ctrl->ldctl_value.bv_val = Z_STRVAL_P(val); - ctrl->ldctl_value.bv_len = Z_STRSIZE_P(val); + ctrl->ldctl_value.bv_len = Z_STRLEN_P(val); } else { ctrl->ldctl_value.bv_val = NULL; ctrl->ldctl_value.bv_len = 0; @@ -2204,7 +2204,7 @@ PHP_FUNCTION(ldap_parse_result) } zval_ptr_dtor(errcode); - ZVAL_INT(errcode, lerrcode); + ZVAL_LONG(errcode, lerrcode); /* Reverse -> fall through */ switch (myargcount) { @@ -2425,7 +2425,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi ZVAL_STRING(&cb_args[1], url); if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(cb_retval)) { convert_to_int_ex(&cb_retval); - retval = Z_IVAL(cb_retval); + retval = Z_LVAL(cb_retval); zval_ptr_dtor(&cb_retval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed"); @@ -2450,7 +2450,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (Z_TYPE_P(callback) == IS_STRING && Z_STRSIZE_P(callback) == 0) { + if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) { /* unregister rebind procedure */ if (!Z_ISUNDEF(ld->rebindproc)) { zval_ptr_dtor(&ld->rebindproc); @@ -2463,10 +2463,10 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* callable? */ if (!zend_is_callable(callback, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); RETURN_FALSE; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); /* register rebind procedure */ if (Z_ISUNDEF(ld->rebindproc)) { @@ -2522,10 +2522,10 @@ PHP_FUNCTION(ldap_escape) char *value, *ignores, *result; int valuelen = 0, ignoreslen = 0, i; size_t resultlen; - php_int_t flags = 0; + zend_long flags = 0; zend_bool map[256] = {0}, havecharlist = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|si", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { return; } @@ -2613,7 +2613,7 @@ PHP_FUNCTION(ldap_8859_to_t61) Inject paged results control*/ PHP_FUNCTION(ldap_control_paged_result) { - php_int_t pagesize; + zend_long pagesize; zend_bool iscritical; zval *link; char *cookie = NULL; @@ -2625,7 +2625,7 @@ PHP_FUNCTION(ldap_control_paged_result) LDAPControl ctrl, *ctrlsp[2]; int rc, myargcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { return; } @@ -2778,7 +2778,7 @@ PHP_FUNCTION(ldap_control_paged_result_response) ldap_controls_free(lserverctrls); if (myargcount == 4) { zval_dtor(estimated); - ZVAL_INT(estimated, lestimated); + ZVAL_LONG(estimated, lestimated); } zval_ptr_dtor(cookie); diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h index 4588c53cd3..944c3dd531 100644 --- a/ext/ldap/php_ldap.h +++ b/ext/ldap/php_ldap.h @@ -38,8 +38,8 @@ PHP_MSHUTDOWN_FUNCTION(ldap); PHP_MINFO_FUNCTION(ldap); ZEND_BEGIN_MODULE_GLOBALS(ldap) - php_int_t num_links; - php_int_t max_links; + zend_long num_links; + zend_long max_links; ZEND_END_MODULE_GLOBALS(ldap) #ifdef ZTS diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 3580891019..8fd661c81d 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -779,51 +779,51 @@ static PHP_MINIT_FUNCTION(libxml) php_libxml_initialize(); - REGISTER_INT_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_DOTTED_VERSION", LIBXML_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_LOADED_VERSION", (char *)xmlParserVersion, CONST_CS | CONST_PERSISTENT); /* For use with loading xml */ - REGISTER_INT_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); #if LIBXML_VERSION >= 20621 - REGISTER_INT_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20703 - REGISTER_INT_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); /* Schema validation options */ #if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 - REGISTER_INT_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); #endif /* Additional constants for use with loading html */ #if LIBXML_VERSION >= 20707 - REGISTER_INT_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20708 - REGISTER_INT_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); #endif /* Error levels */ - REGISTER_INT_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "LibXMLError", NULL); libxmlerror_class_entry = zend_register_internal_class(&ce TSRMLS_CC); @@ -991,9 +991,9 @@ static PHP_FUNCTION(libxml_get_last_error) if (error) { object_init_ex(return_value, libxmlerror_class_entry); - add_property_int(return_value, "level", error->level); - add_property_int(return_value, "code", error->code); - add_property_int(return_value, "column", error->int2); + add_property_long(return_value, "level", error->level); + add_property_long(return_value, "code", error->code); + add_property_long(return_value, "column", error->int2); if (error->message) { add_property_string(return_value, "message", error->message); } else { @@ -1004,7 +1004,7 @@ static PHP_FUNCTION(libxml_get_last_error) } else { add_property_stringl(return_value, "file", "", 0); } - add_property_int(return_value, "line", error->line); + add_property_long(return_value, "line", error->line); } else { RETURN_FALSE; } @@ -1030,9 +1030,9 @@ static PHP_FUNCTION(libxml_get_errors) zval z_error; object_init_ex(&z_error, libxmlerror_class_entry); - add_property_int(&z_error, "level", error->level); - add_property_int(&z_error, "code", error->code); - add_property_int(&z_error, "column", error->int2); + add_property_long(&z_error, "level", error->level); + add_property_long(&z_error, "code", error->code); + add_property_long(&z_error, "column", error->int2); if (error->message) { add_property_string(&z_error, "message", error->message); } else { @@ -1043,7 +1043,7 @@ static PHP_FUNCTION(libxml_get_errors) } else { add_property_stringl(&z_error, "file", "", 0); } - add_property_int(&z_error, "line", error->line); + add_property_long(&z_error, "line", error->line); add_next_index_zval(return_value, &z_error); error = zend_llist_get_next(LIBXML(error_list)); diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index bb0ff70ca1..786825b35e 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -378,7 +378,7 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler) php_stream_rewind(SG(request_info).request_body); post_data_str = php_stream_copy_to_mem(SG(request_info).request_body, PHP_STREAM_COPY_ALL, 0); detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str->val TSRMLS_CC); - STR_RELEASE(post_data_str); + zend_string_release(post_data_str); MBSTRG(http_input_identify) = detected; if (detected) { diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 31b8a6251e..4c78788127 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1443,7 +1443,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) } php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC); - if (Z_STRSIZE(tmp) > 0) { + if (Z_STRLEN(tmp) > 0) { if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) { zval_dtor(&tmp); return FAILURE; @@ -1559,13 +1559,13 @@ PHP_MINIT_FUNCTION(mbstring) sapi_register_post_entries(mbstr_post_entries TSRMLS_CC); } - REGISTER_INT_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); #if HAVE_MBREGEX PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); @@ -1738,14 +1738,14 @@ PHP_FUNCTION(mb_language) if (name == NULL) { RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language))); } else { - zend_string *ini_name = STR_INIT("mbstring.language", sizeof("mbstring.language") - 1, 0); + zend_string *ini_name = zend_string_init("mbstring.language", sizeof("mbstring.language") - 1, 0); if (FAILURE == zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name); RETVAL_FALSE; } else { RETVAL_TRUE; } - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -1938,7 +1938,7 @@ PHP_FUNCTION(mb_detect_order) break; default: convert_to_string_ex(arg1); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1979,25 +1979,25 @@ PHP_FUNCTION(mb_substitute_character) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETURN_STRING("entity"); } else { - RETURN_INT(MBSTRG(current_filter_illegal_substchar)); + RETURN_LONG(MBSTRG(current_filter_illegal_substchar)); } } else { RETVAL_TRUE; switch (Z_TYPE_P(arg1)) { case IS_STRING: - if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { + if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; - } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { + } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; - } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { + } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; } else { convert_to_int_ex(arg1); - if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { + if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2006,9 +2006,9 @@ PHP_FUNCTION(mb_substitute_character) break; default: convert_to_int_ex(arg1); - if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { + if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2106,7 +2106,7 @@ PHP_FUNCTION(mb_output_handler) { char *arg_string; int arg_string_len; - php_int_t arg_status; + zend_long arg_status; mbfl_string string, result; const char *charset; char *p; @@ -2115,7 +2115,7 @@ PHP_FUNCTION(mb_output_handler) unsigned char send_text_mimetype = 0; char *s, *mimetype = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &arg_string, &arg_string_len, &arg_status) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) { return; } @@ -2232,7 +2232,7 @@ PHP_FUNCTION(mb_strlen) n = mbfl_strlen(&string); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2244,7 +2244,7 @@ PHP_FUNCTION(mb_strlen) PHP_FUNCTION(mb_strpos) { int n, reverse = 0; - php_int_t offset; + zend_long offset; mbfl_string haystack, needle; char *enc_name = NULL; int enc_name_len; @@ -2257,7 +2257,7 @@ PHP_FUNCTION(mb_strpos) needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) { return; } @@ -2280,7 +2280,7 @@ PHP_FUNCTION(mb_strpos) n = mbfl_strpos(&haystack, &needle, offset, reverse); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { switch (-n) { case 1: @@ -2330,7 +2330,7 @@ PHP_FUNCTION(mb_strrpos) if (zoffset) { if (Z_TYPE_P(zoffset) == IS_STRING) { enc_name2 = Z_STRVAL_P(zoffset); - enc_name_len2 = Z_STRSIZE_P(zoffset); + enc_name_len2 = Z_STRLEN_P(zoffset); str_flg = 1; if (enc_name2 != NULL) { @@ -2357,14 +2357,14 @@ PHP_FUNCTION(mb_strrpos) if (str_flg) { convert_to_int_ex(zoffset); - offset = Z_IVAL_P(zoffset); + offset = Z_LVAL_P(zoffset); } else { enc_name = enc_name2; enc_name_len = enc_name_len2; } } else { convert_to_int_ex(zoffset); - offset = Z_IVAL_P(zoffset); + offset = Z_LVAL_P(zoffset); } } @@ -2394,7 +2394,7 @@ PHP_FUNCTION(mb_strrpos) n = mbfl_strpos(&haystack, &needle, offset, 1); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2406,14 +2406,14 @@ PHP_FUNCTION(mb_strrpos) PHP_FUNCTION(mb_stripos) { int n; - php_int_t offset; + zend_long offset; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } if (needle.len == 0) { @@ -2423,7 +2423,7 @@ PHP_FUNCTION(mb_stripos) n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2435,21 +2435,21 @@ PHP_FUNCTION(mb_stripos) PHP_FUNCTION(mb_strripos) { int n; - php_int_t offset; + zend_long offset; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2737,7 +2737,7 @@ PHP_FUNCTION(mb_substr_count) n = mbfl_substr_count(&haystack, &needle); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2750,12 +2750,12 @@ PHP_FUNCTION(mb_substr) { size_t argc = ZEND_NUM_ARGS(); char *str, *encoding; - php_int_t from, len; + zend_long from, len; int mblen, str_len, encoding_len; zval *z_len = NULL; mbfl_string string, result, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2778,7 +2778,7 @@ PHP_FUNCTION(mb_substr) len = str_len; } else { convert_to_int_ex(z_len); - len = Z_IVAL_P(z_len); + len = Z_LVAL_P(z_len); } /* measures length */ @@ -2829,7 +2829,7 @@ PHP_FUNCTION(mb_strcut) { size_t argc = ZEND_NUM_ARGS(); char *encoding; - php_int_t from, len; + zend_long from, len; int encoding_len; zval *z_len = NULL; mbfl_string string, result, *ret; @@ -2838,7 +2838,7 @@ PHP_FUNCTION(mb_strcut) string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2854,7 +2854,7 @@ PHP_FUNCTION(mb_strcut) len = string.len; } else { convert_to_int_ex(z_len); - len = Z_IVAL_P(z_len); + len = Z_LVAL_P(z_len); } /* if "from" position is negative, count start position from the end @@ -2920,7 +2920,7 @@ PHP_FUNCTION(mb_strwidth) n = mbfl_strwidth(&string); if (n >= 0) { - RETVAL_INT(n); + RETVAL_LONG(n); } else { RETVAL_FALSE; } @@ -2932,11 +2932,11 @@ PHP_FUNCTION(mb_strwidth) PHP_FUNCTION(mb_strimwidth) { char *str, *trimmarker, *encoding; - php_int_t from, width; + zend_long from, width; int str_len, trimmarker_len, encoding_len; mbfl_string string, result, marker, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -3106,7 +3106,7 @@ PHP_FUNCTION(mb_convert_encoding) n = strlen(Z_STRVAL_P(hash_entry)); _from_encodings = erealloc(_from_encodings, l+n+2); memcpy(_from_encodings + l, ",", 1); - memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRSIZE_P(hash_entry) + 1); + memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRLEN_P(hash_entry) + 1); } else { _from_encodings = estrdup(Z_STRVAL_P(hash_entry)); } @@ -3148,12 +3148,12 @@ PHP_FUNCTION(mb_convert_case) const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; char *str; int str_len, from_encoding_len; - php_int_t case_mode = 0; + zend_long case_mode = 0; char *newstr; size_t ret_len; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|s!", &str, &str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s!", &str, &str_len, &case_mode, &from_encoding, &from_encoding_len) == FAILURE) { return; } @@ -3256,7 +3256,7 @@ PHP_FUNCTION(mb_detect_encoding) break; default: convert_to_string(encoding_list); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRSIZE_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); list = NULL; @@ -3356,13 +3356,13 @@ PHP_FUNCTION(mb_encode_mimeheader) int trans_enc_name_len; char *linefeed = "\r\n"; int linefeed_len; - php_int_t indent = 0; + zend_long indent = 0; mbfl_string_init(&string); string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssi", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { return; } @@ -3579,7 +3579,7 @@ PHP_FUNCTION(mb_convert_variables) break; default: convert_to_string_ex(zfrom_enc); - php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRSIZE_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); + php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); break; } @@ -3636,7 +3636,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRSIZE_P(hash_entry); + string.len = Z_STRLEN_P(hash_entry); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3645,7 +3645,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRSIZE_P(var); + string.len = Z_STRLEN_P(var); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3725,7 +3725,7 @@ detect_end: } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRSIZE_P(hash_entry); + string.len = Z_STRLEN_P(hash_entry); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(hash_entry_ptr); @@ -3738,7 +3738,7 @@ detect_end: } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRSIZE_P(var); + string.len = Z_STRLEN_P(var); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(var); @@ -3815,7 +3815,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) mapsize = 0; ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) { convert_to_int_ex(hash_entry); - *mapelm++ = Z_IVAL_P(hash_entry); + *mapelm++ = Z_LVAL_P(hash_entry); mapsize++; } ZEND_HASH_FOREACH_END(); } @@ -3907,7 +3907,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t } if (state == 0 || state == 1) { - fld_name = STR_INIT(token, token_pos, 0); + fld_name = zend_string_init(token, token_pos, 0); state = 2; } else { @@ -3972,7 +3972,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t case 3: if (crlf_state == -1) { - fld_val = STR_INIT(token, token_pos, 0); + fld_val = zend_string_init(token, token_pos, 0); if (fld_name != NULL && fld_val != NULL) { zval val; @@ -3983,7 +3983,7 @@ static int _php_mbstr_parse_mail_headers(HashTable *ht, const char *str, size_t zend_hash_update(ht, fld_name, &val); - STR_RELEASE(fld_name); + zend_string_release(fld_name); } fld_name = fld_val = NULL; @@ -4019,7 +4019,7 @@ out: state = 3; } if (state == 3) { - fld_val = STR_INIT(token, 0, 0); + fld_val = zend_string_init(token, 0, 0); if (fld_name != NULL && fld_val != NULL) { zval val; @@ -4030,7 +4030,7 @@ out: zend_hash_update(ht, fld_name, &val); - STR_RELEASE(fld_name); + zend_string_release(fld_name); } } return state; @@ -4297,7 +4297,7 @@ PHP_FUNCTION(mb_send_mail) } if (extra_cmd) { - STR_RELEASE(extra_cmd); + zend_string_release(extra_cmd); } if (to_r != to) { @@ -4352,7 +4352,7 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_int(return_value, "func_overload", MBSTRG(func_overload)); + add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); array_init(&row1); @@ -4377,7 +4377,7 @@ PHP_FUNCTION(mb_get_info) add_assoc_string(return_value, "mail_body_encoding", name); } } - add_assoc_int(return_value, "illegal_chars", MBSTRG(illegalchars)); + add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars)); if (MBSTRG(encoding_translation)) { add_assoc_string(return_value, "encoding_translation", "On"); } else { @@ -4404,7 +4404,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { add_assoc_string(return_value, "substitute_character", "entity"); } else { - add_assoc_int(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); + add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); } if (MBSTRG(strict_detection)) { add_assoc_string(return_value, "strict_detection", "On"); @@ -4428,7 +4428,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("func_overload", typ)) { - RETVAL_INT(MBSTRG(func_overload)); + RETVAL_LONG(MBSTRG(func_overload)); } else if (!strcasecmp("func_overload_list", typ)) { if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); @@ -4455,7 +4455,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("illegal_chars", typ)) { - RETVAL_INT(MBSTRG(illegalchars)); + RETVAL_LONG(MBSTRG(illegalchars)); } else if (!strcasecmp("encoding_translation", typ)) { if (MBSTRG(encoding_translation)) { RETVAL_STRING("On"); @@ -4485,7 +4485,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETVAL_STRING("entity"); } else { - RETVAL_INT(MBSTRG(current_filter_illegal_substchar)); + RETVAL_LONG(MBSTRG(current_filter_illegal_substchar)); } } else if (!strcasecmp("strict_detection", typ)) { if (MBSTRG(strict_detection)) { diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index baf0a2d44a..2237a318fe 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -717,13 +717,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) /* don't bother doing an extended regex with just a number */ } - if (!Z_STRVAL_P(arg_pattern) || Z_STRSIZE_P(arg_pattern) == 0) { + if (!Z_STRVAL_P(arg_pattern) || Z_STRLEN_P(arg_pattern) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern"); RETVAL_FALSE; goto out; } - re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRSIZE_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); + re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); if (re == NULL) { RETVAL_FALSE; goto out; @@ -758,7 +758,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (match_len == 0) { match_len = 1; } - RETVAL_INT(match_len); + RETVAL_LONG(match_len); out: if (regs != NULL) { onig_region_free(regs, 1); @@ -855,11 +855,11 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { arg_pattern = Z_STRVAL_P(arg_pattern_zval); - arg_pattern_len = Z_STRSIZE_P(arg_pattern_zval); + arg_pattern_len = Z_STRLEN_P(arg_pattern_zval); } else { /* FIXME: this code is not multibyte aware! */ convert_to_int_ex(arg_pattern_zval); - pat_buf[0] = (char)Z_IVAL_P(arg_pattern_zval); + pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); pat_buf[1] = '\0'; arg_pattern = pat_buf; @@ -947,7 +947,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp /* result of eval */ convert_to_string(&v); - smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRSIZE(v)); + smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v)); /* Clean up */ eval_buf.s->len = 0; zval_dtor(&v); @@ -971,7 +971,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp if (zend_call_function(&arg_replace_fci, &arg_replace_fci_cache TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(retval)) { convert_to_string_ex(&retval); - smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRSIZE(retval)); + smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval)); if (eval_buf.s) { eval_buf.s->len = 0; } @@ -1060,9 +1060,9 @@ PHP_FUNCTION(mb_split) int string_len; int n, err; - php_int_t count = -1; + zend_long count = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) { RETURN_FALSE; } @@ -1209,7 +1209,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) len = 0; if (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING){ str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRSIZE(MBREX(search_str)); + len = Z_STRLEN(MBREX(search_str)); } if (MBREX(search_re) == NULL) { @@ -1245,8 +1245,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) array_init(return_value); beg = MBREX(search_regs)->beg[0]; end = MBREX(search_regs)->end[0]; - add_next_index_int(return_value, beg); - add_next_index_int(return_value, end - beg); + add_next_index_long(return_value, beg); + add_next_index_long(return_value, end - beg); break; case 2: array_init(return_value); @@ -1368,7 +1368,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) array_init(return_value); str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRSIZE(MBREX(search_str)); + len = Z_STRLEN(MBREX(search_str)); n = MBREX(search_regs)->num_regs; for (i = 0; i < n; i++) { beg = MBREX(search_regs)->beg[i]; @@ -1389,7 +1389,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) Get search start position */ PHP_FUNCTION(mb_ereg_search_getpos) { - RETVAL_INT(MBREX(search_pos)); + RETVAL_LONG(MBREX(search_pos)); } /* }}} */ @@ -1397,13 +1397,13 @@ PHP_FUNCTION(mb_ereg_search_getpos) Set search start position */ PHP_FUNCTION(mb_ereg_search_setpos) { - php_int_t position; + zend_long position; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) { return; } - if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRSIZE(MBREX(search_str)))) { + if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRLEN(MBREX(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBREX(search_pos) = 0; RETURN_FALSE; diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 3ae0bb314f..01ee59f3d8 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -386,13 +386,13 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */ le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number); /* modes for mcrypt_??? routines */ - REGISTER_INT_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); /* sources for mcrypt_create_iv */ - REGISTER_INT_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); /* ciphers */ MCRYPT_ENTRY2_2_4(3DES, "tripledes"); @@ -603,7 +603,7 @@ PHP_FUNCTION(mcrypt_generic_init) } } pm->init = 1; - RETVAL_INT(result); + RETVAL_LONG(result); efree(iv_s); efree(key_s); @@ -712,7 +712,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) key_sizes = mcrypt_enc_get_supported_key_sizes(pm->td, &count); for (i = 0; i < count; i++) { - add_index_int(return_value, i, key_sizes[i]); + add_index_long(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); @@ -724,7 +724,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) PHP_FUNCTION(mcrypt_enc_self_test) { MCRYPT_GET_TD_ARG - RETURN_INT(mcrypt_enc_self_test(pm->td)); + RETURN_LONG(mcrypt_enc_self_test(pm->td)); } /* }}} */ @@ -800,7 +800,7 @@ PHP_FUNCTION(mcrypt_enc_is_block_mode) PHP_FUNCTION(mcrypt_enc_get_block_size) { MCRYPT_GET_TD_ARG - RETURN_INT(mcrypt_enc_get_block_size(pm->td)); + RETURN_LONG(mcrypt_enc_get_block_size(pm->td)); } /* }}} */ @@ -809,7 +809,7 @@ PHP_FUNCTION(mcrypt_enc_get_block_size) PHP_FUNCTION(mcrypt_enc_get_key_size) { MCRYPT_GET_TD_ARG - RETURN_INT(mcrypt_enc_get_key_size(pm->td)); + RETURN_LONG(mcrypt_enc_get_key_size(pm->td)); } /* }}} */ @@ -818,7 +818,7 @@ PHP_FUNCTION(mcrypt_enc_get_key_size) PHP_FUNCTION(mcrypt_enc_get_iv_size) { MCRYPT_GET_TD_ARG - RETURN_INT(mcrypt_enc_get_iv_size(pm->td)); + RETURN_LONG(mcrypt_enc_get_iv_size(pm->td)); } /* }}} */ @@ -910,7 +910,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir) - RETURN_INT(mcrypt_module_get_algo_block_size(module, dir)); + RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir)); } /* }}} */ @@ -920,7 +920,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir); - RETURN_INT(mcrypt_module_get_algo_key_size(module, dir)); + RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir)); } /* }}} */ @@ -937,7 +937,7 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes) key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count); for (i = 0; i < count; i++) { - add_index_int(return_value, i, key_sizes[i]); + add_index_long(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); } @@ -1017,7 +1017,7 @@ PHP_FUNCTION(mcrypt_get_key_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_INT(mcrypt_enc_get_key_size(td)); + RETVAL_LONG(mcrypt_enc_get_key_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1046,7 +1046,7 @@ PHP_FUNCTION(mcrypt_get_block_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_INT(mcrypt_enc_get_block_size(td)); + RETVAL_LONG(mcrypt_enc_get_block_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1075,7 +1075,7 @@ PHP_FUNCTION(mcrypt_get_iv_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_INT(mcrypt_enc_get_iv_size(td)); + RETVAL_LONG(mcrypt_enc_get_iv_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1149,7 +1149,7 @@ static char *php_mcrypt_get_key_size_str( smart_str_appends(&str, ", "); } - smart_str_append_int(&str, key_sizes[i]); + smart_str_append_long(&str, key_sizes[i]); } smart_str_appends(&str, " supported"); @@ -1343,7 +1343,7 @@ PHP_FUNCTION(mcrypt_ecb) convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1359,7 +1359,7 @@ PHP_FUNCTION(mcrypt_cbc) convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1375,7 +1375,7 @@ PHP_FUNCTION(mcrypt_cfb) convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1391,7 +1391,7 @@ PHP_FUNCTION(mcrypt_ofb) convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1400,11 +1400,11 @@ PHP_FUNCTION(mcrypt_ofb) PHP_FUNCTION(mcrypt_create_iv) { char *iv; - php_int_t source = URANDOM; - php_int_t size; + zend_long source = URANDOM; + zend_long size; int n = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &size, &source) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) { return; } diff --git a/ext/mcrypt/mcrypt_filter.c b/ext/mcrypt/mcrypt_filter.c index c0b89300a9..698664b236 100644 --- a/ext/mcrypt/mcrypt_filter.c +++ b/ext/mcrypt/mcrypt_filter.c @@ -201,7 +201,7 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) && Z_TYPE_P(tmpzval) == IS_STRING) { key = Z_STRVAL_P(tmpzval); - key_len = Z_STRSIZE_P(tmpzval); + key_len = Z_STRLEN_P(tmpzval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string"); return NULL; @@ -226,11 +226,11 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval } iv = emalloc(iv_len + 1); - if (iv_len <= Z_STRSIZE_P(tmpzval)) { + if (iv_len <= Z_STRLEN_P(tmpzval)) { memcpy(iv, Z_STRVAL_P(tmpzval), iv_len); } else { - memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); - memset(iv + Z_STRSIZE_P(tmpzval), 0, iv_len - Z_STRSIZE_P(tmpzval)); + memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval)); } result = mcrypt_generic_init(mcrypt_module, key, key_len, iv); diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 03dbeca61c..088166913e 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -285,7 +285,7 @@ static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate php_error_docref(NULL TSRMLS_CC, E_WARNING, "message: %s (severity %d)", msgtext, severity); } if (MS_SQL_G(server_message)) { - STR_FREE(MS_SQL_G(server_message)); + zend_string_free(MS_SQL_G(server_message)); MS_SQL_G(server_message) = NULL; } MS_SQL_G(server_message) = estrdup(msgtext); @@ -330,8 +330,8 @@ static void _free_result(mssql_result *result, int free_fields) if (free_fields && result->fields) { for (i=0; i<result->num_fields; i++) { - STR_FREE(result->fields[i].name); - STR_FREE(result->fields[i].column_source); + zend_string_free(result->fields[i].name); + zend_string_free(result->fields[i].column_source); } efree(result->fields); } @@ -424,7 +424,7 @@ static PHP_GINIT_FUNCTION(mssql) mssql_globals->num_persistent = 0; mssql_globals->get_column_content = php_mssql_get_column_content_with_type; - if (cfg_get_int("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { + if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { if (compatibility_mode) { mssql_globals->get_column_content = php_mssql_get_column_content_without_type; } @@ -449,20 +449,20 @@ PHP_MINIT_FUNCTION(mssql) } /* BEGIN MSSQL data types for mssql_bind */ - REGISTER_INT_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); /* END MSSQL data types for mssql_bind */ return SUCCESS; @@ -507,10 +507,10 @@ PHP_RINIT_FUNCTION(mssql) */ PHP_RSHUTDOWN_FUNCTION(mssql) { - STR_FREE(MS_SQL_G(appname)); + zend_string_free(MS_SQL_G(appname)); MS_SQL_G(appname) = NULL; if (MS_SQL_G(server_message)) { - STR_FREE(MS_SQL_G(server_message)); + zend_string_free(MS_SQL_G(server_message)); MS_SQL_G(server_message) = NULL; } return SUCCESS; @@ -773,7 +773,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_IVAL_P(return_value) = link; + Z_LVAL_P(return_value) = link; php_mssql_set_default_link(link TSRMLS_CC); Z_TYPE_P(return_value) = IS_RESOURCE; dbfreelogin(mssql.login); @@ -828,7 +828,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry),NULL)==FAILURE) { efree(hashed_details); @@ -837,7 +837,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_links)++; } efree(hashed_details); - php_mssql_set_default_link(Z_IVAL_P(return_value) TSRMLS_CC); + php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); } /* }}} */ @@ -944,7 +944,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off case SQLINT2: case SQLINT4: case SQLINTN: { - ZVAL_INT(result, (long) anyintcol(offset)); + ZVAL_LONG(result, (long) anyintcol(offset)); break; } case SQLCHAR: @@ -1162,7 +1162,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLINT4: convert_to_int_ex(&bind->zval); /* FIXME this works only on little endian machine !!! */ - Z_IVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); + Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); break; case SQLFLT4: @@ -1179,8 +1179,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLVARCHAR: case SQLTEXT: convert_to_string_ex(&bind->zval); - Z_STRSIZE_P(bind->zval) = dbretlen(mssql_ptr->link,i); - Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRSIZE_P(bind->zval)); + Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i); + Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval)); break; /* TODO binary */ } @@ -1196,7 +1196,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) { if (dbhasretstat(mssql_ptr->link)) { convert_to_int_ex(&bind->zval); - Z_IVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); + Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure has no return value. Nothing was returned into RETVAL"); @@ -1315,7 +1315,7 @@ PHP_FUNCTION(mssql_fetch_batch) result->cur_row=result->num_rows=0; result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC); - RETURN_INT(result->num_rows); + RETURN_LONG(result->num_rows); } /* }}} */ @@ -1407,7 +1407,7 @@ PHP_FUNCTION(mssql_rows_affected) ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, &mssql_link_index, -1, "MS SQL-Link", le_link, le_plink); - RETURN_INT(DBCOUNT(mssql_ptr->link)); + RETURN_LONG(DBCOUNT(mssql_ptr->link)); } /* }}} */ @@ -1468,7 +1468,7 @@ PHP_FUNCTION(mssql_num_rows) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_INT(result->num_rows); + RETURN_LONG(result->num_rows); } /* }}} */ @@ -1485,7 +1485,7 @@ PHP_FUNCTION(mssql_num_fields) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_INT(result->num_fields); + RETURN_LONG(result->num_fields); } /* }}} */ @@ -1518,7 +1518,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); if (MS_SQL_G(server_message)) { - STR_FREE(MS_SQL_G(server_message)); + zend_string_free(MS_SQL_G(server_message)); MS_SQL_G(server_message) = NULL; } @@ -1535,7 +1535,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { data = Z_STRVAL(result->data[result->cur_row][i]); - data_len = Z_STRSIZE(result->data[result->cur_row][i]); + data_len = Z_STRLEN(result->data[result->cur_row][i]); if (result_type & MSSQL_NUM) { add_index_stringl(return_value, i, data, data_len); @@ -1545,12 +1545,12 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) add_assoc_stringl(return_value, result->fields[i].name, data, data_len); } } - else if (Z_TYPE(result->data[result->cur_row][i]) == IS_INT) { + else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { if (result_type & MSSQL_NUM) - add_index_int(return_value, i, Z_IVAL(result->data[result->cur_row][i])); + add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i])); if (result_type & MSSQL_ASSOC) - add_assoc_int(return_value, result->fields[i].name, Z_IVAL(result->data[result->cur_row][i])); + add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i])); } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) { if (result_type & MSSQL_NUM) @@ -1719,9 +1719,9 @@ PHP_FUNCTION(mssql_fetch_field) object_init(return_value); add_property_string(return_value, "name",result->fields[field_offset].name); - add_property_int(return_value, "max_length",result->fields[field_offset].max_length); + add_property_long(return_value, "max_length",result->fields[field_offset].max_length); add_property_string(return_value, "column_source",result->fields[field_offset].column_source); - add_property_int(return_value, "numeric", result->fields[field_offset].numeric); + add_property_long(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -1752,7 +1752,7 @@ PHP_FUNCTION(mssql_field_length) RETURN_FALSE; } - RETURN_INT(result->fields[field_offset].max_length); + RETURN_LONG(result->fields[field_offset].max_length); } /* }}} */ @@ -1878,7 +1878,7 @@ PHP_FUNCTION(mssql_result) } default: convert_to_int_ex(field); - field_offset = Z_IVAL_PP(field); + field_offset = Z_LVAL_PP(field); if (field_offset<0 || field_offset>=result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2043,7 +2043,7 @@ PHP_FUNCTION(mssql_bind) datalen=0; } else { convert_to_string_ex(var); - datalen=Z_STRSIZE_PP(var); + datalen=Z_STRLEN_PP(var); value=(LPBYTE)Z_STRVAL_PP(var); } } else { @@ -2068,7 +2068,7 @@ PHP_FUNCTION(mssql_bind) case SQLINT2: case SQLINT4: convert_to_int_ex(var); - value=(LPBYTE)(&Z_IVAL_PP(var)); + value=(LPBYTE)(&Z_LVAL_PP(var)); break; default: diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 1df53349a8..4276537368 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -80,7 +80,7 @@ static int le_result, le_link, le_plink; #define SAFE_STRING(s) ((s)?(s):"") #if MYSQL_VERSION_ID > 32199 || defined(MYSQL_USE_MYSQLND) -# define mysql_row_length_type php_uint_t +# define mysql_row_length_type zend_ulong # define HAVE_MYSQL_ERRNO #else # define mysql_row_length_type unsigned int @@ -568,15 +568,15 @@ ZEND_MODULE_STARTUP_D(mysql) le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); mysql_module_entry.type = type; - REGISTER_INT_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID >= 40000 - REGISTER_INT_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); #ifndef MYSQL_USE_MYSQLND #if MYSQL_VERSION_ID >= 40000 @@ -727,12 +727,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) char *tmp = NULL, *host = NULL; int user_len = 0, passwd_len = 0, host_len = 0; int port = MYSQL_PORT; - php_int_t client_flags = 0; + zend_long client_flags = 0; php_mysql_conn *mysql = NULL; #if MYSQL_VERSION_ID <= 32230 void (*handler) (int); #endif - php_int_t connect_timeout; + zend_long connect_timeout; zend_string *hashed_details = NULL; zend_bool free_host = 0, new_link = 0; @@ -774,19 +774,19 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information"); } user = php_get_current_user(TSRMLS_C); - hashed_details = STR_ALLOC(sizeof("mysql___") + strlen(user) - 1, 0); + hashed_details = zend_string_alloc(sizeof("mysql___") + strlen(user) - 1, 0); snprintf(hashed_details->val, hashed_details->len + 1, "mysql__%s_", user); client_flags = CLIENT_INTERACTIVE; } else { /* mysql_pconnect does not support new_link parameter */ if (persistent) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!i", &host_and_port, &host_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &client_flags)==FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bi", &host_and_port, &host_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &new_link, &client_flags)==FAILURE) { return; @@ -819,8 +819,8 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) #ifdef CLIENT_MULTI_STATEMENTS client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */ #endif - hashed_details = STR_ALLOC(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) - + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_ZEND_INT - 1, 0); + hashed_details = zend_string_alloc(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) + + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0); hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_" ZEND_INT_FMT, SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); } @@ -863,13 +863,13 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", MySG(num_links)); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } if (MySG(max_persistent) != -1 && MySG(num_persistent) >= MySG(max_persistent)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%pd)", MySG(num_persistent)); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } /* create the link */ @@ -911,7 +911,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MySG(connect_errno) = mysql_errno(mysql->conn); #endif free(mysql); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); @@ -920,14 +920,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZVAL_NEW_PERSISTENT_RES(&new_le, -1, mysql, le_plink); /* avoid bogus memleak report */ - phashed = STR_INIT(hashed_details->val, hashed_details->len, 1); + phashed = zend_string_init(hashed_details->val, hashed_details->len, 1); if (zend_hash_update(&EG(persistent_list), phashed, &new_le) == NULL) { - STR_RELEASE(phashed); + zend_string_release(phashed); free(mysql); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } - STR_RELEASE(phashed); + zend_string_release(phashed); MySG(num_persistent)++; MySG(num_links)++; } else { /* The link is in our list of persistent connections */ @@ -955,7 +955,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Link to server lost, unable to reconnect"); zend_hash_del(&EG(persistent_list), hashed_details); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); @@ -988,7 +988,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) GC_REFCOUNT(link)++; ZVAL_RES(return_value, link); php_mysql_set_default_link(link TSRMLS_CC); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_CLEANUP(); return; } else { @@ -998,7 +998,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", MySG(num_links)); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } @@ -1016,7 +1016,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (!mysql->conn) { MySG(connect_error) = estrdup("OOM"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "OOM"); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); efree(mysql); MYSQL_DO_CONNECT_RETURN_FALSE(); } @@ -1044,7 +1044,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) #ifdef MYSQL_USE_MYSQLND mysqlnd_close(mysql->conn, MYSQLND_CLOSE_DISCONNECTED); #endif - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); efree(mysql); MYSQL_DO_CONNECT_RETURN_FALSE(); } @@ -1057,14 +1057,14 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZVAL_NEW_RES(&new_index_ptr, -1, Z_RES_P(return_value), le_index_ptr); if (zend_hash_update(&EG(regular_list), hashed_details, &new_index_ptr) == NULL) { zval_ptr_dtor(return_value); - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); MYSQL_DO_CONNECT_RETURN_FALSE(); } Z_ADDREF_P(return_value); MySG(num_links)++; } - STR_RELEASE(hashed_details); + zend_string_release(hashed_details); php_mysql_set_default_link(Z_RES_P(return_value) TSRMLS_CC); MYSQL_DO_CONNECT_CLEANUP(); } @@ -1225,7 +1225,7 @@ PHP_FUNCTION(mysql_get_proto_info) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_INT(mysql_get_proto_info(mysql->conn)); + RETURN_LONG(mysql_get_proto_info(mysql->conn)); } /* }}} */ @@ -1299,7 +1299,7 @@ PHP_FUNCTION(mysql_thread_id) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_INT((long) mysql_thread_id(mysql->conn)); + RETURN_LONG((long) mysql_thread_id(mysql->conn)); } /* }}} */ @@ -1802,7 +1802,7 @@ PHP_FUNCTION(mysql_errno) if (!mysql_link) { if (MySG(default_link) == NULL) { if (MySG(connect_error) != NULL){ - RETURN_INT(MySG(connect_errno)); + RETURN_LONG(MySG(connect_errno)); } else { RETURN_FALSE; } @@ -1812,7 +1812,7 @@ PHP_FUNCTION(mysql_errno) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_INT(mysql_errno(mysql->conn)); + RETURN_LONG(mysql_errno(mysql->conn)); } #endif /* }}} */ @@ -1837,7 +1837,7 @@ PHP_FUNCTION(mysql_affected_rows) } /* conversion from int64 to long happing here */ - RETURN_INT((long)mysql_affected_rows(mysql->conn)); + RETURN_LONG((long)mysql_affected_rows(mysql->conn)); } /* }}} */ @@ -1857,7 +1857,7 @@ PHP_FUNCTION(mysql_escape_string) * we don't realloc() down to the real size since it'd most probably not * be worth it */ - escaped_str = STR_ALLOC(str_len * 2, 0); + escaped_str = zend_string_alloc(str_len * 2, 0); escaped_str->len = mysql_escape_string(escaped_str->val, str, str_len); php_error_docref("function.mysql-real-escape-string" TSRMLS_CC, E_DEPRECATED, "This function is deprecated; use mysql_real_escape_string() instead."); @@ -1891,7 +1891,7 @@ PHP_FUNCTION(mysql_real_escape_string) * we don't realloc() down to the real size since it'd most probably not * be worth it */ - new_str = STR_ALLOC(str_len * 2, 0); + new_str = zend_string_alloc(str_len * 2, 0); new_str->len = mysql_real_escape_string(mysql->conn, new_str->val, str, str_len); RETURN_NEW_STR(new_str); @@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_insert_id) } /* conversion from int64 to long happing here */ - RETURN_INT((long)mysql_insert_id(mysql->conn)); + RETURN_LONG((long)mysql_insert_id(mysql->conn)); } /* }}} */ @@ -1927,7 +1927,7 @@ PHP_FUNCTION(mysql_insert_id) PHP_FUNCTION(mysql_result) { zval *result, *field=NULL; - php_int_t row; + zend_long row; MYSQL_RES *mysql_result; #ifndef MYSQL_USE_MYSQLND MYSQL_ROW sql_row; @@ -1940,7 +1940,7 @@ johannes TODO: Do 2 zend_parse_parameters calls instead of type "z" and switch below Q: String or long first? */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) { return; } @@ -1964,7 +1964,7 @@ Q: String or long first? field_name = estrdup(tmp + 1); } else { table_name = NULL; - field_name = estrndup(Z_STRVAL_P(field),Z_STRSIZE_P(field)); + field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field)); } mysql_field_seek(mysql_result, 0); while ((tmp_field = mysql_fetch_field(mysql_result))) { @@ -1993,7 +1993,7 @@ Q: String or long first? break; default: convert_to_int_ex(field); - field_offset = Z_IVAL_P(field); + field_offset = Z_LVAL_P(field); if (field_offset < 0 || field_offset >= (int)mysql_num_fields(mysql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2040,7 +2040,7 @@ PHP_FUNCTION(mysql_num_rows) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); /* conversion from int64 to long happing here */ - RETURN_INT((long) mysql_num_rows(mysql_result)); + RETURN_LONG((long) mysql_num_rows(mysql_result)); } /* }}} */ @@ -2057,13 +2057,13 @@ PHP_FUNCTION(mysql_num_fields) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); - RETURN_INT(mysql_num_fields(mysql_result)); + RETURN_LONG(mysql_num_fields(mysql_result)); } /* }}} */ /* {{{ php_mysql_fetch_hash */ -static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int expected_args, int into_object) +static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int expected_args, int into_object) { MYSQL_RES *mysql_result; zval *res, *ctor_params = NULL; @@ -2096,7 +2096,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_ } else #endif { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &res, &result_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &result_type) == FAILURE) { return; } if (!result_type) { @@ -2271,10 +2271,10 @@ PHP_FUNCTION(mysql_fetch_assoc) PHP_FUNCTION(mysql_data_seek) { zval *result; - php_int_t offset; + zend_long offset; MYSQL_RES *mysql_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset)) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset)) { return; } @@ -2312,7 +2312,7 @@ PHP_FUNCTION(mysql_fetch_lengths) num_fields = mysql_num_fields(mysql_result); for (i=0; i<num_fields; i++) { - add_index_int(return_value, i, lengths[i]); + add_index_long(return_value, i, lengths[i]); } } /* }}} */ @@ -2398,11 +2398,11 @@ static char *php_mysql_get_field_name(int field_type) PHP_FUNCTION(mysql_fetch_field) { zval *result; - php_int_t field=0; + zend_long field=0; MYSQL_RES *mysql_result; const MYSQL_FIELD *mysql_field; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &field) == FAILURE) { return; } @@ -2421,22 +2421,22 @@ PHP_FUNCTION(mysql_fetch_field) object_init(return_value); #if MYSQL_USE_MYSQLND - add_property_str(return_value, "name", STR_COPY(mysql_field->sname)); + add_property_str(return_value, "name", zend_string_copy(mysql_field->sname)); #else add_property_stringl(return_value, "name", (mysql_field->name?mysql_field->name:""), mysql_field->name_length); #endif add_property_stringl(return_value, "table", (mysql_field->table?mysql_field->table:""), mysql_field->table_length); add_property_stringl(return_value, "def", (mysql_field->def?mysql_field->def:""), mysql_field->def_length); - add_property_int(return_value, "max_length", mysql_field->max_length); - add_property_int(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); - add_property_int(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); - add_property_int(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); - add_property_int(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_int(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); - add_property_int(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); + add_property_long(return_value, "max_length", mysql_field->max_length); + add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); + add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); + add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); + add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); + add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); + add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type)); - add_property_int(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); - add_property_int(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); + add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); + add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); } /* }}} */ @@ -2445,10 +2445,10 @@ PHP_FUNCTION(mysql_fetch_field) PHP_FUNCTION(mysql_field_seek) { zval *result; - php_int_t offset; + zend_long offset; MYSQL_RES *mysql_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset) == FAILURE) { return; } ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); @@ -2473,13 +2473,13 @@ PHP_FUNCTION(mysql_field_seek) static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; - php_int_t field; + zend_long field; MYSQL_RES *mysql_result; const MYSQL_FIELD *mysql_field = {0}; char buf[512]; int len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) { return; } @@ -2497,7 +2497,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_MYSQL_FIELD_NAME: #ifdef MYSQL_USE_MYSQLND - RETVAL_STR(STR_COPY(mysql_field->sname)); + RETVAL_STR(zend_string_copy(mysql_field->sname)); #else RETVAL_STRING(mysql_field->name); #endif @@ -2506,7 +2506,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) RETVAL_STRING(mysql_field->table); break; case PHP_MYSQL_FIELD_LEN: - RETVAL_INT(mysql_field->length); + RETVAL_LONG(mysql_field->length); break; case PHP_MYSQL_FIELD_TYPE: RETVAL_STRING(php_mysql_get_field_name(mysql_field->type)); diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h index 0f4dbec110..c39e5b25af 100644 --- a/ext/mysql/php_mysql_structs.h +++ b/ext/mysql/php_mysql_structs.h @@ -112,18 +112,18 @@ PHP_FUNCTION(mysql_set_charset); ZEND_BEGIN_MODULE_GLOBALS(mysql) zend_resource *default_link; - php_int_t num_links,num_persistent; - php_int_t max_links,max_persistent; - php_int_t allow_persistent; - php_int_t default_port; + zend_long num_links,num_persistent; + zend_long max_links,max_persistent; + zend_long allow_persistent; + zend_long default_port; char *default_host, *default_user, *default_password; char *default_socket; char *connect_error; - php_int_t connect_errno; - php_int_t connect_timeout; - php_int_t result_allocated; - php_int_t trace_mode; - php_int_t allow_local_infile; + zend_long connect_errno; + zend_long connect_timeout; + zend_long result_allocated; + zend_long trace_mode; + zend_long allow_local_infile; ZEND_END_MODULE_GLOBALS(mysql) #ifdef ZTS diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index b270cf2748..0ac8f2757b 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -185,7 +185,7 @@ void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC) /* {{{ php_clear_mysql */ void php_clear_mysql(MY_MYSQL *mysql) { if (mysql->hash_key) { - STR_RELEASE(mysql->hash_key); + zend_string_release(mysql->hash_key); mysql->hash_key = NULL; } if (!Z_ISUNDEF(mysql->li_read)) { @@ -375,11 +375,11 @@ void mysqli_write_property(zval *object, zval *member, zval *value, void **cache void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysqli_read_t r_func, mysqli_write_t w_func TSRMLS_DC) { mysqli_prop_handler p; - p.name = STR_INIT(pname, pname_len, 1); + p.name = zend_string_init(pname, pname_len, 1); p.read_func = (r_func) ? r_func : mysqli_read_na; p.write_func = (w_func) ? w_func : mysqli_write_na; zend_hash_add_mem(h, p.name, &p, sizeof(mysqli_prop_handler)); - STR_RELEASE(p.name); + zend_string_release(p.name); } /* }}} */ @@ -612,7 +612,7 @@ PHP_MINIT_FUNCTION(mysqli) mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); #endif mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_int(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED TSRMLS_CC); REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, mysqli_driver_methods); @@ -694,179 +694,179 @@ PHP_MINIT_FUNCTION(mysqli) zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties); /* mysqli_options */ - REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); #if defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MYSQLND_STRING_TO_INT_CONVERSION - REGISTER_INT_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); #endif /* mysqli_real_connect flags */ - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_query */ - REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); #if defined (MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_fetch_assoc */ - REGISTER_INT_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); /* for mysqli_stmt_set_attr */ - REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); #endif /* column information */ - REGISTER_INT_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); #endif #if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND) - REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); /* bind support */ - REGISTER_INT_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); #ifdef MYSQL_DATA_TRUNCATED - REGISTER_INT_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); #endif /* reporting */ - REGISTER_INT_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); /* We use non-nested macros with expansion, as VC has problems */ #ifdef MYSQLI_USE_MYSQLND - REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); #else #ifdef DBUG_ON - REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); #endif #endif - REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); #ifdef SERVER_QUERY_WAS_SLOW - REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); #endif #ifdef SERVER_PS_OUT_PARAMS - REGISTER_INT_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); #ifdef REFRESH_BACKUP_LOG - REGISTER_INT_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); #ifdef MYSQLI_USE_MYSQLND @@ -884,7 +884,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli) #ifndef MYSQLI_USE_MYSQLND #if MYSQL_VERSION_ID >= 40000 #ifdef PHP_WIN32 - php_uint_t client_ver = mysql_get_client_version(); + zend_ulong client_ver = mysql_get_client_version(); /* Can't call mysql_server_end() multiple times prior to 5.0.46 on Windows. PHP bug#41350 MySQL bug#25621 @@ -1105,7 +1105,7 @@ PHP_FUNCTION(mysqli_result_construct) MYSQL_RES *result = NULL; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - php_int_t resmode = MYSQLI_STORE_RESULT; + zend_long resmode = MYSQLI_STORE_RESULT; switch (ZEND_NUM_ARGS()) { case 1: @@ -1114,7 +1114,7 @@ PHP_FUNCTION(mysqli_result_construct) } break; case 2: - if (zend_parse_parameters(2 TSRMLS_CC, "Oi", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) { + if (zend_parse_parameters(2 TSRMLS_CC, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) { return; } break; @@ -1149,13 +1149,13 @@ PHP_FUNCTION(mysqli_result_construct) /* {{{ php_mysqli_fetch_into_hash_aux */ -void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC) +void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype TSRMLS_DC) { #if !defined(MYSQLI_USE_MYSQLND) MYSQL_ROW row; unsigned int i; MYSQL_FIELD *fields; - php_uint_t *field_len; + zend_ulong *field_len; if (!(row = mysql_fetch_row(result))) { RETURN_NULL(); @@ -1238,7 +1238,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags { MYSQL_RES *result; zval *mysql_result; - php_int_t fetchtype; + zend_long fetchtype; zval *ctor_params = NULL; zend_class_entry *ce = NULL; @@ -1266,7 +1266,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags fetchtype = override_flags; } else { fetchtype = MYSQLI_BOTH; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) { return; } } diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index d2567ae1b4..7b7f7e582b 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -152,9 +152,9 @@ PHP_FUNCTION(mysqli_affected_rows) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - RETURN_INT(-1); + RETURN_LONG(-1); } - MYSQLI_RETURN_INT_INT(rc); + MYSQLI_RETURN_LONG_INT(rc); } /* }}} */ @@ -218,7 +218,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in #elif SIZEOF_ZEND_INT==4 bind[ofs].buffer_type = MYSQL_TYPE_LONG; #endif - bind[ofs].buffer = &Z_IVAL_P(param); + bind[ofs].buffer = &Z_LVAL_P(param); bind[ofs].is_null = &stmt->param.is_null[ofs]; break; @@ -326,7 +326,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param) zval *mysql_stmt; char *types; int types_len; - php_uint_t rc; + zend_ulong rc; /* calculate and check number of parameters */ if (argc < 2) { @@ -391,8 +391,8 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un MYSQL_BIND *bind; int i, ofs; int var_cnt = argc - start; - php_int_t col_type; - php_uint_t rc; + zend_long col_type; + zend_ulong rc; /* prevent leak if variables are already bound */ if (stmt->result.var_cnt) { @@ -443,7 +443,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un case MYSQL_TYPE_LONG: case MYSQL_TYPE_INT24: case MYSQL_TYPE_YEAR: - stmt->result.buf[ofs].type = IS_INT; + stmt->result.buf[ofs].type = IS_LONG; /* don't set stmt->result.buf[ofs].buflen to 0, we used ecalloc */ stmt->result.buf[ofs].val = (char *)emalloc(sizeof(int)); bind[ofs].buffer_type = MYSQL_TYPE_LONG; @@ -488,7 +488,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un /* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */ my_bool tmp; #else - php_uint_t tmp = 0; + zend_ulong tmp = 0; #endif stmt->result.buf[ofs].type = IS_STRING; /* @@ -578,7 +578,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result) zval *args; int argc = ZEND_NUM_ARGS(); int start = 1; - php_uint_t rc; + zend_ulong rc; MY_STMT *stmt; zval *mysql_stmt; @@ -624,7 +624,7 @@ PHP_FUNCTION(mysqli_change_user) zval *mysql_link = NULL; char *user, *password, *dbname; int user_len, password_len, dbname_len; - php_uint_t rc; + zend_ulong rc; #if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET) const CHARSET_INFO * old_charset; #endif @@ -752,11 +752,11 @@ PHP_FUNCTION(mysqli_commit) { MY_MYSQL *mysql; zval *mysql_link; - php_int_t flags = TRANS_COR_NO_OPT; + zend_long flags = TRANS_COR_NO_OPT; char * name = NULL; int name_len = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -778,9 +778,9 @@ PHP_FUNCTION(mysqli_data_seek) { MYSQL_RES *result; zval *mysql_result; - php_int_t offset; + zend_long offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { return; } @@ -843,7 +843,7 @@ PHP_FUNCTION(mysqli_errno) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_errno(mysql->mysql)); + RETURN_LONG(mysql_errno(mysql->mysql)); } /* }}} */ @@ -911,7 +911,7 @@ PHP_FUNCTION(mysqli_stmt_execute) case MYSQL_TYPE_VAR_STRING: convert_to_string_ex(param); stmt->stmt->params[i].buffer = Z_STRVAL_P(param); - stmt->stmt->params[i].buffer_length = Z_STRSIZE_P(param); + stmt->stmt->params[i].buffer_length = Z_STRLEN_P(param); break; case MYSQL_TYPE_DOUBLE: convert_to_double_ex(param); @@ -920,7 +920,7 @@ PHP_FUNCTION(mysqli_stmt_execute) case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONG: convert_to_int_ex(param); - stmt->stmt->params[i].buffer = &Z_IVAL_P(param); + stmt->stmt->params[i].buffer = &Z_LVAL_P(param); break; default: break; @@ -951,7 +951,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) MY_STMT *stmt; zval *mysql_stmt; unsigned int i; - php_uint_t ret; + zend_ulong ret; unsigned int uval; my_ulonglong llval; @@ -990,7 +990,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) zval_ptr_dtor(result); if (!stmt->result.is_null[i]) { switch (stmt->result.buf[i].type) { - case IS_INT: + case IS_LONG: if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG) && (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)) { @@ -1015,9 +1015,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) #endif } if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) { - ZVAL_INT(result, *(unsigned int *)stmt->result.buf[i].val); + ZVAL_LONG(result, *(unsigned int *)stmt->result.buf[i].val); } else { - ZVAL_INT(result, *(int *)stmt->result.buf[i].val); + ZVAL_LONG(result, *(int *)stmt->result.buf[i].val); } break; case IS_DOUBLE: @@ -1063,7 +1063,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) snprintf(tmp, sizeof(tmp), (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval); ZVAL_STRING(result, tmp); } else { - ZVAL_INT(result, llval); + ZVAL_LONG(result, llval); } } else { #if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 @@ -1149,7 +1149,7 @@ PHP_FUNCTION(mysqli_stmt_fetch) static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC) { #ifdef MYSQLI_USE_MYSQLND - add_property_str(value, "name", STR_COPY(field->sname)); + add_property_str(value, "name", zend_string_copy(field->sname)); #else add_property_stringl(value, "name",(field->name ? field->name : ""), field->name_length); #endif @@ -1166,12 +1166,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML */ add_property_string(value, "catalog", "def"); - add_property_int(value, "max_length", field->max_length); - add_property_int(value, "length", field->length); - add_property_int(value, "charsetnr", field->charsetnr); - add_property_int(value, "flags", field->flags); - add_property_int(value, "type", field->type); - add_property_int(value, "decimals", field->decimals); + add_property_long(value, "max_length", field->max_length); + add_property_long(value, "length", field->length); + add_property_long(value, "charsetnr", field->charsetnr); + add_property_long(value, "flags", field->flags); + add_property_long(value, "type", field->type); + add_property_long(value, "decimals", field->decimals); } /* }}} */ @@ -1234,15 +1234,15 @@ PHP_FUNCTION(mysqli_fetch_field_direct) MYSQL_RES *result; zval *mysql_result; const MYSQL_FIELD *field; - php_int_t offset; + zend_long offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - if (offset < 0 || offset >= (php_int_t) mysql_num_fields(result)) { + if (offset < 0 || offset >= (zend_long) mysql_num_fields(result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset"); RETURN_FALSE; } @@ -1263,7 +1263,7 @@ PHP_FUNCTION(mysqli_fetch_lengths) MYSQL_RES *result; zval *mysql_result; unsigned int i; - php_uint_t *ret; + zend_ulong *ret; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { return; @@ -1278,7 +1278,7 @@ PHP_FUNCTION(mysqli_fetch_lengths) array_init(return_value); for (i = 0; i < mysql_num_fields(result); i++) { - add_index_int(return_value, i, ret[i]); + add_index_long(return_value, i, ret[i]); } } /* }}} */ @@ -1304,7 +1304,7 @@ PHP_FUNCTION(mysqli_field_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_field_count(mysql->mysql)); + RETURN_LONG(mysql_field_count(mysql->mysql)); } /* }}} */ @@ -1315,9 +1315,9 @@ PHP_FUNCTION(mysqli_field_seek) { MYSQL_RES *result; zval *mysql_result; - php_int_t fieldnr; + zend_long fieldnr; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); @@ -1344,7 +1344,7 @@ PHP_FUNCTION(mysqli_field_tell) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_INT(mysql_field_tell(result)); + RETURN_LONG(mysql_field_tell(result)); } /* }}} */ @@ -1380,7 +1380,7 @@ PHP_FUNCTION(mysqli_get_client_info) Get MySQL client info */ PHP_FUNCTION(mysqli_get_client_version) { - RETURN_INT((php_int_t)mysql_get_client_version()); + RETURN_LONG((zend_long)mysql_get_client_version()); } /* }}} */ @@ -1414,7 +1414,7 @@ PHP_FUNCTION(mysqli_get_proto_info) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_get_proto_info(mysql->mysql)); + RETURN_LONG(mysql_get_proto_info(mysql->mysql)); } /* }}} */ @@ -1450,7 +1450,7 @@ PHP_FUNCTION(mysqli_get_server_version) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_get_server_version(mysql->mysql)); + RETURN_LONG(mysql_get_server_version(mysql->mysql)); } /* }}} */ @@ -1540,7 +1540,7 @@ PHP_FUNCTION(mysqli_insert_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); rc = mysql_insert_id(mysql->mysql); - MYSQLI_RETURN_INT_INT(rc) + MYSQLI_RETURN_LONG_INT(rc) } /* }}} */ @@ -1550,9 +1550,9 @@ PHP_FUNCTION(mysqli_kill) { MY_MYSQL *mysql; zval *mysql_link; - php_int_t processid; + zend_long processid; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -1658,7 +1658,7 @@ PHP_FUNCTION(mysqli_num_fields) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_INT(mysql_num_fields(result)); + RETURN_LONG(mysql_num_fields(result)); } /* }}} */ @@ -1676,10 +1676,10 @@ PHP_FUNCTION(mysqli_num_rows) if (mysqli_result_is_unbuffered_and_not_everything_is_fetched(result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); - RETURN_INT(0); + RETURN_LONG(0); } - MYSQLI_RETURN_INT_INT(mysql_num_rows(result)); + MYSQLI_RETURN_LONG_INT(mysql_num_rows(result)); } /* }}} */ @@ -1725,12 +1725,12 @@ static int mysqli_options_get_option_zval_type(int option) case MYSQL_OPT_COMPRESS: #endif /* mysqlnd @ PHP 5.3.2 */ #ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT - REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif /* MySQL 5.1.1., mysqlnd @ PHP 5.3.3 */ #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS: #endif - return IS_INT; + return IS_LONG; #ifdef MYSQL_SHARED_MEMORY_BASE_NAME case MYSQL_SHARED_MEMORY_BASE_NAME: @@ -1761,12 +1761,12 @@ PHP_FUNCTION(mysqli_options) MY_MYSQL *mysql; zval *mysql_link = NULL; zval *mysql_value; - php_int_t mysql_option; + zend_long mysql_option; unsigned int l_value; - php_int_t ret; + zend_long ret; int expected_type; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED); @@ -1786,7 +1786,7 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: convert_to_string_ex(mysql_value); break; - case IS_INT: + case IS_LONG: convert_to_int_ex(mysql_value); break; default: @@ -1797,8 +1797,8 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_P(mysql_value)); break; - case IS_INT: - l_value = Z_IVAL_P(mysql_value); + case IS_LONG: + l_value = Z_LVAL_P(mysql_value); ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value); break; default: @@ -1816,7 +1816,7 @@ PHP_FUNCTION(mysqli_ping) { MY_MYSQL *mysql; zval *mysql_link; - php_int_t rc; + zend_long rc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -1962,9 +1962,9 @@ PHP_FUNCTION(mysqli_real_escape_string) { } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - newstr = STR_ALLOC(2 * escapestr_len, 0); + newstr = zend_string_alloc(2 * escapestr_len, 0); newstr->len = mysql_real_escape_string(mysql->mysql, newstr->val, escapestr, escapestr_len); - newstr = STR_REALLOC(newstr, newstr->len, 0); + newstr = zend_string_realloc(newstr, newstr->len, 0); RETURN_STR(newstr); } @@ -1976,11 +1976,11 @@ PHP_FUNCTION(mysqli_rollback) { MY_MYSQL *mysql; zval *mysql_link; - php_int_t flags = TRANS_COR_NO_OPT; + zend_long flags = TRANS_COR_NO_OPT; char * name = NULL; int name_len = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -2003,10 +2003,10 @@ PHP_FUNCTION(mysqli_stmt_send_long_data) MY_STMT *stmt; zval *mysql_stmt; char *data; - php_int_t param_nr; + zend_long param_nr; int data_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); @@ -2037,9 +2037,9 @@ PHP_FUNCTION(mysqli_stmt_affected_rows) rc = mysql_stmt_affected_rows(stmt->stmt); if (rc == (my_ulonglong) -1) { - RETURN_INT(-1); + RETURN_LONG(-1); } - MYSQLI_RETURN_INT_INT(rc) + MYSQLI_RETURN_LONG_INT(rc) } /* }}} */ @@ -2069,9 +2069,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek) { MY_STMT *stmt; zval *mysql_stmt; - php_int_t offset; + zend_long offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) { return; } if (offset < 0) { @@ -2097,7 +2097,7 @@ PHP_FUNCTION(mysqli_stmt_field_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_stmt_field_count(stmt->stmt)); + RETURN_LONG(mysql_stmt_field_count(stmt->stmt)); } /* }}} */ @@ -2131,7 +2131,7 @@ PHP_FUNCTION(mysqli_stmt_insert_id) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_insert_id(stmt->stmt); - MYSQLI_RETURN_INT_INT(rc) + MYSQLI_RETURN_LONG_INT(rc) } /* }}} */ @@ -2147,7 +2147,7 @@ PHP_FUNCTION(mysqli_stmt_param_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_stmt_param_count(stmt->stmt)); + RETURN_LONG(mysql_stmt_param_count(stmt->stmt)); } /* }}} */ @@ -2186,7 +2186,7 @@ PHP_FUNCTION(mysqli_stmt_num_rows) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_num_rows(stmt->stmt); - MYSQLI_RETURN_INT_INT(rc) + MYSQLI_RETURN_LONG_INT(rc) } /* }}} */ @@ -2296,9 +2296,9 @@ PHP_FUNCTION(mysqli_refresh) { MY_MYSQL *mysql; zval *mysql_link = NULL; - php_int_t options; + zend_long options; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED); @@ -2316,15 +2316,15 @@ PHP_FUNCTION(mysqli_stmt_attr_set) { MY_STMT *stmt; zval *mysql_stmt; - php_int_t mode_in; + zend_long mode_in; #if MYSQL_VERSION_ID >= 50107 my_bool mode_b; #endif - php_uint_t mode; - php_int_t attr; + zend_ulong mode; + zend_long attr; void *mode_p; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); @@ -2363,11 +2363,11 @@ PHP_FUNCTION(mysqli_stmt_attr_get) { MY_STMT *stmt; zval *mysql_stmt; - php_uint_t value = 0; - php_int_t attr; + zend_ulong value = 0; + zend_long attr; int rc; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); @@ -2380,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get) if (attr == STMT_ATTR_UPDATE_MAX_LENGTH) value = *((my_bool *)&value); #endif - RETURN_INT((php_uint_t)value); + RETURN_LONG((zend_ulong)value); } /* }}} */ @@ -2396,7 +2396,7 @@ PHP_FUNCTION(mysqli_stmt_errno) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); - RETURN_INT(mysql_stmt_errno(stmt->stmt)); + RETURN_LONG(mysql_stmt_errno(stmt->stmt)); } /* }}} */ @@ -2580,10 +2580,10 @@ PHP_FUNCTION(mysqli_store_result) MYSQL_RES *result; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - php_int_t flags = 0; + zend_long flags = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -2619,7 +2619,7 @@ PHP_FUNCTION(mysqli_thread_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT((php_int_t) mysql_thread_id(mysql->mysql)); + RETURN_LONG((zend_long) mysql_thread_id(mysql->mysql)); } /* }}} */ @@ -2672,7 +2672,7 @@ PHP_FUNCTION(mysqli_warning_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_INT(mysql_warning_count(mysql->mysql)); + RETURN_LONG(mysql_warning_count(mysql->mysql)); } /* }}} */ diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c index a895fd0bae..cb8a477be4 100644 --- a/ext/mysqli/mysqli_driver.c +++ b/ext/mysqli/mysqli_driver.c @@ -39,21 +39,21 @@ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ #define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_IVAL_P(value) > 0; \ + MyG(value) = Z_LVAL_P(value) > 0; \ return SUCCESS; \ } \ #define MAP_PROPERTY_MYG_LONG_READ(name, value) \ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ { \ - ZVAL_INT(retval, MyG(value)); \ + ZVAL_LONG(retval, MyG(value)); \ return retval; \ } \ #define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_IVAL_P(value); \ + MyG(value) = Z_LVAL_P(value); \ return SUCCESS; \ } \ @@ -74,7 +74,7 @@ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ /* {{{ property driver_report_write */ static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC) { - MyG(report_mode) = Z_IVAL_P(value); + MyG(report_mode) = Z_LVAL_P(value); /*FIXME*/ /* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); */ return SUCCESS; @@ -96,7 +96,7 @@ static zval *driver_embedded_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_client_version_read */ static zval *driver_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_INT(retval, MYSQL_VERSION_ID); + ZVAL_LONG(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -112,7 +112,7 @@ static zval *driver_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_driver_version_read */ static zval *driver_driver_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_INT(retval, MYSQLI_VERSION_ID); + ZVAL_LONG(retval, MYSQLI_VERSION_ID); return retval; } /* }}} */ diff --git a/ext/mysqli/mysqli_embedded.c b/ext/mysqli/mysqli_embedded.c index 34d0b6fa78..898287d3fb 100644 --- a/ext/mysqli/mysqli_embedded.c +++ b/ext/mysqli/mysqli_embedded.c @@ -32,7 +32,7 @@ PHP_FUNCTION(mysqli_embedded_server_start) { #ifdef HAVE_EMBEDDED_MYSQLI - php_int_t start; + zend_long start; zval *args; zval *grps; @@ -42,7 +42,7 @@ PHP_FUNCTION(mysqli_embedded_server_start) HashPosition pos; int index, rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iaa", &start, &args, &grps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "laa", &start, &args, &grps) == FAILURE) { return; } diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c index 191a16ce31..30ed75ddb7 100644 --- a/ext/mysqli/mysqli_exception.c +++ b/ext/mysqli/mysqli_exception.c @@ -68,7 +68,7 @@ void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char } efree(message); - zend_update_property_int(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); + zend_update_property_long(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); zend_throw_exception_object(&sql_ex TSRMLS_CC); } diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 6b010f0b16..0acac7fa1f 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -42,7 +42,7 @@ /* {{{ php_mysqli_set_error */ -static void php_mysqli_set_error(php_int_t mysql_errno, char *mysql_err TSRMLS_DC) +static void php_mysqli_set_error(zend_long mysql_errno, char *mysql_err TSRMLS_DC) { MyG(error_no) = mysql_errno; if (MyG(error_msg)) { @@ -64,7 +64,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0; zend_bool persistent = FALSE; - php_int_t port = 0, flags = 0; + zend_long port = 0, flags = 0; zend_string *hash_key = NULL; zend_bool new_connection = FALSE; zend_resource *le; @@ -87,7 +87,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne hostname = username = dbname = passwd = socket = NULL; if (!is_real_connect) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssis", &hostname, &hostname_len, &username, &username_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) { return; } @@ -105,7 +105,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */ } else { /* We have flags too */ - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ssssisi", &object, mysqli_link_class_entry, + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &object, mysqli_link_class_entry, &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len, &flags) == FAILURE) { return; @@ -291,7 +291,7 @@ end: err: if (mysql->hash_key) { - STR_RELEASE(mysql->hash_key); + zend_string_release(mysql->hash_key); mysql->hash_key = NULL; mysql->persistent = FALSE; } @@ -321,7 +321,7 @@ PHP_FUNCTION(mysqli_link_construct) Returns the numerical value of the error message from last connect command */ PHP_FUNCTION(mysqli_connect_errno) { - RETURN_INT(MyG(error_no)); + RETURN_LONG(MyG(error_no)); } /* }}} */ @@ -360,9 +360,9 @@ PHP_FUNCTION(mysqli_fetch_all) { MYSQL_RES *result; zval *mysql_result; - php_int_t mode = MYSQLND_FETCH_NUM; + zend_long mode = MYSQLND_FETCH_NUM; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); @@ -428,7 +428,7 @@ PHP_FUNCTION(mysqli_error_list) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -438,7 +438,7 @@ PHP_FUNCTION(mysqli_error_list) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(return_value, &single_error); @@ -469,7 +469,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -479,7 +479,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(return_value, &single_error); @@ -549,9 +549,9 @@ PHP_FUNCTION(mysqli_query) MYSQL_RES *result = NULL; char *query = NULL; int query_len; - php_int_t resultmode = MYSQLI_STORE_RESULT; + zend_long resultmode = MYSQLI_STORE_RESULT; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } @@ -750,11 +750,11 @@ PHP_FUNCTION(mysqli_poll) { zval *r_array, *e_array, *dont_poll_array; MYSQLND **new_r_array = NULL, **new_e_array = NULL, **new_dont_poll_array = NULL; - php_int_t sec = 0, usec = 0; + zend_long sec = 0, usec = 0; enum_func_status ret; int desc_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!ai|i", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) { return; } if (sec < 0 || usec < 0) { @@ -795,7 +795,7 @@ PHP_FUNCTION(mysqli_poll) efree(new_e_array); } if (ret == PASS) { - RETURN_INT(desc_num); + RETURN_LONG(desc_num); } else { RETURN_FALSE; } @@ -1009,10 +1009,10 @@ PHP_FUNCTION(mysqli_get_charset) add_property_string(return_value, "charset", (name) ? (char *)name : ""); add_property_string(return_value, "collation",(collation) ? (char *)collation : ""); add_property_string(return_value, "dir", (dir) ? (char *)dir : ""); - add_property_int(return_value, "min_length", minlength); - add_property_int(return_value, "max_length", maxlength); - add_property_int(return_value, "number", number); - add_property_int(return_value, "state", state); + add_property_long(return_value, "min_length", minlength); + add_property_long(return_value, "max_length", maxlength); + add_property_long(return_value, "number", number); + add_property_long(return_value, "state", state); add_property_string(return_value, "comment", (comment) ? (char *)comment : ""); } /* }}} */ @@ -1076,12 +1076,12 @@ PHP_FUNCTION(mysqli_begin_transaction) { MY_MYSQL *mysql; zval *mysql_link; - php_int_t flags = TRANS_START_NO_OPT; + zend_long flags = TRANS_START_NO_OPT; char * name = NULL; int name_len = -1; zend_bool err = FALSE; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -1190,9 +1190,9 @@ PHP_FUNCTION(mysqli_get_links_stats) return; } array_init(return_value); - add_assoc_int_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); - add_assoc_int_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); - add_assoc_int_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); + add_assoc_long_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); + add_assoc_long_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); + add_assoc_long_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); } /* }}} */ diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index 8ca60a9055..c00e4b84e9 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -96,10 +96,10 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC mysql->multi_query = 1; \ } -#define MYSQLI_RETURN_INT_INT(__val) \ +#define MYSQLI_RETURN_LONG_INT(__val) \ { \ if ((__val) < PHP_INT_MAX) { \ - RETURN_INT((php_int_t) (__val)); \ + RETURN_LONG((zend_long) (__val)); \ } else { \ /* always used with my_ulonglong -> %llu */ \ RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \ diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index 912152343a..49ecab0add 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -72,7 +72,7 @@ if (!obj->ptr) { \ p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt;\ } -#define MYSQLI_MAP_PROPERTY_FUNC_INT( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ +#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ {\ __ret_type l;\ @@ -82,7 +82,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ } else {\ l = (__ret_type)__int_func(p);\ if (l < PHP_INT_MAX) {\ - ZVAL_INT(retval, (php_int_t) l);\ + ZVAL_LONG(retval, (zend_long) l);\ } else { \ ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \ } \ @@ -111,7 +111,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC)\ /* {{{ property link_client_version_read */ static zval *link_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_INT(retval, MYSQL_VERSION_ID); + ZVAL_LONG(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -128,7 +128,7 @@ static zval *link_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property link_connect_errno_read */ static zval *link_connect_errno_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_INT(retval, (php_int_t)MyG(error_no)); + ZVAL_LONG(retval, (zend_long)MyG(error_no)); return retval; } /* }}} */ @@ -163,12 +163,12 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - ZVAL_INT(retval, -1); + ZVAL_LONG(retval, -1); return retval; } if (rc < PHP_INT_MAX) { - ZVAL_INT(retval, (php_int_t) rc); + ZVAL_LONG(retval, (zend_long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -198,7 +198,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -208,7 +208,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(retval, &single_error); @@ -221,18 +221,18 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* }}} */ /* link properties */ -MYSQLI_MAP_PROPERTY_FUNC_INT(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED)) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_INT(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) /* {{{ property link_stat_read */ static zval *link_stat_read(mysqli_object *obj, zval *retval TSRMLS_DC) @@ -279,7 +279,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_INT(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); + ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); } return retval; } @@ -289,7 +289,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC) static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) { MYSQL_RES *p; - php_uint_t *ret; + zend_ulong *ret; uint field_count; CHECK_STATUS(MYSQLI_STATUS_VALID); @@ -298,21 +298,21 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p || !field_count || !(ret = mysql_fetch_lengths(p))) { ZVAL_NULL(retval); } else { - php_uint_t i; + zend_ulong i; array_init(retval); for (i = 0; i < field_count; i++) { - add_index_int(retval, i, ret[i]); + add_index_long(retval, i, ret[i]); } } return retval; } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_INT(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) /* statement properties */ @@ -328,7 +328,7 @@ static zval *stmt_id_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_INT(retval, mysqli_stmt_get_id(p->stmt)); + ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt)); } return retval; } @@ -350,12 +350,12 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_stmt_affected_rows(p->stmt); if (rc == (my_ulonglong) -1) { - ZVAL_INT(retval, -1); + ZVAL_LONG(retval, -1); return retval; } if (rc < PHP_INT_MAX) { - ZVAL_INT(retval, (php_int_t) rc); + ZVAL_LONG(retval, (zend_long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -384,7 +384,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -394,7 +394,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(retval, &single_error); @@ -405,11 +405,11 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) diff --git a/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c index c4ffd1c199..7703465e21 100644 --- a/ext/mysqli/mysqli_report.c +++ b/ext/mysqli/mysqli_report.c @@ -33,10 +33,10 @@ extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC sets report level */ PHP_FUNCTION(mysqli_report) { - php_int_t flags; + zend_long flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) { return; } diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index c60946b449..615ba94bbf 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -141,7 +141,7 @@ static void php_mysqli_result_iterator_current_key(zend_object_iterator *iter, z { php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter; - ZVAL_INT(key, iterator->row_num); + ZVAL_LONG(key, iterator->row_num); } /* }}} */ diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c index 3c86bee800..0f39ba2edc 100644 --- a/ext/mysqli/mysqli_warning.c +++ b/ext/mysqli/mysqli_warning.c @@ -29,7 +29,7 @@ #include "mysqli_priv.h" /* Define these in the PHP5 tree to make merging easy process */ -#define ZSTR_DUPLICATE (1<<0) +#define Zzend_string_dupLICATE (1<<0) #define ZSTR_AUTOFREE (1<<1) #define ZVAL_UTF8_STRING(z, s, flags) ZVAL_STRING((z), (char*)(s)) @@ -59,9 +59,9 @@ MYSQLI_WARNING *php_new_warning(const char *reason, int errorno TSRMLS_DC) w = (MYSQLI_WARNING *)ecalloc(1, sizeof(MYSQLI_WARNING)); - ZVAL_UTF8_STRING(&(w->reason), reason, ZSTR_DUPLICATE); + ZVAL_UTF8_STRING(&(w->reason), reason, Zzend_string_dupLICATE); - ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE); + ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, Zzend_string_dupLICATE); w->errorno = errorno; @@ -108,9 +108,9 @@ MYSQLI_WARNING *php_new_warning(const zval * reason, int errorno TSRMLS_DC) ZVAL_DUP(&w->reason, (zval *)reason); convert_to_string(&w->reason); - //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRSIZE(w->reason), ZSTR_AUTOFREE); + //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRLEN(w->reason), ZSTR_AUTOFREE); - ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE); + ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, Zzend_string_dupLICATE); w->errorno = errorno; @@ -147,7 +147,7 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql TSRMLS_DC) /* 1. Here comes the error no */ entry = zend_hash_get_current_data(Z_ARRVAL(row)); convert_to_int_ex(entry); - errno = Z_IVAL_P(entry); + errno = Z_LVAL_P(entry); zend_hash_move_forward(Z_ARRVAL(row)); /* 2. Here comes the reason */ @@ -243,7 +243,7 @@ zval *mysqli_warning_errno(mysqli_object *obj, zval *retval TSRMLS_DC) return NULL; } w = (MYSQLI_WARNING *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; - ZVAL_INT(retval, w->errorno); + ZVAL_LONG(retval, w->errorno); return retval; } /* }}} */ diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 607f9c602a..9570952ec0 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -99,9 +99,9 @@ enum mysqli_status { typedef struct { char *val; - php_uint_t buflen; - php_uint_t output_len; - php_uint_t type; + zend_ulong buflen; + zend_ulong output_len; + zend_ulong type; } VAR_BUFFER; typedef struct { @@ -214,7 +214,7 @@ extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_stat extern zend_object_iterator_funcs php_mysqli_result_iterator_funcs; extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); -extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC); +extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype TSRMLS_DC); #ifdef HAVE_SPL extern PHPAPI zend_class_entry *spl_ce_RuntimeException; @@ -318,27 +318,27 @@ extern PHPAPI zend_class_entry *spl_ce_RuntimeException; ZEND_BEGIN_MODULE_GLOBALS(mysqli) - php_int_t default_link; - php_int_t num_links; - php_int_t max_links; - php_int_t num_active_persistent; - php_int_t num_inactive_persistent; - php_int_t max_persistent; - php_int_t allow_persistent; - php_uint_t default_port; + zend_long default_link; + zend_long num_links; + zend_long max_links; + zend_long num_active_persistent; + zend_long num_inactive_persistent; + zend_long max_persistent; + zend_long allow_persistent; + zend_ulong default_port; char *default_host; char *default_user; char *default_socket; char *default_pw; - php_int_t reconnect; - php_int_t allow_local_infile; - php_int_t strict; - php_int_t error_no; + zend_long reconnect; + zend_long allow_local_infile; + zend_long strict; + zend_long error_no; char *error_msg; - php_int_t report_mode; + zend_long report_mode; HashTable *report_ht; - php_uint_t multi_query; - php_uint_t embedded; + zend_ulong multi_query; + zend_ulong embedded; zend_bool rollback_on_cached_plink; ZEND_END_MODULE_GLOBALS(mysqli) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 65752d74a8..c05d8af8b1 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -440,7 +440,7 @@ mysqlnd_switch_to_ssl_if_needed( MYSQLND_CONN_DATA * conn, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC ) { @@ -546,7 +546,7 @@ mysqlnd_run_authentication( const char * const auth_protocol, unsigned int charset_no, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, zend_bool silent, zend_bool is_change_user TSRMLS_DC) @@ -678,7 +678,7 @@ mysqlnd_connect_run_authentication( size_t passwd_len, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { enum_func_status ret = FAIL; @@ -1588,7 +1588,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn /* {{{ mysqlnd_old_escape_string */ -PHPAPI php_uint_t +PHPAPI zend_ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { DBG_ENTER("mysqlnd_old_escape_string"); @@ -1622,11 +1622,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const /* {{{ mysqlnd_conn_data::escape_string */ -static php_uint_t +static zend_ulong MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string); - php_uint_t ret = FAIL; + zend_ulong ret = FAIL; DBG_ENTER("mysqlnd_conn_data::escape_string"); DBG_INF_FMT("conn=%llu", conn->thread_id); @@ -1750,7 +1750,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_stri if (PASS == (ret = PACKET_READ(stats_header, conn))) { /* will be freed by Zend, thus don't use the mnd_ allocator */ - *message = STR_INIT(stats_header->message, stats_header->message_len, 0); + *message = zend_string_init(stats_header->message, stats_header->message_len, 0); DBG_INF((*message)->val); } PACKET_FREE(stats_header); @@ -2114,10 +2114,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const con /* {{{ mysqlnd_conn_data::get_server_version */ -static php_uint_t +static zend_ulong MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC) { - php_int_t major, minor, patch; + zend_long major, minor, patch; char *p; if (!(p = conn->server_version)) { @@ -2130,7 +2130,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * p += 1; /* consume the dot */ patch = ZEND_STRTOI(p, &p, 10); - return (php_uint_t)(major * Z_I(10000) + (php_uint_t)(minor * Z_I(100) + patch)); + return (zend_ulong)(major * Z_I(10000) + (zend_ulong)(minor * Z_I(100) + patch)); } /* }}} */ @@ -2496,7 +2496,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * cons DBG_INF_FMT("Adding [%s][%s]", key, value); { zval attrz; - ZVAL_STR(&attrz, STR_INIT(value, strlen(value), 1)); + ZVAL_STR(&attrz, zend_string_init(value, strlen(value), 1)); zend_hash_str_update(conn->options->connect_attr, key, strlen(key), &attrz); } break; diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index f79dc37a3e..c70934be4d 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -219,7 +219,7 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn); #define mysqlnd_escape_string(newstr, escapestr, escapestr_len) \ mysqlnd_old_escape_string((newstr), (escapestr), (escapestr_len) TSRMLS_CC) -PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); +PHPAPI zend_ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); /* PS */ @@ -270,17 +270,17 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) char * trace_alloc_settings; /* The actual string */ MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */ MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */ - php_int_t net_cmd_buffer_size; - php_int_t net_read_buffer_size; - php_int_t log_mask; - php_int_t net_read_timeout; - php_int_t mempool_default_size; - php_int_t debug_emalloc_fail_threshold; - php_int_t debug_ecalloc_fail_threshold; - php_int_t debug_erealloc_fail_threshold; - php_int_t debug_malloc_fail_threshold; - php_int_t debug_calloc_fail_threshold; - php_int_t debug_realloc_fail_threshold; + zend_long net_cmd_buffer_size; + zend_long net_read_buffer_size; + zend_long log_mask; + zend_long net_read_timeout; + zend_long mempool_default_size; + zend_long debug_emalloc_fail_threshold; + zend_long debug_ecalloc_fail_threshold; + zend_long debug_erealloc_fail_threshold; + zend_long debug_malloc_fail_threshold; + zend_long debug_calloc_fail_threshold; + zend_long debug_realloc_fail_threshold; char * sha256_server_public_key; zend_bool fetch_data_copy; ZEND_END_MODULE_GLOBALS(mysqlnd) diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 903753ef89..9cc46dba4a 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -79,7 +79,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); @@ -119,7 +119,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); @@ -162,7 +162,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); @@ -203,7 +203,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); #if PHP_DEBUG @@ -246,7 +246,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); @@ -287,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - php_int_t * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); + zend_long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); @@ -393,7 +393,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_malloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_malloc_name); @@ -432,7 +432,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_calloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_calloc_name); @@ -471,7 +471,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - php_int_t * threshold = &MYSQLND_G(debug_realloc_fail_threshold); + zend_long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_realloc_name); diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index 76d4a56f38..985357e3bc 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -37,7 +37,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, @@ -361,7 +361,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -421,7 +421,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -553,7 +553,7 @@ mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn, BIO_free(bio); DBG_INF("Successfully loaded"); DBG_INF_FMT("Public key:%*.s", key_str->len, key_str->val); - STR_RELEASE(key_str); + zend_string_release(key_str); } php_stream_free(stream, PHP_STREAM_FREE_CLOSE); } @@ -571,7 +571,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - php_uint_t mysql_flags + zend_ulong mysql_flags TSRMLS_DC) { RSA * server_public_key; diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index fa97b877e5..bf67498eea 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -726,7 +726,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name /* {{{ mysqlnd_cset_escape_quotes */ -PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; @@ -780,7 +780,7 @@ PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, /* {{{ mysqlnd_cset_escape_slashes */ -PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; diff --git a/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h index 0a7ced68aa..87f30d8ba5 100644 --- a/ext/mysqlnd/mysqlnd_charset.h +++ b/ext/mysqlnd/mysqlnd_charset.h @@ -21,10 +21,10 @@ #ifndef MYSQLND_CHARSET_H #define MYSQLND_CHARSET_H -PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); -PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); struct st_mysqlnd_plugin_charsets @@ -34,8 +34,8 @@ struct st_mysqlnd_plugin_charsets { const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr); const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name); - php_uint_t (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); - php_uint_t (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + zend_ulong (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + zend_ulong (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); } methods; }; diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index 81be117277..0d6a25a419 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -606,7 +606,7 @@ enum php_mysqlnd_server_command }; -#define MYSQLND_DEFAULT_PREFETCH_ROWS (php_uint_t) 1 +#define MYSQLND_DEFAULT_PREFETCH_ROWS (zend_ulong) 1 #define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */ #define MYSQLND_REFRESH_LOG 2 /* Start on new log file */ diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index e014f86390..6a243d5315 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -193,7 +193,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha SET_CLIENT_ERROR(*error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr->val); if (errstr) { /* no mnd_ since we don't allocate it */ - STR_RELEASE(errstr); + zend_string_release(errstr); } DBG_RETURN(NULL); } @@ -676,7 +676,7 @@ MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * co } net->compressed_envelope_packet_no++; #ifdef MYSQLND_DUMP_HEADER_N_BODY - DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (php_uint_t) net_payload_size); + DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (zend_ulong) net_payload_size); #endif /* Now let's read from the wire, decompress it and fill the read buffer */ net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_stats, error_info TSRMLS_CC); diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index d9936e0425..424f52d1e6 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -194,13 +194,13 @@ This file is public domain and comes with NO WARRANTY of any kind */ (((uint32_t) (zend_uchar) (A)[2]) << 16) |\ (((uint32_t) (zend_uchar) (A)[1]) << 8) | \ ((uint32_t) (zend_uchar) (A)[0]))) -#define sint4korr(A) (*((php_int_t *) (A))) +#define sint4korr(A) (*((zend_long *) (A))) #define uint2korr(A) (*((uint16_t *) (A))) #define uint3korr(A) (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\ (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\ (((uint32_t) ((zend_uchar) (A)[2])) << 16)) -#define uint4korr(A) (*((php_uint_t *) (A))) +#define uint4korr(A) (*((zend_ulong *) (A))) @@ -211,7 +211,7 @@ This file is public domain and comes with NO WARRANTY of any kind */ *(T)= (zend_uchar) ((A));\ *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\ *(T+2)=(zend_uchar) (((A) >> 16)); } -#define int4store(T,A) *((php_int_t *) (T))= (php_int_t) (A) +#define int4store(T,A) *((zend_long *) (T))= (zend_long) (A) #define int5store(T,A) { \ *((zend_uchar *)(T))= (zend_uchar)((A));\ *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\ @@ -232,12 +232,12 @@ This file is public domain and comes with NO WARRANTY of any kind */ typedef union { double v; - php_int_t m[2]; + zend_long m[2]; } float8get_union; -#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((php_int_t*) (M)); \ - ((float8get_union *)&(V))->m[1] = *(((php_int_t*) (M))+1); } -#define float8store(T,V) { *((php_int_t *) (T)) = ((float8get_union *)&(V))->m[0]; \ - *(((php_int_t *) (T))+1) = ((float8get_union *)&(V))->m[1]; } +#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((zend_long*) (M)); \ + ((float8get_union *)&(V))->m[1] = *(((zend_long*) (M))+1); } +#define float8store(T,V) { *((zend_long *) (T)) = ((float8get_union *)&(V))->m[0]; \ + *(((zend_long *) (T))+1) = ((float8get_union *)&(V))->m[1]; } #define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); } /* From Andrey Hristov based on float8get */ #define floatget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float)) diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index 475a33d38e..79e67da464 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -209,7 +209,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - php_uint_t mysql_flags, + zend_ulong mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index c47da0262a..e2745d8729 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -905,8 +905,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, unsigned i #endif if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { - meta->fields[i].max_length = Z_STRSIZE_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { + meta->fields[i].max_length = Z_STRLEN_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1093,8 +1093,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { - meta->fields[i].max_length = Z_STRSIZE_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { + meta->fields[i].max_length = Z_STRLEN_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1302,7 +1302,7 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC) /* {{{ mysqlnd_stmt::send_long_data */ static enum_func_status MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned int param_no, - const char * const data, php_uint_t length TSRMLS_DC) + const char * const data, zend_ulong length TSRMLS_DC) { MYSQLND_STMT_DATA * stmt = s? s->data:NULL; enum_func_status ret = FAIL; @@ -1879,7 +1879,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s, } case STMT_ATTR_CURSOR_TYPE: { unsigned int ival = *(unsigned int *) value; - if (ival > (php_uint_t) CURSOR_TYPE_READ_ONLY) { + if (ival > (zend_ulong) CURSOR_TYPE_READ_ONLY) { SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); DBG_INF("FAIL"); DBG_RETURN(FAIL); @@ -1927,10 +1927,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s, *(zend_bool *) value= stmt->update_max_length; break; case STMT_ATTR_CURSOR_TYPE: - *(php_uint_t *) value= stmt->flags; + *(zend_ulong *) value= stmt->flags; break; case STMT_ATTR_PREFETCH_ROWS: - *(php_uint_t *) value= stmt->prefetch_rows; + *(zend_ulong *) value= stmt->prefetch_rows; break; default: DBG_RETURN(FAIL); diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 8b59d918ba..c669706917 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -41,7 +41,7 @@ enum mysqlnd_timestamp_type struct st_mysqlnd_time { unsigned int year, month, day, hour, minute, second; - php_uint_t second_part; + zend_ulong second_part; zend_bool neg; enum mysqlnd_timestamp_type time_type; }; @@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne #endif /* #if SIZEOF_LONG==4 */ { if (byte_count < 8 || uval <= L64(9223372036854775807)) { - ZVAL_INT(zv, (php_int_t) uval); /* the cast is safe, we are in the range */ + ZVAL_LONG(zv, (zend_long) uval); /* the cast is safe, we are in the range */ } else { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); @@ -112,7 +112,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne } else #endif /* SIZEOF */ { - ZVAL_INT(zv, (php_int_t) lval); /* the cast is safe, we are in the range */ + ZVAL_LONG(zv, (zend_long) lval); /* the cast is safe, we are in the range */ } } @@ -246,7 +246,7 @@ static void ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_time"); @@ -256,11 +256,11 @@ ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_le t.time_type = MYSQLND_TIMESTAMP_TIME; t.neg = (zend_bool) to[0]; - t.day = (php_uint_t) sint4korr(to+1); + t.day = (zend_ulong) sint4korr(to+1); t.hour = (unsigned int) to[5]; t.minute = (unsigned int) to[6]; t.second = (unsigned int) to[7]; - t.second_part = (length > 8) ? (php_uint_t) sint4korr(to+8) : 0; + t.second_part = (length > 8) ? (zend_ulong) sint4korr(to+8) : 0; t.year = t.month= 0; if (t.day) { /* Convert days to hours at once */ @@ -289,7 +289,7 @@ static void ps_fetch_date(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t = {0}; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_date"); @@ -326,7 +326,7 @@ static void ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - php_uint_t length; /* First byte encodes the length*/ + zend_ulong length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_datetime"); @@ -347,7 +347,7 @@ ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pac } else { t.hour = t.minute = t.second= 0; } - t.second_part = (length > 7) ? (php_uint_t) sint4korr(to+7) : 0; + t.second_part = (length > 7) ? (zend_ulong) sint4korr(to+7) : 0; (*row)+= length; } else { @@ -373,7 +373,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ For now just copy, before we make it possible to write \0 to the row buffer */ - const php_uint_t length = php_mysqlnd_net_field_length(row); + const zend_ulong length = php_mysqlnd_net_field_length(row); DBG_ENTER("ps_fetch_string"); DBG_INF_FMT("len = %lu", length); DBG_INF("copying from the row buffer"); @@ -389,7 +389,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ static void ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { - php_uint_t length = php_mysqlnd_net_field_length(row); + zend_ulong length = php_mysqlnd_net_field_length(row); ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, length TSRMLS_CC); } /* }}} */ @@ -406,32 +406,32 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float; @@ -495,7 +495,7 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].func = ps_fetch_bit; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].pack_len = 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_INT; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_LONG; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_VAR_STRING].func = ps_fetch_string; @@ -610,7 +610,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie ZVAL_DEREF(parameter); if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) { /* always copy the var, because we do many conversions */ - if (Z_TYPE_P(parameter) != IS_INT && + if (Z_TYPE_P(parameter) != IS_LONG && PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i TSRMLS_CC)) { SET_OOM_ERROR(*stmt->error_info); @@ -620,7 +620,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_INT) { + if (Z_TYPE_P(parameter) != IS_LONG) { zval *tmp_data = (*copies_param && !Z_ISUNDEF((*copies_param)[i]))? &(*copies_param)[i]: parameter; /* Because converting to double and back to long can lead @@ -674,10 +674,10 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_INT) { + if (Z_TYPE_P(parameter) != IS_LONG) { const zval *tmp_data = (copies && !Z_ISUNDEF(copies[i]))? &copies[i] : parameter; /* - In case of IS_INT we do nothing, it is ok, in case of string, we just need to set current_type. + In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type. The actual transformation has been performed several dozens line above. */ if (Z_TYPE_P(tmp_data) == IS_STRING) { @@ -778,7 +778,7 @@ use_string: the_var = &((*copies_param)[i]); } convert_to_string_ex(the_var); - *data_size += Z_STRSIZE_P(the_var); + *data_size += Z_STRLEN_P(the_var); break; } } @@ -814,7 +814,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int8store(*p, Z_IVAL_P(data)); + int8store(*p, Z_LVAL_P(data)); (*p) += 8; break; case MYSQL_TYPE_LONG: @@ -822,7 +822,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int4store(*p, Z_IVAL_P(data)); + int4store(*p, Z_LVAL_P(data)); (*p) += 4; break; case MYSQL_TYPE_LONG_BLOB: @@ -836,7 +836,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, case MYSQL_TYPE_VAR_STRING: send_string: { - size_t len = Z_STRSIZE_P(data); + size_t len = Z_STRLEN_P(data); /* to is after p. The latter hasn't been moved */ *p = php_mysqlnd_net_store_length(*p, len); memcpy(*p, Z_STRVAL_P(data), len); diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 65ad1099b6..ea275be192 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(data_cursor[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(data_cursor[i]); + zend_ulong len = Z_STRLEN(data_cursor[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -599,7 +599,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s of PHP, to be called as separate function. But let's have it for completeness. */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result; @@ -631,7 +631,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED of PHP, to be called as separate function. But let's have it for completeness. */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_C * set = (MYSQLND_RES_BUFFERED_C *) result; @@ -648,7 +648,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * /* {{{ mysqlnd_result_unbuffered::fetch_lengths */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC) { /* simulate output of libmysql */ @@ -658,10 +658,10 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED /* {{{ mysqlnd_res::fetch_lengths */ -static php_uint_t * +static zend_ulong * MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC) { - php_uint_t * ret; + zend_ulong * ret; DBG_ENTER("mysqlnd_res::fetch_lengths"); ret = result->stored_data && result->stored_data->m.fetch_lengths ? result->stored_data->m.fetch_lengths(result->stored_data TSRMLS_CC) : @@ -731,11 +731,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi *row = mnd_malloc(field_count * sizeof(char *)); if (*row) { MYSQLND_FIELD * field = meta->fields; - php_uint_t * lengths = result->unbuf->lengths; + zend_ulong * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; /* BEGIN difference between normal normal fetch and _c */ if (Z_TYPE_P(data) != IS_NULL) { @@ -849,11 +849,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void { HashTable * row_ht = Z_ARRVAL_P(row); MYSQLND_FIELD * field = meta->fields; - php_uint_t * lengths = result->unbuf->lengths; + zend_ulong * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1017,7 +1017,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (Z_TYPE_P(data) != IS_NULL) { convert_to_string(data); @@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1104,7 +1104,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - php_uint_t len = Z_STRSIZE(current_row[i]); + zend_ulong len = Z_STRLEN(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1199,7 +1199,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1776,7 +1776,7 @@ static void MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC) { zval row; - php_uint_t i = 0; + zend_ulong i = 0; MYSQLND_RES_BUFFERED *set = result->stored_data; DBG_ENTER("mysqlnd_res::fetch_all"); @@ -1927,7 +1927,7 @@ mysqlnd_result_unbuffered_init(unsigned int field_count, zend_bool ps, zend_bool DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -1967,7 +1967,7 @@ mysqlnd_result_buffered_zval_init(unsigned int field_count, zend_bool ps, zend_b if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -2010,7 +2010,7 @@ mysqlnd_result_buffered_c_init(unsigned int field_count, zend_bool ps, zend_bool if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(zend_ulong), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index ac7526d22d..e29c077602 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -42,7 +42,7 @@ php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS meta->def = NULL; } if (meta->sname) { - STR_RELEASE(meta->sname); + zend_string_release(meta->sname); } } } @@ -64,7 +64,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met } field_packet->persistent_alloc = meta->persistent; for (;i < meta->field_count; i++) { - php_int_t idx; + zend_long idx; if (meta->fields[i].root) { /* We re-read metadata for PS */ @@ -226,7 +226,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, clone_metadata)(const MYSQLND_RES_METADATA * co memcpy(new_fields[i].root, orig_fields[i].root, new_fields[i].root_len); if (orig_fields[i].sname) { - new_fields[i].sname = STR_COPY(orig_fields[i].sname); + new_fields[i].sname = zend_string_copy(orig_fields[i].sname); new_fields[i].name = new_fields[i].sname->val; new_fields[i].name_length = new_fields[i].sname->len; } diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 87270a93c8..85e20a2c35 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -80,8 +80,8 @@ typedef struct st_mysqlnd_field const char *db; /* Database for table */ const char *catalog; /* Catalog for table */ char *def; /* Default value (set by mysql_list_fields) */ - php_uint_t length; /* Width of column (create length) */ - php_uint_t max_length; /* Max width for selected set */ + zend_ulong length; /* Width of column (create length) */ + zend_ulong max_length; /* Max width for selected set */ unsigned int name_length; unsigned int org_name_length; unsigned int table_length; @@ -414,7 +414,7 @@ struct st_mysqlnd_object_factory_methods typedef enum_func_status (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC); -typedef php_int_t (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); +typedef zend_long (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__send_query)(MYSQLND_CONN_DATA * conn, const char *query, unsigned int query_len TSRMLS_DC); @@ -441,7 +441,7 @@ typedef const char * (*func_mysqlnd_conn_data__get_sqlstate)(const MYSQLND_CONN typedef uint64_t (*func_mysqlnd_conn_data__get_thread_id)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef void (*func_mysqlnd_conn_data__get_statistics)(const MYSQLND_CONN_DATA * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); -typedef php_uint_t (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); +typedef zend_ulong (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_server_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__get_server_statistics)(MYSQLND_CONN_DATA * conn, zend_string **message TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_host_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); @@ -639,7 +639,7 @@ typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_field_direct)(MYSQLND_RES typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_fields)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, MYSQLND_RES_METADATA * meta, MYSQLND_MEMORY_POOL_CHUNK *** row_buffers, zend_bool binary_protocol TSRMLS_DC); typedef void (*func_mysqlnd_res__free_result_buffers)(MYSQLND_RES * result TSRMLS_DC); /* private */ @@ -690,7 +690,7 @@ struct st_mysqlnd_res_methods typedef uint64_t (*func_mysqlnd_result_unbuffered__num_rows)(const MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_last_data)(MYSQLND_RES_UNBUFFERED * result, MYSQLND_STATS * const global_stats TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQLND_STATS * const global_stats TSRMLS_DC); @@ -707,7 +707,7 @@ struct st_mysqlnd_result_unbuffered_methods typedef uint64_t (*func_mysqlnd_result_buffered__num_rows)(const MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__initialize_result_set_rest)(MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta, MYSQLND_STATS * stats, zend_bool int_and_float_native TSRMLS_DC); -typedef php_uint_t * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); +typedef zend_ulong * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__data_seek)(MYSQLND_RES_BUFFERED * const result, const uint64_t row TSRMLS_DC); typedef void (*func_mysqlnd_result_buffered__free_result)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); @@ -763,7 +763,7 @@ typedef enum_func_status (*func_mysqlnd_stmt__bind_one_parameter)(MYSQLND_STMT * typedef enum_func_status (*func_mysqlnd_stmt__refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC); -typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, php_uint_t length TSRMLS_DC); +typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, zend_ulong length TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_parameter_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef uint64_t (*func_mysqlnd_stmt__get_last_insert_id)(const MYSQLND_STMT * const stmt TSRMLS_DC); @@ -923,10 +923,10 @@ struct st_mysqlnd_connection_data unsigned int connect_or_select_db_len; MYSQLND_INFILE infile; unsigned int protocol_version; - php_uint_t max_packet_size; + zend_ulong max_packet_size; unsigned int port; - php_uint_t client_flag; - php_uint_t server_capabilities; + zend_ulong client_flag; + zend_ulong server_capabilities; /* For UPSERT queries */ MYSQLND_UPSERT_STATUS * upsert_status; @@ -986,7 +986,7 @@ struct st_mysqlnd_connection struct mysqlnd_field_hash_key { zend_bool is_numeric; - php_uint_t key; + zend_ulong key; }; @@ -1011,7 +1011,7 @@ struct st_mysqlnd_result_metadata uint64_t initialized_rows; \ \ /* Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ \ - php_uint_t *lengths; \ + zend_ulong *lengths; \ \ MYSQLND_MEMORY_POOL *result_set_memory_pool; \ \ @@ -1064,7 +1064,7 @@ struct st_mysqlnd_unbuffered_result Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ - php_uint_t *lengths; + zend_ulong *lengths; MYSQLND_MEMORY_POOL *result_set_memory_pool; @@ -1117,8 +1117,8 @@ struct st_mysqlnd_result_bind struct st_mysqlnd_stmt_data { MYSQLND_CONN_DATA *conn; - php_uint_t stmt_id; - php_uint_t flags;/* cursor is set here */ + zend_ulong stmt_id; + zend_ulong flags;/* cursor is set here */ enum_mysqlnd_stmt_state state; unsigned int warning_count; MYSQLND_RES *result; @@ -1137,7 +1137,7 @@ struct st_mysqlnd_stmt_data MYSQLND_ERROR_INFO error_info_impl; zend_bool update_max_length; - php_uint_t prefetch_rows; + zend_ulong prefetch_rows; zend_bool cursor_exists; mysqlnd_stmt_use_or_store_func default_rset_handler; @@ -1166,7 +1166,7 @@ struct st_mysqlnd_plugin_header { unsigned int plugin_api_version; const char * plugin_name; - php_uint_t plugin_version; + zend_ulong plugin_version; const char * plugin_string_version; const char * plugin_license; const char * plugin_author; @@ -1203,7 +1203,7 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, - const MYSQLND_NET_OPTIONS * const net_options, php_uint_t mysql_flags + const MYSQLND_NET_OPTIONS * const net_options, zend_ulong mysql_flags TSRMLS_DC); struct st_mysqlnd_authentication_plugin diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 2acccf3f43..c42059c641 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -126,14 +126,14 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L /* {{{ php_mysqlnd_net_field_length Get next field's length */ -php_uint_t +zend_ulong php_mysqlnd_net_field_length(zend_uchar **packet) { register zend_uchar *p= (zend_uchar *)*packet; if (*p < 251) { (*packet)++; - return (php_uint_t) *p; + return (zend_ulong) *p; } switch (*p) { @@ -142,13 +142,13 @@ php_mysqlnd_net_field_length(zend_uchar **packet) return MYSQLND_NULL_LENGTH; case 252: (*packet) += 3; - return (php_uint_t) uint2korr(p+1); + return (zend_ulong) uint2korr(p+1); case 253: (*packet) += 4; - return (php_uint_t) uint3korr(p+1); + return (zend_ulong) uint3korr(p+1); default: (*packet) += 9; - return (php_uint_t) uint4korr(p+1); + return (zend_ulong) uint4korr(p+1); } } /* }}} */ @@ -201,7 +201,7 @@ php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length) if (length < (uint64_t) L64(16777216)) { *packet++ = 253; - int3store(packet,(php_uint_t) length); + int3store(packet,(zend_ulong) length); return packet + 3; } *packet++ = 254; @@ -567,7 +567,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - php_uint_t num_key; + zend_ulong num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { @@ -582,11 +582,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC { zend_string * key; - php_uint_t unused_num_key; + zend_ulong unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRSIZE_P(entry_value); + size_t value_len = Z_STRLEN_P(entry_value); ca_payload_len += php_mysqlnd_net_store_length_size(key->len); ca_payload_len += key->len; @@ -604,7 +604,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - php_uint_t num_key; + zend_ulong num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { /* copy key */ @@ -621,11 +621,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC #else { zend_string * key; - php_uint_t unused_num_key; + zend_ulong unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRSIZE_P(entry_value); + size_t value_len = Z_STRLEN_P(entry_value); /* copy key */ p = php_mysqlnd_net_store_length(p, key->len); @@ -685,7 +685,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - php_uint_t i; + zend_ulong i; register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet; DBG_ENTER("php_mysqlnd_auth_response_read"); @@ -848,7 +848,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - php_uint_t i; + zend_ulong i; register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet; DBG_ENTER("php_mysqlnd_ok_read"); @@ -1230,7 +1230,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *p = buf; zend_uchar *begin = buf; char *root_ptr; - php_uint_t len; + zend_ulong len; MYSQLND_FIELD *meta; unsigned int i, field_count = sizeof(rset_field_offsets)/sizeof(size_t); @@ -1356,7 +1356,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) meta->root_len = total_len; if (meta->name != mysqlnd_empty_string) { - meta->sname = STR_INIT(meta->name, meta->name_length, packet->persistent_alloc); + meta->sname = zend_string_init(meta->name, meta->name_length, packet->persistent_alloc); } else { meta->sname = STR_EMPTY_ALLOC(); } @@ -1587,7 +1587,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_PS, (Z_TYPE_P(current_field) == IS_STRING)? - Z_STRSIZE_P(current_field) : (p - orig_p)); + Z_STRLEN_P(current_field) : (p - orig_p)); if (!((bit<<=1) & 255)) { bit = 1; /* to the following byte */ @@ -1622,7 +1622,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) { /* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */ - php_uint_t len = php_mysqlnd_net_field_length(&p); + zend_ulong len = php_mysqlnd_net_field_length(&p); /* NULL or NOT NULL, this is the question! */ if (len == MYSQLND_NULL_LENGTH) { @@ -1667,7 +1667,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len); } #ifdef MYSQLND_STRING_TO_INT_CONVERSION - if (as_int_or_float && perm_bind.php_type == IS_INT) { + if (as_int_or_float && perm_bind.php_type == IS_LONG) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\0'; @@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, #else _atoi64((char *) p); #endif - ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ + ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */ } else { uint64_t v = #ifndef PHP_WIN32 @@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, { ZVAL_STRINGL(current_field, (char *)p, len); } else { - ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ + ZVAL_LONG(current_field, (zend_long) v); /* the cast is safe */ } } *(p + len) = save; @@ -1730,12 +1730,12 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, later in this function there will be an advancement. */ p -= len; - if (Z_TYPE_P(current_field) == IS_INT) { - bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_IVAL_P(current_field)); + if (Z_TYPE_P(current_field) == IS_LONG) { + bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_LVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); } else if (Z_TYPE_P(current_field) == IS_STRING){ - memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field)); - bit_area += Z_STRSIZE_P(current_field); + memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); + bit_area += Z_STRLEN_P(current_field); *bit_area++ = '\0'; zval_dtor(current_field); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index 059cfb2416..b40808d595 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -28,7 +28,7 @@ #define MYSQLND_HEADER_SIZE 4 #define COMPRESSED_HEADER_SIZE 3 -#define MYSQLND_NULL_LENGTH (php_uint_t) ~0 +#define MYSQLND_NULL_LENGTH (zend_ulong) ~0 /* Used in mysqlnd_debug.c */ PHPAPI extern const char mysqlnd_read_header_name[]; @@ -185,7 +185,7 @@ typedef struct st_mysqlnd_packet_rset_header { error_no != 0 => error others => result set -> Read res_field packets up to field_count */ - php_uint_t field_count; + zend_ulong field_count; /* These are filled if no SELECT query. For SELECT warning_count and server status are in the last row packet, the EOF packet. @@ -258,7 +258,7 @@ typedef struct st_mysqlnd_packet_prepare_response { MYSQLND_PACKET_HEADER header; /* also known as field_count 0x00=OK , 0xFF=error */ unsigned char error_code; - php_uint_t stmt_id; + zend_ulong stmt_id; unsigned int field_count; unsigned int param_count; unsigned int warning_count; @@ -300,7 +300,7 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response { PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass, size_t pass_len); -php_uint_t php_mysqlnd_net_field_length(zend_uchar **packet); +zend_ulong php_mysqlnd_net_field_length(zend_uchar **packet); zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length); size_t php_mysqlnd_net_store_length_size(uint64_t length); diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index 76bf1e256f..ff532a6105 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -206,7 +206,7 @@ static PHP_GINIT_FUNCTION(mysqlnd) */ static PHP_INI_MH(OnUpdateNetCmdBufferSize) { - php_int_t long_value; + zend_long long_value; ZEND_ATOI(long_value, new_value); if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) { diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 73f0c7f682..3c63692533 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1207,92 +1207,92 @@ PHP_MINIT_FUNCTION(oci) oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC); /* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */ - REGISTER_INT_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); /* for $LOB->seek() */ - REGISTER_INT_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); /* for $LOB->flush() */ - REGISTER_INT_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); /* for OCIBindByName (real "oci" names + short "php" names */ - REGISTER_INT_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 10) - REGISTER_INT_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); #endif #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_INT_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE", CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_INT_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif /* for OCIFetchStatement */ - REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); /* for OCIFetchInto & OCIResult */ - REGISTER_INT_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); /* for OCINewDescriptor (real "oci" names + short "php" names */ - REGISTER_INT_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); /* for OCIWriteTemporaryLob */ - REGISTER_INT_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2090,7 +2090,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char if (alloc_non_persistent) { connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = zend_str_dup(hashed_details.s, 0); + connection->hash_key = zend_string_dup(hashed_details.s, 0); connection->is_persistent = 0; #ifdef HAVE_OCI8_DTRACE connection->client_id = NULL; @@ -2100,7 +2100,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char if (connection == NULL) { return NULL; } - connection->hash_key = zend_str_dup(hashed_details.s, 1); + connection->hash_key = zend_string_dup(hashed_details.s, 1); if (connection->hash_key == NULL) { free(connection); return NULL; @@ -2112,7 +2112,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char } } else { connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = zend_str_dup(hashed_details.s, 0); + connection->hash_key = zend_string_dup(hashed_details.s, 0); connection->is_persistent = 0; #ifdef HAVE_OCI8_DTRACE connection->client_id = NULL; @@ -2791,7 +2791,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg /* Only for ocifetchinto BC. In all other cases we return array, not long */ REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */ zval_dtor(return_value); - RETURN_INT(statement->ncolumns); + RETURN_LONG(statement->ncolumns); } } /* }}} */ @@ -2849,7 +2849,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* Populate key if passed */ if (hash_key->val) { - session_pool->spool_hash_key = zend_str_dup(hash_key, 1); + session_pool->spool_hash_key = zend_string_dup(hash_key, 1); if (session_pool->spool_hash_key == NULL) { iserror = 1; goto exit_create_spool; diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 985fd973c8..198493b946 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -402,7 +402,7 @@ PHP_FUNCTION(oci_lob_tell) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - RETURN_INT(descriptor->lob_current_position); + RETURN_LONG(descriptor->lob_current_position); } /* }}} */ @@ -508,7 +508,7 @@ PHP_FUNCTION(oci_lob_size) if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(lob_length); + RETURN_LONG(lob_length); } /* }}} */ @@ -550,13 +550,13 @@ PHP_FUNCTION(oci_lob_write) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); if (data_len <= 0) { - RETURN_INT(0); + RETURN_LONG(0); } if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(bytes_written); + RETURN_LONG(bytes_written); } /* }}} */ @@ -689,7 +689,7 @@ PHP_FUNCTION(oci_lob_erase) if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(bytes_erased); + RETURN_LONG(bytes_erased); } /* }}} */ @@ -1161,9 +1161,9 @@ PHP_FUNCTION(oci_field_size) if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { /* Handle data type of LONG */ if (column->data_type == SQLT_LNG){ - RETURN_INT(column->storage_size4); + RETURN_LONG(column->storage_size4); } - RETURN_INT(column->data_size); + RETURN_LONG(column->data_size); } RETURN_FALSE; } @@ -1176,7 +1176,7 @@ PHP_FUNCTION(oci_field_scale) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_INT(column->scale); + RETURN_LONG(column->scale); } RETURN_FALSE; } @@ -1189,7 +1189,7 @@ PHP_FUNCTION(oci_field_precision) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_INT(column->precision); + RETURN_LONG(column->precision); } RETURN_FALSE; } @@ -1270,7 +1270,7 @@ PHP_FUNCTION(oci_field_type) RETVAL_STRING("ROWID",1); break; default: - RETVAL_INT(column->data_type); + RETVAL_LONG(column->data_type); } } /* }}} */ @@ -1283,7 +1283,7 @@ PHP_FUNCTION(oci_field_type_raw) column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (column) { - RETURN_INT(column->data_type); + RETURN_LONG(column->data_type); } RETURN_FALSE; } @@ -1405,7 +1405,7 @@ PHP_FUNCTION(oci_fetch_all) while (skip--) { if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_INT(0); + RETURN_LONG(0); } } @@ -1484,7 +1484,7 @@ PHP_FUNCTION(oci_fetch_all) efree(outarrs); } - RETURN_INT(rows); + RETURN_LONG(rows); } /* }}} */ @@ -1659,11 +1659,11 @@ go_out: if (errcode) { array_init(return_value); - add_assoc_int(return_value, "code", errcode); + add_assoc_long(return_value, "code", errcode); // TODO: avoid reallocation ??? add_assoc_string(return_value, "message", (char*) errbuf); efree(errbuf); - add_assoc_int(return_value, "offset", error_offset); + add_assoc_long(return_value, "offset", error_offset); add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : ""); } else { RETURN_FALSE; @@ -1684,7 +1684,7 @@ PHP_FUNCTION(oci_num_fields) PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - RETURN_INT(statement->ncolumns); + RETURN_LONG(statement->ncolumns); } /* }}} */ @@ -2156,7 +2156,7 @@ PHP_FUNCTION(oci_num_rows) if (php_oci_statement_get_numrows(statement, &rowcount TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(rowcount); + RETURN_LONG(rowcount); } /* }}} */ @@ -2353,7 +2353,7 @@ PHP_FUNCTION(oci_collection_size) if (php_oci_collection_size(collection, &size TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(size); + RETURN_LONG(size); } /* }}} */ @@ -2381,7 +2381,7 @@ PHP_FUNCTION(oci_collection_max) if (php_oci_collection_max(collection, &max TSRMLS_CC)) { RETURN_FALSE; } - RETURN_INT(max); + RETURN_LONG(max); } /* }}} */ diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 16fe457433..415961d4ca 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -976,16 +976,16 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) zval_dtor(val); ZVAL_NULL(val); } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRSIZE_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') { + && Z_STRLEN_P(bind->zval) > 0 + && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\0') { /* The post- PHP 5.3 feature for "interned" strings disallows * their reallocation but (i) any IN binds either interned or * not should already be null terminated and (ii) for OUT * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0'; + Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); + Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { int i; zval **entry; @@ -1000,10 +1000,10 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) for (i = 0; i < bind->array.current_length; i++) { if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); - ZVAL_INT(*entry, ((ub4 *)(bind->array.elements))[i]); + ZVAL_LONG(*entry, ((ub4 *)(bind->array.elements))[i]); zend_hash_move_forward(hash); } else { - add_next_index_int(bind->zval, ((ub4 *)(bind->array.elements))[i]); + add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]); } } break; @@ -1144,7 +1144,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, return 1; } convert_to_int(var); - bind_data = (ub4 *)&Z_IVAL_P(var); + bind_data = (ub4 *)&Z_LVAL_P(var); value_sz = sizeof(ub4); mode = OCI_DEFAULT; break; @@ -1162,7 +1162,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, convert_to_string(var); } if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0; + value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; } else { value_sz = maxlength; } @@ -1190,7 +1190,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, return 1; } convert_to_boolean(var); - bind_data = (int *)&Z_IVAL_P(var); + bind_data = (int *)&Z_LVAL_P(var); value_sz = sizeof(int); mode = OCI_DEFAULT; @@ -1332,7 +1332,7 @@ sb4 php_oci_bind_in_callback( convert_to_string(val); *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRSIZE_P(val); + *alenp = Z_STRLEN_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1414,11 +1414,11 @@ sb4 php_oci_bind_out_callback( convert_to_string(val); zval_dtor(val); - Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1); + Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval); + *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; @@ -1453,7 +1453,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME } if (Z_TYPE_P(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC); + column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC); if (!column) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index)); return NULL; @@ -1464,9 +1464,9 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME tmp = *column_index; zval_copy_ctor(&tmp); convert_to_int(&tmp); - column = php_oci_statement_get_column(statement, Z_IVAL(tmp), NULL, 0 TSRMLS_CC); + column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC); if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_IVAL(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL(tmp)); zval_dtor(&tmp); return NULL; } @@ -1639,8 +1639,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - if (Z_STRSIZE_PP(entry) > maxlength) { - maxlength = Z_STRSIZE_PP(entry) + 1; + if (Z_STRLEN_PP(entry) > maxlength) { + maxlength = Z_STRLEN_PP(entry) + 1; } zend_hash_move_forward(hash); } @@ -1662,8 +1662,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRSIZE_PP(entry); - if (Z_STRSIZE_PP(entry) == 0) { + bind->array.element_lengths[i] = Z_STRLEN_PP(entry); + if (Z_STRLEN_PP(entry) == 0) { bind->array.indicators[i] = -1; } zend_hash_move_forward(hash); @@ -1678,7 +1678,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, int element_length; convert_to_string_ex(entry); - element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength; + element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; @@ -1721,7 +1721,7 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length } if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_int_ex(entry); - ((ub4 *)bind->array.elements)[i] = (ub4) Z_IVAL_PP(entry); + ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_PP(entry); zend_hash_move_forward(hash); } else { ((ub4 *)bind->array.elements)[i] = 0; @@ -1802,7 +1802,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c index 13e4d523fb..9148c71da9 100644 --- a/ext/odbc/birdstep.c +++ b/ext/odbc/birdstep.c @@ -193,7 +193,7 @@ PHP_MINIT_FUNCTION(birdstep) { SQLAllocEnv(&henv); - if ( cfg_get_int("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { + if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { php_birdstep_module.max_links = -1; } php_birdstep_module.num_links = 0; @@ -291,7 +291,7 @@ PHP_FUNCTION(birdstep_connect) RETCODE stat; HDBC hdbc; VConn *new; - php_int_t ind; + zend_long ind; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) { return; @@ -316,7 +316,7 @@ PHP_FUNCTION(birdstep_connect) new = (VConn *)emalloc(sizeof(VConn)); ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC); php_birdstep_module.num_links++; - RETURN_INT(ind); + RETURN_LONG(ind); } /* }}} */ @@ -324,10 +324,10 @@ PHP_FUNCTION(birdstep_connect) */ PHP_FUNCTION(birdstep_close) { - php_int_t id; + zend_long id; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { return; } @@ -346,7 +346,7 @@ PHP_FUNCTION(birdstep_close) PHP_FUNCTION(birdstep_exec) { char *query; - php_int_t ind; + zend_long ind; int query_len, indx; VConn *conn; Vresult *res; @@ -354,7 +354,7 @@ PHP_FUNCTION(birdstep_exec) SWORD cols,i,colnamelen; SDWORD rows,coldesc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &ind, &query, &query_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &ind, &query, &query_len) == FAILURE) { return; } @@ -392,7 +392,7 @@ PHP_FUNCTION(birdstep_exec) } SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); - RETURN_INT(rows); + RETURN_LONG(rows); } else { /* Was SELECT query */ res->values = (VResVal *)safe_emalloc(sizeof(VResVal), cols, 0); res->numcols = cols; @@ -418,7 +418,7 @@ PHP_FUNCTION(birdstep_exec) } res->fetched = 0; indx = birdstep_add_result(list,res,conn); - RETURN_INT(indx); + RETURN_LONG(indx); } /* }}} */ @@ -426,13 +426,13 @@ PHP_FUNCTION(birdstep_exec) */ PHP_FUNCTION(birdstep_fetch) { - php_int_t ind; + zend_long ind; Vresult *res; RETCODE stat; UDWORD row; UWORD RowStat[1]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { return; } @@ -441,13 +441,13 @@ PHP_FUNCTION(birdstep_fetch) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -460,7 +460,7 @@ PHP_FUNCTION(birdstep_fetch) PHP_FUNCTION(birdstep_result) { zval **col; - php_int_t ind; + zend_long ind; Vresult *res; RETCODE stat; int i,sql_c_type; @@ -469,7 +469,7 @@ PHP_FUNCTION(birdstep_result) SWORD indx = -1; char *field = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iZ", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &ind, &col) == FAILURE) { return; } @@ -479,7 +479,7 @@ PHP_FUNCTION(birdstep_result) field = Z_STRVAL_PP(col); } else { convert_to_int_ex(col); - indx = Z_IVAL_PP(col); + indx = Z_LVAL_PP(col); } if ( field ) { for ( i = 0; i < res->numcols; i++ ) { @@ -502,13 +502,13 @@ PHP_FUNCTION(birdstep_result) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -527,19 +527,19 @@ l1: res->values[indx].value,4095,&res->values[indx].vallen); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_IVAL_PP(ind)); + birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; } if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { RETURN_STRING(res->values[indx].value,TRUE); } else { - RETURN_INT((long)res->values[indx].value); + RETURN_LONG((long)res->values[indx].value); } default: if ( res->values[indx].value != NULL ) { @@ -553,10 +553,10 @@ l1: */ PHP_FUNCTION(birdstep_freeresult) { - php_int_t ind; + zend_long ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { return; } @@ -572,11 +572,11 @@ PHP_FUNCTION(birdstep_freeresult) */ PHP_FUNCTION(birdstep_autocommit) { - php_int_t id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { return; } @@ -595,11 +595,11 @@ PHP_FUNCTION(birdstep_autocommit) */ PHP_FUNCTION(birdstep_off_autocommit) { - php_int_t id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { return; } @@ -618,11 +618,11 @@ PHP_FUNCTION(birdstep_off_autocommit) */ PHP_FUNCTION(birdstep_commit) { -php_int_t +zend_long RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { return; } @@ -641,11 +641,11 @@ php_int_t */ PHP_FUNCTION(birdstep_rollback) { - php_int_t id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { return; } @@ -664,11 +664,11 @@ PHP_FUNCTION(birdstep_rollback) */ PHP_FUNCTION(birdstep_fieldname) { - php_int_t ind, col; + zend_long ind, col; Vresult *res; SWORD indx; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &ind, &col) == FAILURE) { return; } @@ -687,16 +687,16 @@ PHP_FUNCTION(birdstep_fieldname) */ PHP_FUNCTION(birdstep_fieldnum) { - php_int_t ind; + zend_long ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { return; } PHP_GET_BIRDSTEP_RES_IDX(ind); - RETURN_INT(res->numcols); + RETURN_LONG(res->numcols); } /* }}} */ diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h index 430445b415..eb694577fb 100644 --- a/ext/odbc/php_birdstep.h +++ b/ext/odbc/php_birdstep.h @@ -28,28 +28,28 @@ typedef struct VConn { HDBC hdbc; - php_int_t index; + zend_long index; } VConn; typedef struct { char name[32]; char *value; - php_int_t vallen; + zend_long vallen; SDWORD valtype; } VResVal; typedef struct Vresult { HSTMT hstmt; VConn *conn; - php_int_t index; + zend_long index; VResVal *values; - php_int_t numcols; + zend_long numcols; int fetched; } Vresult; typedef struct { - php_int_t num_links; - php_int_t max_links; + zend_long num_links; + zend_long max_links; int le_link,le_result; } birdstep_module; diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 9747be9e0c..3912b52b13 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -718,84 +718,84 @@ PHP_MINIT_FUNCTION(odbc) odbc_module_entry.type = type; REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); /* Define Constants for options these Constants are defined in <sqlext.h> */ - REGISTER_INT_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); /* these are for the Data Source type */ - REGISTER_INT_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); /* * register the standard data types */ - REGISTER_INT_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); #if defined(ODBCVER) && (ODBCVER >= 0x0300) - REGISTER_INT_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); /* * SQLSpecialColumns values */ - REGISTER_INT_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); /* * SQLStatistics values */ - REGISTER_INT_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); #endif #if defined(HAVE_IBMDB2) && defined(_AIX) @@ -911,13 +911,13 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) { odbc_result *result; zval *pv_res; - php_int_t flag; + zend_long flag; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &flag) == FAILURE) { return; } - if (Z_IVAL_P(pv_res)) { + if (Z_LVAL_P(pv_res)) { ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); if (mode) { result->longreadlen = flag; @@ -1061,9 +1061,9 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) SQLLEN len; #endif zval *pv_res; - php_int_t pv_num; + zend_long pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { return; } @@ -1086,7 +1086,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); - RETURN_INT(len); + RETURN_LONG(len); } /* }}} */ @@ -1301,7 +1301,7 @@ PHP_FUNCTION(odbc_execute) } rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable); - params[i-1].vallen = Z_STRSIZE_P(tmp); + params[i-1].vallen = Z_STRLEN_P(tmp); params[i-1].fp = -1; if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); @@ -1321,14 +1321,14 @@ PHP_FUNCTION(odbc_execute) ctype = SQL_C_CHAR; } - if (Z_STRSIZE_P(tmp) > 2 && + if (Z_STRLEN_P(tmp) > 2 && Z_STRVAL_P(tmp)[0] == '\'' && - Z_STRVAL_P(tmp)[Z_STRSIZE_P(tmp) - 1] == '\'') { + Z_STRVAL_P(tmp)[Z_STRLEN_P(tmp) - 1] == '\'') { if (CHECK_ZVAL_NULL_PATH(tmp)) { RETURN_FALSE; } - filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRSIZE_P(tmp) - 2); + filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRLEN_P(tmp) - 2); filename[strlen(filename)] = '\0'; /* Check the basedir */ @@ -1518,13 +1518,13 @@ PHP_FUNCTION(odbc_cursor) PHP_FUNCTION(odbc_data_source) { zval *zv_conn; - php_int_t zv_fetch_type; + zend_long zv_fetch_type; RETCODE rc = 0; /* assume all is good */ odbc_connection *conn; UCHAR server_name[100], desc[200]; SQLSMALLINT len1=0, len2=0, fetch_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zv_conn, &zv_fetch_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zv_conn, &zv_fetch_type) == FAILURE) { return; } @@ -1573,7 +1573,7 @@ PHP_FUNCTION(odbc_data_source) PHP_FUNCTION(odbc_exec) { zval *pv_conn; - php_int_t pv_flags; + zend_long pv_flags; char *query; int numArgs, query_len; odbc_result *result = NULL; @@ -1585,7 +1585,7 @@ PHP_FUNCTION(odbc_exec) numArgs = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) { return; } @@ -1668,9 +1668,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) SQLUSMALLINT RowStatus[1]; SQLLEN rownum; zval *pv_res, tmp; - php_int_t pv_row = -1; + zend_long pv_row = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) { return; } @@ -1815,14 +1815,14 @@ PHP_FUNCTION(odbc_fetch_into) char *buf = NULL; zval *pv_res, *pv_res_arr, tmp; #ifdef HAVE_SQL_EXTENDED_FETCH - php_int_t pv_row = 0; + zend_long pv_row = 0; SQLULEN crow; SQLUSMALLINT RowStatus[1]; SQLLEN rownum = -1; #endif /* HAVE_SQL_EXTENDED_FETCH */ #ifdef HAVE_SQL_EXTENDED_FETCH - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|i", &pv_res, &pv_res_arr, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) { return; } @@ -1919,7 +1919,7 @@ PHP_FUNCTION(odbc_fetch_into) zend_hash_index_update(Z_ARRVAL_P(pv_res_arr), i, &tmp); } if (buf) efree(buf); - RETURN_INT(result->numcols); + RETURN_LONG(result->numcols); } /* }}} */ @@ -1964,13 +1964,13 @@ PHP_FUNCTION(odbc_fetch_row) odbc_result *result; RETCODE rc; zval *pv_res; - php_int_t pv_row = 1; + zend_long pv_row = 1; #ifdef HAVE_SQL_EXTENDED_FETCH SQLULEN crow; SQLUSMALLINT RowStatus[1]; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) { return; } @@ -2036,7 +2036,7 @@ PHP_FUNCTION(odbc_result) field = Z_STRVAL_P(pv_field); } else { convert_to_int_ex(pv_field); - field_ind = Z_IVAL_P(pv_field) - 1; + field_ind = Z_LVAL_P(pv_field) - 1; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -2231,7 +2231,7 @@ PHP_FUNCTION(odbc_result_all) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { php_printf("<h2>No rows found</h2>\n"); - RETURN_INT(0); + RETURN_LONG(0); } /* Start table tag */ @@ -2315,7 +2315,7 @@ PHP_FUNCTION(odbc_result_all) } php_printf("</table>\n"); if (buf) efree(buf); - RETURN_INT(result->fetched); + RETURN_LONG(result->fetched); } /* }}} */ @@ -2501,7 +2501,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) { char *db, *uid, *pwd; int db_len, uid_len, pwd_len; - php_int_t pv_opt = SQL_CUR_DEFAULT; + zend_long pv_opt = SQL_CUR_DEFAULT; odbc_connection *db_conn; char *hashed_details; int hashed_len, cur_opt; @@ -2509,7 +2509,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* Now an optional 4th parameter specifying the cursor type * defaulting to the cursors default */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) { return; } @@ -2709,7 +2709,7 @@ PHP_FUNCTION(odbc_num_rows) } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); SQLRowCount(result->stmt, &rows); - RETURN_INT(rows); + RETURN_LONG(rows); } /* }}} */ @@ -2774,7 +2774,7 @@ PHP_FUNCTION(odbc_num_fields) return; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); - RETURN_INT(result->numcols); + RETURN_LONG(result->numcols); } /* }}} */ @@ -2784,9 +2784,9 @@ PHP_FUNCTION(odbc_field_name) { odbc_result *result; zval *pv_res; - php_int_t pv_num; + zend_long pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { return; } @@ -2819,9 +2819,9 @@ PHP_FUNCTION(odbc_field_type) char tmp[32]; SQLSMALLINT tmplen; zval *pv_res; - php_int_t pv_num; + zend_long pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { return; } @@ -2893,7 +2893,7 @@ PHP_FUNCTION(odbc_field_num) if (field_ind == -1) { RETURN_FALSE; } - RETURN_INT(field_ind); + RETURN_LONG(field_ind); } /* }}} */ @@ -2905,9 +2905,9 @@ PHP_FUNCTION(odbc_autocommit) odbc_connection *conn; RETCODE rc; zval *pv_conn; - php_int_t pv_onoff = 0; + zend_long pv_onoff = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_onoff) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_onoff) == FAILURE) { return; } @@ -2928,7 +2928,7 @@ PHP_FUNCTION(odbc_autocommit) odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status"); RETURN_FALSE; } - RETVAL_INT((long)status); + RETVAL_LONG((long)status); } } /* }}} */ @@ -2969,14 +2969,14 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode) if (ZEND_NUM_ARGS() == 1) { ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn); - ptr = STR_ALLOC(len + 1, 0); + ptr = zend_string_alloc(len + 1, 0); if (mode == 0) { strlcpy(ptr->val, conn->laststate, len+1); } else { strlcpy(ptr->val, conn->lasterrormsg, len+1); } } else { - ptr = STR_ALLOC(len, 0); + ptr = zend_string_alloc(len, 0); if (mode == 0) { strlcpy(ptr->val, ODBCG(laststate), len+1); } else { @@ -3017,9 +3017,9 @@ PHP_FUNCTION(odbc_setoption) odbc_result *result; RETCODE rc; zval *pv_handle; - php_int_t pv_which, pv_opt, pv_val; + zend_long pv_which, pv_opt, pv_val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) { return; } @@ -3344,13 +3344,13 @@ PHP_FUNCTION(odbc_foreignkeys) PHP_FUNCTION(odbc_gettypeinfo) { zval *pv_conn; - php_int_t pv_data_type = SQL_ALL_TYPES; + zend_long pv_data_type = SQL_ALL_TYPES; odbc_result *result = NULL; odbc_connection *conn; RETCODE rc; SQLSMALLINT data_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_data_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_data_type) == FAILURE) { return; } @@ -3597,7 +3597,7 @@ PHP_FUNCTION(odbc_procedures) PHP_FUNCTION(odbc_specialcolumns) { zval *pv_conn; - php_int_t vtype, vscope, vnullable; + zend_long vtype, vscope, vnullable; odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *name = NULL; @@ -3605,7 +3605,7 @@ PHP_FUNCTION(odbc_specialcolumns) SQLUSMALLINT type, scope, nullable; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris!ssi", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vscope, &vnullable) == FAILURE) { return; } @@ -3667,7 +3667,7 @@ PHP_FUNCTION(odbc_specialcolumns) PHP_FUNCTION(odbc_statistics) { zval *pv_conn; - php_int_t vunique, vreserved; + zend_long vunique, vreserved; odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema, *name; @@ -3675,7 +3675,7 @@ PHP_FUNCTION(odbc_statistics) SQLUSMALLINT unique, reserved; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssii", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vunique, &vreserved) == FAILURE) { return; } diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index 14b3d6812d..f44b897b9b 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -161,7 +161,7 @@ PHP_FUNCTION(solid_fetch_prev); #define ODBC_TYPE "Birdstep" #define UNIX /* - * Extended Fetch in the Birdstep ODBC API is incapable of returning php_int_t varchar (memo) fields. + * Extended Fetch in the Birdstep ODBC API is incapable of returning zend_long varchar (memo) fields. * So the following line has been commented-out to accommodate. - KNS * * #define HAVE_SQL_EXTENDED_FETCH 1 @@ -247,7 +247,7 @@ typedef struct odbc_result { # if HAVE_SQL_EXTENDED_FETCH int fetch_abs; # endif - php_int_t longreadlen; + zend_long longreadlen; int binmode; int fetched; odbc_connection *conn_ptr; @@ -257,16 +257,16 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc) char *defDB; char *defUser; char *defPW; - php_int_t allow_persistent; - php_int_t check_persistent; - php_int_t max_persistent; - php_int_t max_links; - php_int_t num_persistent; - php_int_t num_links; + zend_long allow_persistent; + zend_long check_persistent; + zend_long max_persistent; + zend_long max_links; + zend_long num_persistent; + zend_long num_links; int defConn; - php_int_t defaultlrl; - php_int_t defaultbinmode; - php_int_t default_cursortype; + zend_long defaultlrl; + zend_long defaultbinmode; + zend_long default_cursortype; char laststate[6]; char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; HashTable *resource_list; diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index fb7e64bb6d..826e5716c8 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -644,14 +644,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT && opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) { ZEND_OP1_TYPE(opline) = IS_CONST; - LITERAL_INT(opline->op1, 1); + LITERAL_LONG(opline->op1, 1); } if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR && VAR_SOURCE(opline->op2) && VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) { ZEND_OP2_TYPE(opline) = IS_CONST; - LITERAL_INT(opline->op2, 1); + LITERAL_LONG(opline->op2, 1); } /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */ @@ -706,11 +706,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zend_op *sv = fcall-1; if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(sv) == IS_CONST && Z_TYPE(OPLINE_OP1_LITERAL(sv)) == IS_STRING && - Z_IVAL(OPLINE_OP2_LITERAL(sv)) == 1 + Z_LVAL(OPLINE_OP2_LITERAL(sv)) == 1 ) { zval *arg = &OPLINE_OP1_LITERAL(sv); - char *fname = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].function_name; - int flen = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].name_len; + char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name; + int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len; if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) { zval c; if(zend_get_persistent_constant(Z_STR_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) { @@ -903,17 +903,17 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) { convert_to_string_safe(&ZEND_OP1_LITERAL(last_op)); } - old_len = Z_STRSIZE(ZEND_OP1_LITERAL(last_op)); - l = old_len + Z_STRSIZE(ZEND_OP1_LITERAL(opline)); + old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op)); + l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(last_op)))) { - zend_string *tmp = STR_ALLOC(l, 0); + zend_string *tmp = zend_string_alloc(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len); Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp; } else { - Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0); + Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_realloc(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0); } Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC); @@ -947,19 +947,19 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, opline->opcode = ZEND_ADD_STRING; } COPY_NODE(opline->op1, src->op1); - old_len = Z_STRSIZE(ZEND_OP2_LITERAL(src)); - l = old_len + Z_STRSIZE(ZEND_OP2_LITERAL(opline)); + old_len = Z_STRLEN(ZEND_OP2_LITERAL(src)); + l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(src)))) { - zend_string *tmp = STR_ALLOC(l, 0); + zend_string *tmp = zend_string_alloc(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len); Z_STR(ZEND_OP2_LITERAL(last_op)) = tmp; } else { - Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0); + Z_STR(ZEND_OP2_LITERAL(src)) = zend_string_realloc(Z_STR(ZEND_OP2_LITERAL(src)), l, 0); } Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; - STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); + zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC); if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(opline)))) { Z_TYPE_FLAGS(ZEND_OP2_LITERAL(opline)) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE); @@ -972,7 +972,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, continue; } else if (opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) { /* convert ADD_CHAR(C1, C2) to CONCAT(C1, C2) */ - char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); opline->opcode = ZEND_CONCAT; continue; @@ -1002,8 +1002,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, int er; if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) && - ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && - Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) || + ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && + Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) || (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_DOUBLE && Z_DVAL(ZEND_OP2_LITERAL(opline)) == 0.0))) { if (RESULT_USED(opline)) { @@ -1062,7 +1062,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, opline->op2); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP1_LITERAL(opline), &c, 1); } SET_UNUSED(opline->op2); @@ -1077,13 +1077,13 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT && ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING && - Z_STRSIZE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { + Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { /* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */ zend_op *src = VAR_SOURCE(opline->op1); VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; @@ -1119,7 +1119,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index e941380738..a8cbcbfc8d 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -291,7 +291,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } @@ -345,13 +345,13 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } map[i] = l_true; break; - case IS_INT: - if ((pos = zend_hash_index_find(&hash, Z_IVAL(op_array->literals[i]))) != NULL) { - map[i] = Z_IVAL_P(pos); + case IS_LONG: + if ((pos = zend_hash_index_find(&hash, Z_LVAL(op_array->literals[i]))) != NULL) { + map[i] = Z_LVAL_P(pos); } else { map[i] = j; - ZVAL_INT(&zv, j); - zend_hash_index_update(&hash, Z_IVAL(op_array->literals[i]), &zv); + ZVAL_LONG(&zv, j); + zend_hash_index_update(&hash, Z_LVAL(op_array->literals[i]), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; @@ -361,10 +361,10 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c break; case IS_DOUBLE: if ((pos = zend_hash_str_find(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != NULL) { - map[i] = Z_IVAL_P(pos); + map[i] = Z_LVAL_P(pos); } else { map[i] = j; - ZVAL_INT(&zv, j); + ZVAL_LONG(&zv, j); zend_hash_str_add(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; @@ -377,32 +377,32 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c case IS_CONSTANT: if (info[i].flags & LITERAL_MAY_MERGE) { if (info[i].flags & LITERAL_EX_OBJ) { - int key_len = MAX_LENGTH_OF_ZEND_INT + sizeof("->") + Z_STRSIZE(op_array->literals[i]); - key = STR_ALLOC(key_len, 0); + int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]); + key = zend_string_alloc(key_len, 0); key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i])); } else if (info[i].flags & LITERAL_EX_CLASS) { int key_len; zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num]; - key_len = Z_STRSIZE_P(class_name) + sizeof("::") + Z_STRSIZE(op_array->literals[i]); - key = STR_ALLOC(key_len, 0); - memcpy(key->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); - memcpy(key->val + Z_STRSIZE_P(class_name), "::", sizeof("::") - 1); - memcpy(key->val + Z_STRSIZE_P(class_name) + sizeof("::") - 1, + key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]); + key = zend_string_alloc(key_len, 0); + memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); + memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1); + memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1, Z_STRVAL(op_array->literals[i]), - Z_STRSIZE(op_array->literals[i]) + 1); + Z_STRLEN(op_array->literals[i]) + 1); } else { - key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRSIZE(op_array->literals[i]), 0); + key = zend_string_init(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0); } key->h = zend_hash_func(key->val, key->len); key->h += info[i].flags; } if ((info[i].flags & LITERAL_MAY_MERGE) && (pos = zend_hash_find(&hash, key)) != NULL && - Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_IVAL_P(pos)]) && - info[i].flags == info[Z_IVAL_P(pos)].flags) { + Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) && + info[i].flags == info[Z_LVAL_P(pos)].flags) { - STR_RELEASE(key); - map[i] = Z_IVAL_P(pos); + zend_string_release(key); + map[i] = Z_LVAL_P(pos); zval_dtor(&op_array->literals[i]); n = LITERAL_NUM_RELATED(info[i].flags); while (n > 1) { @@ -413,9 +413,9 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } else { map[i] = j; if (info[i].flags & LITERAL_MAY_MERGE) { - ZVAL_INT(&zv, j); + ZVAL_LONG(&zv, j); zend_hash_add(&hash, key, &zv); - STR_RELEASE(key); + zend_string_release(key); } if (i != j) { op_array->literals[j] = op_array->literals[i]; @@ -472,7 +472,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } diff --git a/ext/opcache/Optimizer/nop_removal.c b/ext/opcache/Optimizer/nop_removal.c index 5f54408d16..80da02ce32 100644 --- a/ext/opcache/Optimizer/nop_removal.c +++ b/ext/opcache/Optimizer/nop_removal.c @@ -38,7 +38,7 @@ static void nop_removal(zend_op_array *op_array) /* GOTO target is unresolved yet. We can't optimize. */ if (opline->opcode == ZEND_GOTO && - Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { /* TODO: in general we can avoid this restriction */ FREE_ALLOCA(shiftlist); return; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index f98058fd9e..e4561f50b3 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -65,8 +65,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { int er; if (opline->opcode == ZEND_DIV && - Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && - Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && + Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) { /* div by 0 */ break; } @@ -103,7 +103,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { case _IS_BOOL: convert_to_boolean(&res); break; - case IS_INT: + case IS_LONG: convert_to_int(&res); break; case IS_DOUBLE: @@ -174,7 +174,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (next_op->opcode == ZEND_ADD_CHAR) { final_length += 1; } else { /* ZEND_ADD_STRING */ - final_length += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); + final_length += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); } next_op++; } @@ -182,32 +182,32 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } last_op = next_op; - final_length += (requires_conversion? 1 : Z_STRSIZE(ZEND_OP2_LITERAL(opline))); - str = STR_ALLOC(final_length, 0); + final_length += (requires_conversion? 1 : Z_STRLEN(ZEND_OP2_LITERAL(opline))); + str = zend_string_alloc(final_length, 0); ptr = str->val; ptr[final_length] = '\0'; if (requires_conversion) { /* ZEND_ADD_CHAR */ - char chval = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); + char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str); ptr[0] = chval; opline->opcode = ZEND_ADD_STRING; ptr++; } else { /* ZEND_ADD_STRING */ - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); - STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + zend_string_release(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = str; - ptr += Z_STRSIZE(ZEND_OP2_LITERAL(opline)); + ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline)); } - Z_STRSIZE(ZEND_OP2_LITERAL(opline)) = final_length; + Z_STRLEN(ZEND_OP2_LITERAL(opline)) = final_length; next_op = opline + 1; while (next_op < last_op) { if (next_op->opcode == ZEND_ADD_STRING) { - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRSIZE(ZEND_OP2_LITERAL(next_op))); - ptr += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRLEN(ZEND_OP2_LITERAL(next_op))); + ptr += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); literal_dtor(&ZEND_OP2_LITERAL(next_op)); } else { /* ZEND_ADD_CHAR */ - *ptr = (char)Z_IVAL(ZEND_OP2_LITERAL(next_op)); + *ptr = (char)Z_LVAL(ZEND_OP2_LITERAL(next_op)); ptr++; } MAKE_NOP(next_op); @@ -227,7 +227,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && + Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_execute_data *orig_execute_data = EG(current_execute_data); @@ -277,7 +277,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* for A::B */ if (op_array->scope && !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), - op_array->scope->name->val, Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1)) { + op_array->scope->name->val, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) { ce = op_array->scope; } else { if ((ce = zend_hash_find_ptr(EG(class_table), @@ -334,8 +334,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (collect_constants && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && - zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { + Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && + zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { if ((opline+1)->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(opline+1) == IS_CONST && @@ -364,17 +364,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { (opline + 2)->opcode == ZEND_DO_FCALL && ZEND_OP1_TYPE(opline + 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) == IS_STRING && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { - if ((Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && + if ((Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "function_exists", sizeof("function_exists")-1)) || - (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && + (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "is_callable", sizeof("is_callable")))) { zend_internal_function *func; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); - if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)))) != NULL && + if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)))) != NULL && func->type == ZEND_INTERNAL_FUNCTION && func->module->type == MODULE_PERSISTENT) { zval t; @@ -388,14 +388,14 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } efree(lc_name); - } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && + } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "extension_loaded", sizeof("extension_loaded")-1)) { zval t; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); zend_module_entry *m = zend_hash_str_find_ptr(&module_registry, - lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); + lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); efree(lc_name); if (!m) { @@ -419,7 +419,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 1); MAKE_NOP(opline + 2); } - } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && + } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "defined", sizeof("defined")-1)) { zval t; @@ -435,7 +435,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 2); } } - } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && + } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "constant", sizeof("constant")-1)) { zval t; @@ -450,12 +450,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } } else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 && - Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && + Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "strlen", sizeof("strlen")-1)) { zval t; - ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); + ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) { literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); @@ -471,7 +471,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { zval t; - ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline))); + ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline))); replace_tmp_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); @@ -535,7 +535,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->op1_type == IS_CONST && opline->op2_type == IS_UNUSED && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || + (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this") - 1) != 0)) { int var = opline->result.var; diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c index 1be6b9cb1c..374c6d2426 100644 --- a/ext/opcache/Optimizer/pass2.c +++ b/ext/opcache/Optimizer/pass2.c @@ -61,7 +61,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_SL: case ZEND_SR: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_INT) { + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) { convert_to_int(&ZEND_OP1_LITERAL(opline)); } } @@ -74,7 +74,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { convert_to_int(&ZEND_OP2_LITERAL(opline)); } } diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index a4bf4223a7..81ff920e10 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -61,7 +61,7 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) { 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] == name || @@ -75,7 +75,7 @@ static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) i = op_array->last_var; op_array->last_var++; op_array->vars = erealloc(op_array->vars, op_array->last_var * sizeof(zend_string*)); - op_array->vars[i] = STR_DUP(name, 0); + op_array->vars[i] = zend_string_dup(name, 0); /* all IS_TMP_VAR and IS_VAR variable numbers have to be adjusted */ { @@ -114,9 +114,9 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) return i; } -# 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_optimizer_add_literal(op_array, &_c TSRMLS_CC); \ } while (0) @@ -153,15 +153,15 @@ static void update_op1_const(zend_op_array *op_array, case ZEND_FETCH_CONSTANT: case ZEND_DEFINED: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); + zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1])); + zend_string_hash_val(Z_STR(op_array->literals[opline->op1.constant+1])); break; default: opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); + zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline))); break; } } else { @@ -176,15 +176,15 @@ static void update_op2_const(zend_op_array *op_array, { ZEND_OP2_TYPE(opline) = IS_CONST; if (opline->opcode == ZEND_INIT_FCALL) { - zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline))); + zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; return; } opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); if (Z_TYPE_P(val) == IS_STRING) { - STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline))); + zend_string_hash_val(Z_STR(ZEND_OP2_LITERAL(opline))); switch (opline->opcode) { case ZEND_FETCH_R: case ZEND_FETCH_W: @@ -200,15 +200,15 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_ADD_INTERFACE: case ZEND_ADD_TRAIT: Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); + zend_string_hash_val(Z_STR(op_array->literals[opline->op2.constant+1])); break; case ZEND_INIT_METHOD_CALL: case ZEND_INIT_STATIC_METHOD_CALL: - zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); - STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); + zend_string_hash_val(Z_STR(op_array->literals[opline->op2.constant+1])); /* break missing intentionally */ /*case ZEND_FETCH_CONSTANT:*/ case ZEND_ASSIGN_OBJ: @@ -273,11 +273,11 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_FETCH_DIM_TMP_VAR: check_numeric: { - zend_uint_t index; + zend_ulong index; if (ZEND_HANDLE_NUMERIC(Z_STR_P(val), index)) { zval_dtor(val); - ZVAL_INT(val, index); + ZVAL_LONG(val, index); op_array->literals[opline->op2.constant] = *val; } } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 46c406d99d..ad5a08a3d1 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -299,7 +299,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) { /* for now interned strings are supported only for non-ZTS build */ #ifndef ZTS - zend_uint_t h; + zend_ulong h; uint nIndex; uint idx; Bucket *p; @@ -309,7 +309,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) return str; } - h = STR_HASH_VAL(str); + h = zend_string_hash_val(str); nIndex = h & ZCSG(interned_strings).nTableMask; /* check for existing interned string */ @@ -318,7 +318,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) p = ZCSG(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; } } @@ -354,7 +354,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) ZVAL_STR(&p->val, p->key); Z_NEXT(p->val) = ZCSG(interned_strings).arHash[nIndex]; ZCSG(interned_strings).arHash[nIndex] = idx; - STR_RELEASE(str); + zend_string_release(str); return p->key; #else return str; @@ -374,7 +374,7 @@ static void accel_use_shm_interned_strings(TSRMLS_D) char s[2]; s[0] = j; s[1] = 0; - CG(one_char_string)[j] = accel_new_interned_string(STR_INIT(s, 1, 0) TSRMLS_CC); + CG(one_char_string)[j] = accel_new_interned_string(zend_string_init(s, 1, 0) TSRMLS_CC); } /* function table hash keys */ @@ -1268,8 +1268,8 @@ static void zend_accel_init_auto_globals(TSRMLS_D) int i, ag_size = (sizeof(jit_auto_globals_info) / sizeof(jit_auto_globals_info[0])); for (i = 0; i < ag_size ; i++) { - jit_auto_globals_str[i] = STR_INIT(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1); - STR_HASH_VAL(jit_auto_globals_str[i]); + jit_auto_globals_str[i] = zend_string_init(jit_auto_globals_info[i].name, jit_auto_globals_info[i].len, 1); + zend_string_hash_val(jit_auto_globals_str[i]); jit_auto_globals_str[i] = accel_new_interned_string(jit_auto_globals_str[i] TSRMLS_CC); } } @@ -1427,11 +1427,11 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han } if (file_handle->opened_path) { - new_persistent_script->full_path = STR_INIT(file_handle->opened_path, strlen(file_handle->opened_path), 0); + new_persistent_script->full_path = zend_string_init(file_handle->opened_path, strlen(file_handle->opened_path), 0); } else { - new_persistent_script->full_path = STR_INIT(file_handle->filename, strlen(file_handle->filename), 0); + new_persistent_script->full_path = zend_string_init(file_handle->filename, strlen(file_handle->filename), 0); } - STR_HASH_VAL(new_persistent_script->full_path); + zend_string_hash_val(new_persistent_script->full_path); /* Now persistent_script structure is ready in process memory */ return cache_script_in_shared_memory(new_persistent_script, key, key_length, from_shared_memory TSRMLS_CC); @@ -1959,7 +1959,7 @@ static void accel_fast_zval_dtor(zval *zvalue) zend_list_delete(Z_RES_P(zvalue)); } break; - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index c228301362..29b796698c 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -157,7 +157,7 @@ typedef struct _zend_persistent_script { zend_op_array main_op_array; HashTable function_table; HashTable class_table; - zend_int_t compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ + zend_long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ int ping_auto_globals_mask; /* which autoglobals are used by the script */ accel_time_t timestamp; /* the script modification time */ zend_bool corrupted; @@ -173,7 +173,7 @@ typedef struct _zend_persistent_script { #ifdef ZEND_WIN32 LONGLONG hits; #else - zend_uint_t hits; + zend_ulong hits; #endif unsigned int memory_consumption; unsigned int checksum; @@ -182,12 +182,12 @@ typedef struct _zend_persistent_script { } zend_persistent_script; typedef struct _zend_accel_directives { - zend_int_t memory_consumption; - zend_int_t max_accelerated_files; + zend_long memory_consumption; + zend_long max_accelerated_files; double max_wasted_percentage; char *user_blacklist_filename; - zend_int_t consistency_checks; - zend_int_t force_restart_timeout; + zend_long consistency_checks; + zend_long force_restart_timeout; zend_bool use_cwd; zend_bool ignore_dups; zend_bool validate_timestamps; @@ -199,18 +199,18 @@ typedef struct _zend_accel_directives { zend_bool file_override_enabled; zend_bool inherited_hack; zend_bool enable_cli; - zend_uint_t revalidate_freq; - zend_uint_t file_update_protection; + zend_ulong revalidate_freq; + zend_ulong file_update_protection; char *error_log; #ifdef ZEND_WIN32 char *mmap_base; #endif char *memory_model; - zend_int_t log_verbosity_level; + zend_long log_verbosity_level; - zend_int_t optimization_level; - zend_int_t max_file_size; - zend_int_t interned_strings_buffer; + zend_long optimization_level; + zend_long max_file_size; + zend_long interned_strings_buffer; char *restrict_api; } zend_accel_directives; @@ -244,12 +244,12 @@ typedef struct _zend_accel_globals { typedef struct _zend_accel_shared_globals { /* Cache Data Structures */ - zend_uint_t hits; - zend_uint_t misses; - zend_uint_t blacklist_misses; - zend_uint_t oom_restarts; /* number of restarts because of out of memory */ - zend_uint_t hash_restarts; /* number of restarts because of hash overflow */ - zend_uint_t manual_restarts; /* number of restarts scheduled by opcache_reset() */ + zend_ulong hits; + zend_ulong misses; + zend_ulong blacklist_misses; + zend_ulong oom_restarts; /* number of restarts because of out of memory */ + zend_ulong hash_restarts; /* number of restarts because of hash overflow */ + zend_ulong manual_restarts; /* number of restarts scheduled by opcache_reset() */ zend_accel_hash hash; /* hash table for cached scripts */ zend_accel_hash include_paths; /* used "include_path" values */ diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index dd3193a100..c9cfc03f00 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -57,7 +57,7 @@ void zend_accel_error(int type, const char *format, ...) } #ifdef ZTS - fprintf(fLog, "%s (" ZEND_UINT_FMT "): ", time_string, (zend_uint_t)tsrm_thread_id()); + fprintf(fLog, "%s (" ZEND_UINT_FMT "): ", time_string, (zend_ulong)tsrm_thread_id()); #else fprintf(fLog, "%s (%d): ", time_string, getpid()); #endif diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c index 71dd997b79..02474fc11f 100644 --- a/ext/opcache/zend_accelerator_hash.c +++ b/ext/opcache/zend_accelerator_hash.c @@ -73,8 +73,8 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size) */ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, zend_uint key_length, zend_bool indirect, void *data) { - zend_uint_t hash_value; - zend_uint_t index; + zend_ulong hash_value; + zend_ulong index; zend_accel_hash_entry *entry; zend_accel_hash_entry *indirect_bucket = NULL; @@ -142,8 +142,8 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char */ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_uint_t hash_value; - zend_uint_t index; + zend_ulong hash_value; + zend_ulong index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -170,8 +170,8 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key */ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_uint_t hash_value; - zend_uint_t index; + zend_ulong hash_value; + zend_ulong index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -195,8 +195,8 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_uint_t hash_value; - zend_uint_t index; + zend_ulong hash_value; + zend_ulong index; zend_accel_hash_entry *entry, *last_entry=NULL; hash_value = zend_inline_hash_func(key, key_length); diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h index 99e92cd194..2de28bffa7 100644 --- a/ext/opcache/zend_accelerator_hash.h +++ b/ext/opcache/zend_accelerator_hash.h @@ -45,7 +45,7 @@ typedef struct _zend_accel_hash_entry zend_accel_hash_entry; struct _zend_accel_hash_entry { - zend_uint_t hash_value; + zend_ulong hash_value; char *key; zend_uint key_length; zend_accel_hash_entry *next; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index db6f985b77..b97e56ac5b 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -100,8 +100,8 @@ static int validate_api_restriction(TSRMLS_D) static ZEND_INI_MH(OnUpdateMemoryConsumption) { - php_int_t *p; - php_int_t memsize; + zend_long *p; + zend_long memsize; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -111,7 +111,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (php_int_t *) (base + (size_t)mh_arg1); + p = (zend_long *) (base + (size_t)mh_arg1); memsize = atoi(new_value); /* sanity check we must use at least 8 MB */ if (memsize < 8) { @@ -137,8 +137,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) { - php_int_t *p; - php_int_t size; + zend_long *p; + zend_long size; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -148,7 +148,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (php_int_t *) (base + (size_t)mh_arg1); + p = (zend_long *) (base + (size_t)mh_arg1); size = atoi(new_value); /* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */ @@ -183,7 +183,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) static ZEND_INI_MH(OnUpdateMaxWastedPercentage) { double *p; - php_int_t percentage; + zend_long percentage; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -315,10 +315,10 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, &zfilename) == FAILURE || Z_TYPE(zfilename) != IS_STRING || - Z_STRSIZE(zfilename) == 0) { + Z_STRLEN(zfilename) == 0) { return 0; } - return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRSIZE(zfilename) TSRMLS_CC); + return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename) TSRMLS_CC); } static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS) @@ -407,7 +407,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS) char buf[32]; php_info_print_table_row(2, "Startup", "OK"); php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model()); - snprintf(buf, sizeof(buf), "%pd", (zend_uint_t)ZCSG(hits)); + snprintf(buf, sizeof(buf), "%pd", (zend_ulong)ZCSG(hits)); php_info_print_table_row(2, "Cache hits", buf); snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); php_info_print_table_row(2, "Cache misses", buf); @@ -487,17 +487,17 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) script = (zend_persistent_script *)cache_entry->data; array_init(&persistent_script_report); - add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0)); - add_assoc_int(&persistent_script_report, "hits", (zend_int_t)script->dynamic_members.hits); - add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); + add_assoc_str(&persistent_script_report, "full_path", zend_string_dup(script->full_path, 0)); + add_assoc_long(&persistent_script_report, "hits", (zend_long)script->dynamic_members.hits); + add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); ta = localtime(&script->dynamic_members.last_used); str = asctime(ta); len = strlen(str); if (len > 0 && str[len - 1] == '\n') len--; add_assoc_stringl(&persistent_script_report, "last_used", str, len); - add_assoc_int(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); + add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); if (ZCG(accel_directives).validate_timestamps) { - add_assoc_int(&persistent_script_report, "timestamp", (zend_int_t)script->timestamp); + add_assoc_long(&persistent_script_report, "timestamp", (zend_long)script->timestamp); } timerclear(&exec_time); timerclear(&fetch_time); @@ -514,7 +514,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) Obtain statistics information regarding code acceleration */ static ZEND_FUNCTION(opcache_get_status) { - zend_int_t reqs; + zend_long reqs; zval memory_usage, statistics, scripts; zend_bool fetch_scripts = 1; @@ -540,9 +540,9 @@ static ZEND_FUNCTION(opcache_get_status) /* Memory usage statistics */ array_init(&memory_usage); - add_assoc_int(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); - add_assoc_int(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); - add_assoc_int(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); + add_assoc_long(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); + add_assoc_long(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); + add_assoc_long(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); add_assoc_double(&memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0); add_assoc_zval(return_value, "memory_usage", &memory_usage); @@ -550,26 +550,26 @@ static ZEND_FUNCTION(opcache_get_status) zval interned_strings_usage; array_init(&interned_strings_usage); - add_assoc_int(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); - add_assoc_int(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); - add_assoc_int(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); - add_assoc_int(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); + add_assoc_long(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); + add_assoc_long(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); + add_assoc_long(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); + add_assoc_long(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); add_assoc_zval(return_value, "interned_strings_usage", &interned_strings_usage); } /* Accelerator statistics */ array_init(&statistics); - add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); - add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries); - add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); - add_assoc_int(&statistics, "hits", (zend_int_t)ZCSG(hits)); - add_assoc_int(&statistics, "start_time", ZCSG(start_time)); - add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time)); - add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts)); - add_assoc_int(&statistics, "hash_restarts", ZCSG(hash_restarts)); - add_assoc_int(&statistics, "manual_restarts", ZCSG(manual_restarts)); - add_assoc_int(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); - add_assoc_int(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); + add_assoc_long(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); + add_assoc_long(&statistics, "num_cached_keys", ZCSG(hash).num_entries); + add_assoc_long(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); + add_assoc_long(&statistics, "hits", (zend_long)ZCSG(hits)); + add_assoc_long(&statistics, "start_time", ZCSG(start_time)); + add_assoc_long(&statistics, "last_restart_time", ZCSG(last_restart_time)); + add_assoc_long(&statistics, "oom_restarts", ZCSG(oom_restarts)); + add_assoc_long(&statistics, "hash_restarts", ZCSG(hash_restarts)); + add_assoc_long(&statistics, "manual_restarts", ZCSG(manual_restarts)); + add_assoc_long(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); + add_assoc_long(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); reqs = ZCSG(hits)+ZCSG(misses); add_assoc_double(&statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0); add_assoc_double(&statistics, "opcache_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0); @@ -615,17 +615,17 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups); add_assoc_bool(&directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path); - add_assoc_int(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); - add_assoc_int(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); - add_assoc_int(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); - add_assoc_int(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); + add_assoc_long(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); + add_assoc_long(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); + add_assoc_long(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); + add_assoc_long(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); add_assoc_double(&directives, "opcache.max_wasted_percentage", ZCG(accel_directives).max_wasted_percentage); - add_assoc_int(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); - add_assoc_int(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); - add_assoc_int(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); + add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); + add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); + add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model)); add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename)); - add_assoc_int(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); + add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log)); add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory); @@ -633,7 +633,7 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.load_comments", ZCG(accel_directives).load_comments); add_assoc_bool(&directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown); add_assoc_bool(&directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled); - add_assoc_int(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); + add_assoc_long(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); add_assoc_zval(return_value, "directives", &directives); diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index c6534ca6c1..e096869b83 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -31,11 +31,11 @@ static zend_uint zend_accel_refcount = ZEND_PROTECTED_REFCOUNT; #if SIZEOF_SIZE_T <= SIZEOF_ZEND_INT /* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */ -# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old), (new)) -# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old)) +# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old), (new)) +# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old)) #else -# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new)) -# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new))) +# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_ulong)(zend_uintptr_t)(old), (void**)&(new)) +# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_ulong)(zend_uintptr_t)(old), (void**)&(new))) #endif typedef int (*id_function_t)(void *, void *); @@ -220,9 +220,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); } } @@ -232,14 +232,14 @@ static inline zend_string *zend_clone_str(zend_string *str TSRMLS_DC) if (IS_INTERNED(str)) { ret = str; - } else if (STR_REFCOUNT(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) { - ret = STR_DUP(str, 0); + } else if (zend_string_refcount(str) <= 1 || (ret = accel_xlat_get(str)) == NULL) { + ret = zend_string_dup(str, 0); GC_FLAGS(ret) = GC_FLAGS(str); - if (STR_REFCOUNT(str) > 1) { + if (zend_string_refcount(str) > 1) { accel_xlat_set(str, ret); } } else { - STR_ADDREF(ret); + zend_string_addref(ret); } return ret; } @@ -333,7 +333,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) { uint idx; Bucket *p, *q, *r; - zend_uint_t nIndex; + zend_ulong nIndex; TSRMLS_FETCH(); ht->nTableSize = source->nTableSize; @@ -412,7 +412,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class { uint idx; Bucket *p, *q; - zend_uint_t nIndex; + zend_ulong nIndex; zend_class_entry *new_ce; zend_function *new_prototype; zend_op_array *new_entry; @@ -490,7 +490,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla { uint idx; Bucket *p, *q; - zend_uint_t nIndex; + zend_ulong nIndex; zend_class_entry *new_ce; zend_property_info *prop_info; @@ -538,7 +538,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla prop_info->name = zend_clone_str(prop_info->name TSRMLS_CC); if (prop_info->doc_comment) { if (ZCG(accel_directives).load_comments) { - prop_info->doc_comment = STR_DUP(prop_info->doc_comment, 0); + prop_info->doc_comment = zend_string_dup(prop_info->doc_comment, 0); } else { prop_info->doc_comment = NULL; } @@ -642,7 +642,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce) } if (ZEND_CE_DOC_COMMENT(ce)) { if (ZCG(accel_directives).load_comments) { - ZEND_CE_DOC_COMMENT(ce) = STR_DUP(ZEND_CE_DOC_COMMENT(ce), 0); + ZEND_CE_DOC_COMMENT(ce) = zend_string_dup(ZEND_CE_DOC_COMMENT(ce), 0); } else { ZEND_CE_DOC_COMMENT(ce) = NULL; } @@ -883,9 +883,9 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0); if (!zend_hash_exists(EG(zend_constants), name)) { - zend_register_int_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); + zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); } - STR_RELEASE(name); + zend_string_release(name); } zend_hash_destroy(&ZCG(bind_hash)); diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 9ea33adff1..67e3ab05a1 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -36,19 +36,19 @@ #define zend_accel_store_string(str) do { \ zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \ if (new_str) { \ - STR_RELEASE(str); \ + zend_string_release(str); \ str = new_str; \ } else { \ new_str = zend_accel_memdup((void*)str, _STR_HEADER_SIZE + (str)->len + 1); \ - STR_RELEASE(str); \ + zend_string_release(str); \ str = new_str; \ - STR_HASH_VAL(str); \ + zend_string_hash_val(str); \ GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \ } \ } while (0) #define zend_accel_memdup_string(str) do { \ str = zend_accel_memdup(str, _STR_HEADER_SIZE + (str)->len + 1); \ - STR_HASH_VAL(str); \ + zend_string_hash_val(str); \ GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \ } while (0) #define zend_accel_store_interned_string(str) do { \ @@ -292,7 +292,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc fake_execute_data.func = (zend_function*)op_array; EG(current_execute_data) = &fake_execute_data; if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { - main_persistent_script->compiler_halt_offset = Z_IVAL_P(offset); + main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset); } EG(current_execute_data) = orig_execute_data; } @@ -433,7 +433,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc } } else { if (!already_stored) { - STR_RELEASE(op_array->doc_comment); + zend_string_release(op_array->doc_comment); } op_array->doc_comment = NULL; } @@ -488,7 +488,7 @@ static void zend_persist_property_info(zval *zv TSRMLS_DC) if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) { zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment); } - STR_RELEASE(prop->doc_comment); + zend_string_release(prop->doc_comment); prop->doc_comment = NULL; } } @@ -532,7 +532,7 @@ static void zend_persist_class_entry(zval *zv TSRMLS_DC) } else { if (!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) { zend_shared_alloc_register_xlat_entry(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT(ce)); - STR_RELEASE(ZEND_CE_DOC_COMMENT(ce)); + zend_string_release(ZEND_CE_DOC_COMMENT(ce)); } ZEND_CE_DOC_COMMENT(ce) = NULL; } diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 08e9211350..1ffc98597a 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -38,7 +38,7 @@ zend_string *tmp = accel_new_interned_string(str TSRMLS_CC); \ if (tmp != (str)) { \ if (do_free) { \ - /*STR_RELEASE(str);*/ \ + /*zend_string_release(str);*/ \ } \ (str) = tmp; \ } else { \ diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 8a60d75736..981829f5b7 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -288,7 +288,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void) #define MIN_FREE_MEMORY 64*1024 #define SHARED_ALLOC_FAILED() do { \ - zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_int_t)size, (zend_int_t)ZSMMG(shared_free)); \ + zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_long)size, (zend_long)ZSMMG(shared_free)); \ if (zend_shared_alloc_get_largest_free_block() < MIN_FREE_MEMORY) { \ ZSMMG(memory_exhausted) = 1; \ } \ @@ -327,7 +327,7 @@ int zend_shared_memdup_size(void *source, size_t size) { void *old_p; - if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) { + if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)source)) != NULL) { /* we already duplicated this pointer */ return 0; } @@ -339,7 +339,7 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML { void *old_p, *retval; - if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) { + if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)source)) != NULL) { /* we already duplicated this pointer */ return old_p; } @@ -431,14 +431,14 @@ void zend_shared_alloc_clear_xlat_table(void) void zend_shared_alloc_register_xlat_entry(const void *old, const void *new) { - zend_hash_index_update_ptr(&xlat_table, (zend_uint_t)old, (void*)new); + zend_hash_index_update_ptr(&xlat_table, (zend_ulong)old, (void*)new); } void *zend_shared_alloc_get_xlat_entry(const void *old) { void *retval; - if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)old)) == NULL) { + if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)old)) == NULL) { return NULL; } return retval; diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index b16b1a30dd..ec7cc14d07 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -130,7 +130,7 @@ int zend_shared_memdup_size(void *p, size_t size); typedef union _align_test { void *ptr; double dbl; - zend_int_t lng; + zend_long lng; } align_test; #if ZEND_GCC_VERSION >= 2000 diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 527c1cc0e7..fbe83a5f8a 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -669,7 +669,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s add_next_index_stringl(data, (char *)to_add, to_add_len); } else if (Z_TYPE_P(data) == IS_STRING) { array_init(&tmp); - add_next_index_str(&tmp, STR_COPY(Z_STR_P(data))); + add_next_index_str(&tmp, zend_string_copy(Z_STR_P(data))); add_next_index_stringl(&tmp, (char *)to_add, to_add_len); zend_hash_str_update(Z_ARRVAL(subitem), sname, strlen(sname), &tmp); } @@ -844,12 +844,12 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */ varname = defval #define SET_OPTIONAL_LONG_ARG(key, varname, defval) \ - if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_INT) \ - varname = Z_IVAL_P(item); \ + if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_LONG) \ + varname = Z_LVAL_P(item); \ else \ varname = defval -static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo); +static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(zend_long algo); int openssl_spki_cleanup(const char *src, char *dest); @@ -905,8 +905,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option } if (req->priv_key_encrypt && optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher")-1)) != NULL - && Z_TYPE_P(item) == IS_INT) { - php_int_t cipher_algo = Z_IVAL_P(item); + && Z_TYPE_P(item) == IS_LONG) { + zend_long cipher_algo = Z_LVAL_P(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm for private key."); @@ -1012,7 +1012,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see } /* }}} */ -static EVP_MD * php_openssl_get_evp_md_from_algo(php_int_t algo) { /* {{{ */ +static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */ EVP_MD *mdtype; switch (algo) { @@ -1058,7 +1058,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(php_int_t algo) { /* {{{ */ } /* }}} */ -static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo) { /* {{{ */ +static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(zend_long algo) { /* {{{ */ switch (algo) { #ifndef OPENSSL_NO_RC2 case PHP_OPENSSL_CIPHER_RC2_40: @@ -1130,86 +1130,86 @@ PHP_MINIT_FUNCTION(openssl) ssl_stream_data_index = SSL_get_ex_new_index(0, "PHP stream index", NULL, NULL, NULL); REGISTER_STRING_CONSTANT("OPENSSL_VERSION_TEXT", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); /* purposes for cert purpose checking */ - REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); #ifdef X509_PURPOSE_ANY - REGISTER_INT_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); #endif /* signature algorithm constants */ - REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_OPENSSL_MD2_H - REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090708fL - REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); #endif /* flags for S/MIME */ - REGISTER_INT_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); /* Informational stream wrapper constants */ REGISTER_STRING_CONSTANT("OPENSSL_DEFAULT_STREAM_CIPHERS", OPENSSL_DEFAULT_STREAM_CIPHERS, CONST_CS|CONST_PERSISTENT); /* Ciphers */ #ifndef OPENSSL_NO_RC2 - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_DES - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_AES - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); #endif /* Values for key types */ - REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); #ifndef NO_DSA - REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_EVP_PKEY_EC - REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) /* SNI support included in OpenSSL >= 0.9.8j */ - REGISTER_INT_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); #endif /* Determine default SSL configuration file */ @@ -1361,7 +1361,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso /* force it to be a string and check if it refers to a file */ convert_to_string_ex(val); - if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { /* read cert from the named file */ BIO *in; @@ -1378,7 +1378,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso } else { BIO *in; - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); if (in == NULL) { return NULL; } @@ -1453,7 +1453,7 @@ PHP_FUNCTION(openssl_spki_new) zend_string * s = NULL; zend_resource *keyresource = NULL; const char *spkac = "SPKAC="; - php_int_t algo = OPENSSL_ALGO_MD5; + zend_long algo = OPENSSL_ALGO_MD5; zval *method = NULL; zval * zpkey = NULL; @@ -1474,8 +1474,8 @@ PHP_FUNCTION(openssl_spki_new) } if (method != NULL) { - if (Z_TYPE_P(method) == IS_INT) { - algo = Z_IVAL_P(method); + if (Z_TYPE_P(method) == IS_LONG) { + algo = Z_LVAL_P(method); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Algorithm must be of supported type"); goto cleanup; @@ -1513,7 +1513,7 @@ PHP_FUNCTION(openssl_spki_new) goto cleanup; } - s = STR_ALLOC(strlen(spkac) + strlen(spkstr), 0); + s = zend_string_alloc(strlen(spkac) + strlen(spkstr), 0); sprintf(s->val, "%s%s", spkac, spkstr); s->len = strlen(s->val); @@ -1537,7 +1537,7 @@ cleanup: } if (keyresource == NULL && s != NULL) { - STR_RELEASE(s); + zend_string_release(s); } } /* }}} */ @@ -1776,9 +1776,9 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_b } if (raw) { - ret = STR_INIT((char*)md, n, 0); + ret = zend_string_init((char*)md, n, 0); } else { - ret = STR_ALLOC(n * 2, 0); + ret = zend_string_alloc(n * 2, 0); make_digest_ex(ret->val, md, n); ret->val[n * 2] = '\0'; } @@ -1958,22 +1958,22 @@ PHP_FUNCTION(openssl_x509_parse) } add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC); - add_assoc_int(return_value, "version", X509_get_version(cert)); + add_assoc_long(return_value, "version", X509_get_version(cert)); add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert))); add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert)); add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert)); - add_assoc_int(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); - add_assoc_int(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); + add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); + add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); tmpstr = (char *)X509_alias_get0(cert, NULL); if (tmpstr) { add_assoc_string(return_value, "alias", tmpstr); } /* - add_assoc_int(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); + add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert))); add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert))); */ @@ -2137,15 +2137,15 @@ PHP_FUNCTION(openssl_x509_checkpurpose) X509 * cert = NULL; zend_resource *certresource = NULL; STACK_OF(X509) * untrustedchain = NULL; - php_int_t purpose; + zend_long purpose; char * untrusted = NULL; int untrusted_len = 0, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) { return; } - RETVAL_INT(-1); + RETVAL_LONG(-1); if (untrusted) { untrustedchain = load_all_certs_from_file(untrusted); @@ -2165,7 +2165,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) ret = check_cert(cainfo, cert, untrustedchain, purpose); if (ret != 0 && ret != 1) { - RETVAL_INT(ret); + RETVAL_LONG(ret); } else { RETVAL_BOOL(ret); } @@ -2768,7 +2768,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r return NULL; } - if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } if (filename) { @@ -2777,7 +2777,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); } csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); BIO_free(in); @@ -2881,8 +2881,8 @@ PHP_FUNCTION(openssl_csr_export) PHP_FUNCTION(openssl_csr_sign) { zval * zcert = NULL, *zcsr, *zpkey, *args = NULL; - php_int_t num_days; - php_int_t serial = Z_I(0); + zend_long num_days; + zend_long serial = Z_I(0); X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key = NULL; @@ -2890,7 +2890,7 @@ PHP_FUNCTION(openssl_csr_sign) int i; struct php_x509_request req; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zi|a!i", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) return; RETVAL_FALSE; @@ -3260,7 +3260,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } convert_to_string_ex(val); - if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } /* it's an X509 file/cert of some kind, and we need to extract the data from that */ @@ -3274,7 +3274,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p if (filename) { in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); } if (in == NULL) { TMP_CLEAN; @@ -3292,7 +3292,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); } if (in == NULL) { @@ -3455,7 +3455,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC) #define OPENSSL_PKEY_GET_BN(_type, _name) do { \ if (pkey->pkey._type->_name != NULL) { \ int len = BN_num_bytes(pkey->pkey._type->_name); \ - zend_string *str = STR_ALLOC(len, 0); \ + zend_string *str = zend_string_alloc(len, 0); \ BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str->val); \ str->val[len] = 0; \ add_assoc_str(&_type, #_name, str); \ @@ -3468,7 +3468,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC) Z_TYPE_P(bn) == IS_STRING) { \ _type->_name = BN_bin2bn( \ (unsigned char*)Z_STRVAL_P(bn), \ - Z_STRSIZE_P(bn), NULL); \ + Z_STRLEN_P(bn), NULL); \ } \ } while (0); @@ -3771,7 +3771,7 @@ PHP_FUNCTION(openssl_pkey_get_details) BIO *out; unsigned int pbio_len; char *pbio; - php_int_t ktype; + zend_long ktype; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &key) == FAILURE) { return; @@ -3785,7 +3785,7 @@ PHP_FUNCTION(openssl_pkey_get_details) pbio_len = BIO_get_mem_data(out, &pbio); array_init(return_value); - add_assoc_int(return_value, "bits", EVP_PKEY_bits(pkey)); + add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey)); add_assoc_stringl(return_value, "key", pbio, pbio_len); /*TODO: Use the real values once the openssl constants are used * See the enum at the top of this file @@ -3854,7 +3854,7 @@ PHP_FUNCTION(openssl_pkey_get_details) ktype = -1; break; } - add_assoc_int(return_value, "type", ktype); + add_assoc_long(return_value, "type", ktype); BIO_free(out); } @@ -3868,7 +3868,7 @@ PHP_FUNCTION(openssl_pkey_get_details) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ PHP_FUNCTION(openssl_pbkdf2) { - php_int_t key_length = 0, iterations = 0; + zend_long key_length = 0, iterations = 0; char *password; int password_len; char *salt; int salt_len; char *method; int method_len = 0; @@ -3876,7 +3876,7 @@ PHP_FUNCTION(openssl_pbkdf2) const EVP_MD *digest; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssii|s", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", &password, &password_len, &salt, &salt_len, &key_length, &iterations, @@ -3899,13 +3899,13 @@ PHP_FUNCTION(openssl_pbkdf2) RETURN_FALSE; } - out_buffer = STR_ALLOC(key_length, 0); + out_buffer = zend_string_alloc(key_length, 0); if (PKCS5_PBKDF2_HMAC(password, password_len, (unsigned char *)salt, salt_len, iterations, digest, key_length, (unsigned char*)out_buffer->val) == 1) { out_buffer->val[key_length] = 0; RETURN_STR(out_buffer); } else { - STR_RELEASE(out_buffer); + zend_string_release(out_buffer); RETURN_FALSE; } } @@ -3925,15 +3925,15 @@ PHP_FUNCTION(openssl_pkcs7_verify) STACK_OF(X509) *others = NULL; PKCS7 * p7 = NULL; BIO * in = NULL, * datain = NULL, * dataout = NULL; - php_int_t flags = 0; + zend_long flags = 0; char * filename; int filename_len; char * extracerts = NULL; int extracerts_len = 0; char * signersfilename = NULL; int signersfilename_len = 0; char * datafilename = NULL; int datafilename_len = 0; - RETVAL_INT(-1); + RETVAL_LONG(-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|papp", &filename, &filename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|papp", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, &extracerts, &extracerts_len, &datafilename, &datafilename_len) == FAILURE) { return; @@ -4007,7 +4007,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) sk_X509_free(signers); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename); - RETVAL_INT(-1); + RETVAL_LONG(-1); } } goto clean_exit; @@ -4031,19 +4031,19 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) zval * zrecipcerts, * zheaders = NULL; STACK_OF(X509) * recipcerts = NULL; BIO * infile = NULL, * outfile = NULL; - php_int_t flags = 0; + zend_long flags = 0; PKCS7 * p7 = NULL; zval * zcertval; X509 * cert; const EVP_CIPHER *cipher = NULL; - php_int_t cipherid = PHP_OPENSSL_CIPHER_DEFAULT; + zend_long cipherid = PHP_OPENSSL_CIPHER_DEFAULT; zend_string * strindex; char * infilename = NULL; int infilename_len; char * outfilename = NULL; int outfilename_len; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ii", &infilename, &infilename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ll", &infilename, &infilename_len, &outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE) return; @@ -4157,7 +4157,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) zval * hval; X509 * cert = NULL; EVP_PKEY * privkey = NULL; - php_int_t flags = PKCS7_DETACHED; + zend_long flags = PKCS7_DETACHED; PKCS7 * p7 = NULL; BIO * infile = NULL, * outfile = NULL; STACK_OF(X509) *others = NULL; @@ -4167,7 +4167,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) char * outfilename; int outfilename_len; char * extracertsfilename = NULL; int extracertsfilename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|ip", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|lp", &infilename, &infilename_len, &outfilename, &outfilename_len, &zcert, &zprivkey, &zheaders, &flags, &extracertsfilename, &extracertsfilename_len) == FAILURE) { @@ -4334,9 +4334,9 @@ PHP_FUNCTION(openssl_private_encrypt) zend_resource *keyresource = NULL; char * data; int data_len; - php_int_t padding = RSA_PKCS1_PADDING; + zend_long padding = RSA_PKCS1_PADDING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4349,7 +4349,7 @@ PHP_FUNCTION(openssl_private_encrypt) } cryptedlen = EVP_PKEY_size(pkey); - cryptedbuf = STR_ALLOC(cryptedlen, 0); + cryptedbuf = zend_string_alloc(cryptedlen, 0); switch (pkey->type) { case EVP_PKEY_RSA: @@ -4372,7 +4372,7 @@ PHP_FUNCTION(openssl_private_encrypt) RETVAL_TRUE; } if (cryptedbuf) { - STR_RELEASE(cryptedbuf); + zend_string_release(cryptedbuf); } if (keyresource == NULL) { EVP_PKEY_free(pkey); @@ -4390,12 +4390,12 @@ PHP_FUNCTION(openssl_private_decrypt) zend_string *cryptedbuf = NULL; unsigned char *crypttemp; int successful = 0; - php_int_t padding = RSA_PKCS1_PADDING; + zend_long padding = RSA_PKCS1_PADDING; zend_resource *keyresource = NULL; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4418,7 +4418,7 @@ PHP_FUNCTION(openssl_private_decrypt) pkey->pkey.rsa, padding); if (cryptedlen != -1) { - cryptedbuf = STR_ALLOC(cryptedlen, 0); + cryptedbuf = zend_string_alloc(cryptedlen, 0); memcpy(cryptedbuf->val, crypttemp, cryptedlen); successful = 1; } @@ -4441,7 +4441,7 @@ PHP_FUNCTION(openssl_private_decrypt) EVP_PKEY_free(pkey); } if (cryptedbuf) { - STR_RELEASE(cryptedbuf); + zend_string_release(cryptedbuf); } } /* }}} */ @@ -4456,11 +4456,11 @@ PHP_FUNCTION(openssl_public_encrypt) zend_string *cryptedbuf; int successful = 0; zend_resource *keyresource = NULL; - php_int_t padding = RSA_PKCS1_PADDING; + zend_long padding = RSA_PKCS1_PADDING; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) return; RETVAL_FALSE; @@ -4471,7 +4471,7 @@ PHP_FUNCTION(openssl_public_encrypt) } cryptedlen = EVP_PKEY_size(pkey); - cryptedbuf = STR_ALLOC(cryptedlen, 0); + cryptedbuf = zend_string_alloc(cryptedlen, 0); switch (pkey->type) { case EVP_PKEY_RSA: @@ -4498,7 +4498,7 @@ PHP_FUNCTION(openssl_public_encrypt) EVP_PKEY_free(pkey); } if (cryptedbuf) { - STR_RELEASE(cryptedbuf); + zend_string_release(cryptedbuf); } } /* }}} */ @@ -4514,11 +4514,11 @@ PHP_FUNCTION(openssl_public_decrypt) unsigned char *crypttemp; int successful = 0; zend_resource *keyresource = NULL; - php_int_t padding = RSA_PKCS1_PADDING; + zend_long padding = RSA_PKCS1_PADDING; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4541,7 +4541,7 @@ PHP_FUNCTION(openssl_public_decrypt) pkey->pkey.rsa, padding); if (cryptedlen != -1) { - cryptedbuf = STR_ALLOC(cryptedlen, 0); + cryptedbuf = zend_string_alloc(cryptedlen, 0); memcpy(cryptedbuf->val, crypttemp, cryptedlen); successful = 1; } @@ -4563,7 +4563,7 @@ PHP_FUNCTION(openssl_public_decrypt) } if (cryptedbuf) { - STR_RELEASE(cryptedbuf); + zend_string_release(cryptedbuf); } if (keyresource == NULL) { EVP_PKEY_free(pkey); @@ -4604,7 +4604,7 @@ PHP_FUNCTION(openssl_sign) int data_len; EVP_MD_CTX md_ctx; zval *method = NULL; - php_int_t signature_algo = OPENSSL_ALGO_SHA1; + zend_long signature_algo = OPENSSL_ALGO_SHA1; const EVP_MD *mdtype; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|z", &data, &data_len, &signature, &key, &method) == FAILURE) { @@ -4616,9 +4616,9 @@ PHP_FUNCTION(openssl_sign) RETURN_FALSE; } - if (method == NULL || Z_TYPE_P(method) == IS_INT) { + if (method == NULL || Z_TYPE_P(method) == IS_LONG) { if (method != NULL) { - signature_algo = Z_IVAL_P(method); + signature_algo = Z_LVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4633,7 +4633,7 @@ PHP_FUNCTION(openssl_sign) } siglen = EVP_PKEY_size(pkey); - sigbuf = STR_ALLOC(siglen, 0); + sigbuf = zend_string_alloc(siglen, 0); EVP_SignInit(&md_ctx, mdtype); EVP_SignUpdate(&md_ctx, data, data_len); @@ -4667,15 +4667,15 @@ PHP_FUNCTION(openssl_verify) char * data; int data_len; char * signature; int signature_len; zval *method = NULL; - php_int_t signature_algo = OPENSSL_ALGO_SHA1; + zend_long signature_algo = OPENSSL_ALGO_SHA1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z", &data, &data_len, &signature, &signature_len, &key, &method) == FAILURE) { return; } - if (method == NULL || Z_TYPE_P(method) == IS_INT) { + if (method == NULL || Z_TYPE_P(method) == IS_LONG) { if (method != NULL) { - signature_algo = Z_IVAL_P(method); + signature_algo = Z_LVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4703,7 +4703,7 @@ PHP_FUNCTION(openssl_verify) if (keyresource == NULL) { EVP_PKEY_free(pkey); } - RETURN_INT(err); + RETURN_LONG(err); } /* }}} */ @@ -4790,7 +4790,7 @@ PHP_FUNCTION(openssl_seal) if (len1 + len2 > 0) { zval_dtor(sealdata); buf[len1 + len2] = '\0'; - ZVAL_STR(sealdata, STR_INIT((char*)buf, len1 + len2, 0)); + ZVAL_STR(sealdata, zend_string_init((char*)buf, len1 + len2, 0)); efree(buf); zval_dtor(ekeys); @@ -4815,7 +4815,7 @@ PHP_FUNCTION(openssl_seal) } else { efree(buf); } - RETVAL_INT(len1 + len2); + RETVAL_LONG(len1 + len2); EVP_CIPHER_CTX_cleanup(&ctx); clean_exit: @@ -4879,7 +4879,7 @@ PHP_FUNCTION(openssl_open) } else { zval_dtor(opendata); buf[len1 + len2] = '\0'; - ZVAL_STR(opendata, STR_INIT((char*)buf, len1 + len2, 0)); + ZVAL_STR(opendata, zend_string_init((char*)buf, len1 + len2, 0)); efree(buf); RETVAL_TRUE; } @@ -4962,7 +4962,7 @@ PHP_FUNCTION(openssl_digest) } siglen = EVP_MD_size(mdtype); - sigbuf = STR_ALLOC(siglen, 0); + sigbuf = zend_string_alloc(siglen, 0); EVP_DigestInit(&md_ctx, mdtype); EVP_DigestUpdate(&md_ctx, (unsigned char *)data, data_len); @@ -4973,15 +4973,15 @@ PHP_FUNCTION(openssl_digest) RETVAL_STR(sigbuf); } else { int digest_str_len = siglen * 2; - zend_string *digest_str = STR_ALLOC(digest_str_len, 0); + zend_string *digest_str = zend_string_alloc(digest_str_len, 0); make_digest_ex(digest_str->val, (unsigned char*)sigbuf->val, siglen); digest_str->val[digest_str_len] = '\0'; - STR_RELEASE(sigbuf); + zend_string_release(sigbuf); RETVAL_STR(digest_str); } } else { - STR_RELEASE(sigbuf); + zend_string_release(sigbuf); RETVAL_FALSE; } } @@ -5025,7 +5025,7 @@ static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_requir Encrypts given data with given method and key, returns raw or base64 encoded string */ PHP_FUNCTION(openssl_encrypt) { - php_int_t options = 0; + zend_long options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0, max_iv_len; const EVP_CIPHER *cipher_type; @@ -5035,7 +5035,7 @@ PHP_FUNCTION(openssl_encrypt) unsigned char *key; zend_bool free_iv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); @@ -5060,7 +5060,7 @@ PHP_FUNCTION(openssl_encrypt) free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); - outbuf = STR_ALLOC(outlen, 0); + outbuf = zend_string_alloc(outlen, 0); EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { @@ -5084,11 +5084,11 @@ PHP_FUNCTION(openssl_encrypt) zend_string *base64_str; base64_str = php_base64_encode((unsigned char*)outbuf->val, outlen); - STR_RELEASE(outbuf); + zend_string_release(outbuf); RETVAL_STR(base64_str); } } else { - STR_RELEASE(outbuf); + zend_string_release(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { @@ -5105,7 +5105,7 @@ PHP_FUNCTION(openssl_encrypt) Takes raw or base64 encoded string and dectupt it using given method and key */ PHP_FUNCTION(openssl_decrypt) { - php_int_t options = 0; + zend_long options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0; const EVP_CIPHER *cipher_type; @@ -5116,7 +5116,7 @@ PHP_FUNCTION(openssl_decrypt) zend_string *base64_str = NULL; zend_bool free_iv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } @@ -5153,7 +5153,7 @@ PHP_FUNCTION(openssl_decrypt) free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type) TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); - outbuf = STR_ALLOC(outlen, 0); + outbuf = zend_string_alloc(outlen, 0); EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { @@ -5171,7 +5171,7 @@ PHP_FUNCTION(openssl_decrypt) outbuf->len = outlen; RETVAL_STR(outbuf); } else { - STR_RELEASE(outbuf); + zend_string_release(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { @@ -5181,7 +5181,7 @@ PHP_FUNCTION(openssl_decrypt) efree(iv); } if (base64_str) { - STR_RELEASE(base64_str); + zend_string_release(base64_str); } EVP_CIPHER_CTX_cleanup(&cipher_ctx); } @@ -5209,7 +5209,7 @@ PHP_FUNCTION(openssl_cipher_iv_length) RETURN_FALSE; } - RETURN_INT(EVP_CIPHER_iv_length(cipher_type)); + RETURN_LONG(EVP_CIPHER_iv_length(cipher_type)); } /* }}} */ @@ -5236,7 +5236,7 @@ PHP_FUNCTION(openssl_dh_compute_key) pub = BN_bin2bn((unsigned char*)pub_str, pub_len, NULL); - data = STR_ALLOC(DH_size(pkey->pkey.dh), 0); + data = zend_string_alloc(DH_size(pkey->pkey.dh), 0); len = DH_compute_key((unsigned char*)data->val, pub, pkey->pkey.dh); if (len >= 0) { @@ -5244,7 +5244,7 @@ PHP_FUNCTION(openssl_dh_compute_key) data->val[len] = 0; RETVAL_STR(data); } else { - STR_RELEASE(data); + zend_string_release(data); RETVAL_FALSE; } @@ -5256,12 +5256,12 @@ PHP_FUNCTION(openssl_dh_compute_key) Returns a string of the length specified filled with random pseudo bytes */ PHP_FUNCTION(openssl_random_pseudo_bytes) { - php_int_t buffer_length; + zend_long buffer_length; zend_string *buffer = NULL; zval *zstrong_result_returned = NULL; int strong_result = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z/", &buffer_length, &zstrong_result_returned) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z/", &buffer_length, &zstrong_result_returned) == FAILURE) { return; } @@ -5274,13 +5274,13 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) ZVAL_BOOL(zstrong_result_returned, 0); } - buffer = STR_ALLOC(buffer_length, 0); + buffer = zend_string_alloc(buffer_length, 0); #ifdef PHP_WIN32 strong_result = 1; /* random/urandom equivalent on Windows */ if (php_win32_get_random_bytes((unsigned char*)buffer->val, (size_t) buffer_length) == FAILURE){ - STR_RELEASE(buffer); + zend_string_release(buffer); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, 0); } @@ -5288,7 +5288,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes) } #else if ((strong_result = RAND_pseudo_bytes((unsigned char*)buffer->val, buffer_length)) < 0) { - STR_RELEASE(buffer); + zend_string_release(buffer); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, 0); } diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 06810cdbd8..a2406fb572 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -69,7 +69,7 @@ /* Simplify ssl context option retrieval */ #define GET_VER_OPT(name) (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", name)) != NULL) #define GET_VER_OPT_STRING(name, str) if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_P(val); } -#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_int_ex(val); num = Z_IVAL_P(val); } +#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_int_ex(val); num = Z_LVAL_P(val); } /* Used for peer verification in windows */ #define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i))) @@ -89,9 +89,9 @@ typedef struct _php_openssl_sni_cert_t { /* Provides leaky bucket handhsake renegotiation rate-limiting */ typedef struct _php_openssl_handshake_bucket_t { - php_int_t prev_handshake; - php_int_t limit; - php_int_t window; + zend_long prev_handshake; + zend_long limit; + zend_long window; float tokens; unsigned should_close; } php_openssl_handshake_bucket_t; @@ -146,7 +146,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); char esbuf[512]; smart_str ebuf = {0}; - php_uint_t ecode; + zend_ulong ecode; int retry = 1; switch(err) { @@ -230,7 +230,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ SSL *ssl; int err, depth, ret; zval *val; - php_uint_t allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH; + zend_ulong allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH; TSRMLS_FETCH(); @@ -254,7 +254,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ /* check the depth */ GET_VER_OPT_LONG("verify_depth", allowed_depth); - if ((php_uint_t)depth > allowed_depth) { + if ((zend_ulong)depth > allowed_depth) { ret = 0; X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_CHAIN_TOO_LONG); } @@ -271,7 +271,7 @@ static int php_x509_fingerprint_cmp(X509 *peer, const char *method, const char * fingerprint = php_openssl_x509_fingerprint(peer, method, 0 TSRMLS_CC); if (fingerprint) { result = strcmp(expected, fingerprint->val); - STR_RELEASE(fingerprint); + zend_string_release(fingerprint); } return result; @@ -282,7 +282,7 @@ static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val TSRMLS_DC) if (Z_TYPE_P(val) == IS_STRING) { const char *method = NULL; - switch (Z_STRSIZE_P(val)) { + switch (Z_STRLEN_P(val)) { case 32: method = "md5"; break; @@ -513,9 +513,9 @@ static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */ GET_VER_OPT_STRING("passphrase", passphrase); if (passphrase) { - if (Z_STRSIZE_P(val) < num - 1) { - memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)+1); - return Z_STRSIZE_P(val); + if (Z_STRLEN_P(val) < num - 1) { + memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)+1); + return Z_STRLEN_P(val); } } return 0; @@ -880,7 +880,7 @@ static int set_local_cert(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ */ } /* }}} */ -static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is_client TSRMLS_DC) /* {{{ */ +static const SSL_METHOD *php_select_crypto_method(zend_long method_value, int is_client TSRMLS_DC) /* {{{ */ { if (method_value == STREAM_CRYPTO_METHOD_SSLv2) { #ifndef OPENSSL_NO_SSL2 @@ -918,9 +918,9 @@ static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is } /* }}} */ -static php_int_t php_get_crypto_method_ctx_flags(php_int_t method_flags TSRMLS_DC) /* {{{ */ +static zend_long php_get_crypto_method_ctx_flags(zend_long method_flags TSRMLS_DC) /* {{{ */ { - php_int_t ssl_ctx_options = SSL_OP_ALL; + zend_long ssl_ctx_options = SSL_OP_ALL; #ifndef OPENSSL_NO_SSL2 if (!(method_flags & STREAM_CRYPTO_METHOD_SSLv2)) { @@ -956,7 +956,7 @@ static void limit_handshake_reneg(const SSL *ssl) /* {{{ */ php_stream *stream; php_openssl_netstream_data_t *sslsock; struct timeval now; - php_int_t elapsed_time; + zend_long elapsed_time; stream = php_openssl_get_stream_from_ssl_handle(ssl); sslsock = (php_openssl_netstream_data_t*)stream->abstract; @@ -1025,15 +1025,15 @@ static void info_callback(const SSL *ssl, int where, int ret) /* {{{ */ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_data_t *sslsock) /* {{{ */ { zval *val; - php_int_t limit = OPENSSL_DEFAULT_RENEG_LIMIT; - php_int_t window = OPENSSL_DEFAULT_RENEG_WINDOW; + zend_long limit = OPENSSL_DEFAULT_RENEG_LIMIT; + zend_long window = OPENSSL_DEFAULT_RENEG_WINDOW; if (PHP_STREAM_CONTEXT(stream) && NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit")) ) { convert_to_int(val); - limit = Z_IVAL_P(val); + limit = Z_LVAL_P(val); } /* No renegotiation rate-limiting */ @@ -1046,7 +1046,7 @@ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_da "ssl", "reneg_window")) ) { convert_to_int(val); - window = Z_IVAL_P(val); + window = Z_LVAL_P(val); } sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t), @@ -1070,7 +1070,7 @@ static int set_server_rsa_key(php_stream *stream, SSL_CTX *ctx TSRMLS_DC) /* {{{ RSA* rsa; if ((val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size")) != NULL) { - rsa_key_size = (int) Z_IVAL_P(val); + rsa_key_size = (int) Z_LVAL_P(val); if ((rsa_key_size != 1) && (rsa_key_size & (rsa_key_size - 1))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "RSA key size requires a power of 2: %d", rsa_key_size); rsa_key_size = 2048; @@ -1255,7 +1255,7 @@ static int enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *s zval *val; zval *current; zend_string *key; - php_uint_t key_index; + zend_ulong key_index; int i = 0; char resolved_path_buff[MAXPATHLEN]; SSL_CTX *ctx; @@ -1534,7 +1534,7 @@ static zend_array *capture_session_meta(SSL *ssl_handle) /* {{{ */ array_init(&meta_arr); add_assoc_string(&meta_arr, "protocol", proto_str); add_assoc_string(&meta_arr, "cipher_name", (char *) SSL_CIPHER_get_name(cipher)); - add_assoc_int(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); + add_assoc_long(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); add_assoc_string(&meta_arr, "cipher_version", SSL_CIPHER_get_version(cipher)); return Z_ARR(meta_arr); @@ -2167,13 +2167,13 @@ php_stream_ops php_openssl_socket_ops = { php_openssl_sockop_set_option, }; -static php_int_t get_crypto_method(php_stream_context *ctx, php_int_t crypto_method) +static zend_long get_crypto_method(php_stream_context *ctx, zend_long crypto_method) { zval *val; if (ctx && (val = php_stream_context_get_option(ctx, "ssl", "crypto_method")) != NULL) { convert_to_int_ex(val); - crypto_method = (php_int_t)Z_IVAL_P(val); + crypto_method = (zend_long)Z_LVAL_P(val); crypto_method |= STREAM_CRYPTO_IS_CLIENT; } diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index d0ca4deaa5..7ead941de0 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -204,213 +204,213 @@ void php_register_signal_constants(INIT_FUNC_ARGS) /* Wait Constants */ #ifdef WNOHANG - REGISTER_INT_CONSTANT("WNOHANG", (php_int_t) WNOHANG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WNOHANG", (zend_long) WNOHANG, CONST_CS | CONST_PERSISTENT); #endif #ifdef WUNTRACED - REGISTER_INT_CONSTANT("WUNTRACED", (php_int_t) WUNTRACED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WUNTRACED", (zend_long) WUNTRACED, CONST_CS | CONST_PERSISTENT); #endif /* Signal Constants */ - REGISTER_INT_CONSTANT("SIG_IGN", (php_int_t) SIG_IGN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIG_DFL", (php_int_t) SIG_DFL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIG_ERR", (php_int_t) SIG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGHUP", (php_int_t) SIGHUP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGINT", (php_int_t) SIGINT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGQUIT", (php_int_t) SIGQUIT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGILL", (php_int_t) SIGILL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGTRAP", (php_int_t) SIGTRAP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGABRT", (php_int_t) SIGABRT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_IGN", (zend_long) SIG_IGN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_DFL", (zend_long) SIG_DFL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_ERR", (zend_long) SIG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGHUP", (zend_long) SIGHUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGINT", (zend_long) SIGINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGQUIT", (zend_long) SIGQUIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGILL", (zend_long) SIGILL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGTRAP", (zend_long) SIGTRAP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGABRT", (zend_long) SIGABRT, CONST_CS | CONST_PERSISTENT); #ifdef SIGIOT - REGISTER_INT_CONSTANT("SIGIOT", (php_int_t) SIGIOT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_INT_CONSTANT("SIGBUS", (php_int_t) SIGBUS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGFPE", (php_int_t) SIGFPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGKILL", (php_int_t) SIGKILL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGUSR1", (php_int_t) SIGUSR1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGSEGV", (php_int_t) SIGSEGV, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGUSR2", (php_int_t) SIGUSR2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGPIPE", (php_int_t) SIGPIPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGALRM", (php_int_t) SIGALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGTERM", (php_int_t) SIGTERM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGIOT", (zend_long) SIGIOT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_LONG_CONSTANT("SIGBUS", (zend_long) SIGBUS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGFPE", (zend_long) SIGFPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGKILL", (zend_long) SIGKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGUSR1", (zend_long) SIGUSR1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGSEGV", (zend_long) SIGSEGV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGUSR2", (zend_long) SIGUSR2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGPIPE", (zend_long) SIGPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGALRM", (zend_long) SIGALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGTERM", (zend_long) SIGTERM, CONST_CS | CONST_PERSISTENT); #ifdef SIGSTKFLT - REGISTER_INT_CONSTANT("SIGSTKFLT",(php_int_t) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGSTKFLT",(zend_long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCLD - REGISTER_INT_CONSTANT("SIGCLD", (php_int_t) SIGCLD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGCLD", (zend_long) SIGCLD, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCHLD - REGISTER_INT_CONSTANT("SIGCHLD", (php_int_t) SIGCHLD, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_INT_CONSTANT("SIGCONT", (php_int_t) SIGCONT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGSTOP", (php_int_t) SIGSTOP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGTSTP", (php_int_t) SIGTSTP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGTTIN", (php_int_t) SIGTTIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGTTOU", (php_int_t) SIGTTOU, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGURG", (php_int_t) SIGURG , CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGXCPU", (php_int_t) SIGXCPU, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGXFSZ", (php_int_t) SIGXFSZ, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGVTALRM",(php_int_t) SIGVTALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGPROF", (php_int_t) SIGPROF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGWINCH", (php_int_t) SIGWINCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGCHLD", (zend_long) SIGCHLD, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_LONG_CONSTANT("SIGCONT", (zend_long) SIGCONT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGSTOP", (zend_long) SIGSTOP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGTSTP", (zend_long) SIGTSTP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGTTIN", (zend_long) SIGTTIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGTTOU", (zend_long) SIGTTOU, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGURG", (zend_long) SIGURG , CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGXCPU", (zend_long) SIGXCPU, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGXFSZ", (zend_long) SIGXFSZ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGVTALRM",(zend_long) SIGVTALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGPROF", (zend_long) SIGPROF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGWINCH", (zend_long) SIGWINCH, CONST_CS | CONST_PERSISTENT); #ifdef SIGPOLL - REGISTER_INT_CONSTANT("SIGPOLL", (php_int_t) SIGPOLL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGPOLL", (zend_long) SIGPOLL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SIGIO", (php_int_t) SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGIO", (zend_long) SIGIO, CONST_CS | CONST_PERSISTENT); #ifdef SIGPWR - REGISTER_INT_CONSTANT("SIGPWR", (php_int_t) SIGPWR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGPWR", (zend_long) SIGPWR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGSYS - REGISTER_INT_CONSTANT("SIGSYS", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIGBABY", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGSYS", (zend_long) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIGBABY", (zend_long) SIGSYS, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_GETPRIORITY || HAVE_SETPRIORITY - REGISTER_INT_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); #endif /* {{{ "how" argument for sigprocmask */ #ifdef HAVE_SIGPROCMASK - REGISTER_INT_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); #endif /* }}} */ /* {{{ si_code */ #if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT - REGISTER_INT_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); #ifdef SI_NOINFO - REGISTER_INT_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_KERNEL - REGISTER_INT_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); #ifdef SI_SIGIO - REGISTER_INT_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_TKILL - REGISTER_INT_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGCHILD */ #ifdef CLD_EXITED - REGISTER_INT_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_KILLED - REGISTER_INT_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_DUMPED - REGISTER_INT_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_TRAPPED - REGISTER_INT_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_STOPPED - REGISTER_INT_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_CONTINUED - REGISTER_INT_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGTRAP */ #ifdef TRAP_BRKPT - REGISTER_INT_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef TRAP_TRACE - REGISTER_INT_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGPOLL */ #ifdef POLL_IN - REGISTER_INT_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_OUT - REGISTER_INT_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_MSG - REGISTER_INT_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_ERR - REGISTER_INT_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_PRI - REGISTER_INT_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_HUP - REGISTER_INT_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPC - REGISTER_INT_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPN - REGISTER_INT_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLADR - REGISTER_INT_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLTRP - REGISTER_INT_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVOPC - REGISTER_INT_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVREG - REGISTER_INT_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_COPROC - REGISTER_INT_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_BADSTK - REGISTER_INT_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTDIV - REGISTER_INT_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTOVF - REGISTER_INT_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTDIV - REGISTER_INT_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTOVF - REGISTER_INT_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTUND - REGISTER_INT_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTRES - REGISTER_INT_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTINV - REGISTER_INT_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTSUB - REGISTER_INT_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_MAPERR - REGISTER_INT_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_ACCERR - REGISTER_INT_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRALN - REGISTER_INT_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRERR - REGISTER_INT_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_OBJERR - REGISTER_INT_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); #endif #endif /* HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT */ /* }}} */ @@ -548,7 +548,7 @@ PHP_FUNCTION(pcntl_fork) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno); } - RETURN_INT((long) id); + RETURN_LONG((long) id); } /* }}} */ @@ -556,12 +556,12 @@ PHP_FUNCTION(pcntl_fork) Set an alarm clock for delivery of a signal*/ PHP_FUNCTION(pcntl_alarm) { - php_int_t seconds; + zend_long seconds; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &seconds) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE) return; - RETURN_INT ((php_int_t) alarm(seconds)); + RETURN_LONG ((zend_long) alarm(seconds)); } /* }}} */ @@ -569,17 +569,17 @@ PHP_FUNCTION(pcntl_alarm) Waits on or returns the status of a forked child as defined by the waitpid() system call */ PHP_FUNCTION(pcntl_waitpid) { - php_int_t pid, options = 0; + zend_long pid, options = 0; zval *z_status = NULL; int status; pid_t child_id; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", &pid, &z_status, &options) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &pid, &z_status, &options) == FAILURE) return; convert_to_int_ex(z_status); - status = Z_IVAL_P(z_status); + status = Z_LVAL_P(z_status); child_id = waitpid((pid_t) pid, &status, options); @@ -587,9 +587,9 @@ PHP_FUNCTION(pcntl_waitpid) PCNTL_G(last_error) = errno; } - Z_IVAL_P(z_status) = status; + Z_LVAL_P(z_status) = status; - RETURN_INT((php_int_t) child_id); + RETURN_LONG((zend_long) child_id); } /* }}} */ @@ -597,17 +597,17 @@ PHP_FUNCTION(pcntl_waitpid) Waits on or returns the status of a forked child as defined by the waitpid() system call */ PHP_FUNCTION(pcntl_wait) { - php_int_t options = 0; + zend_long options = 0; zval *z_status = NULL; int status; pid_t child_id; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|i", &z_status, &options) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|l", &z_status, &options) == FAILURE) return; convert_to_int_ex(z_status); - status = Z_IVAL_P(z_status); + status = Z_LVAL_P(z_status); #ifdef HAVE_WAIT3 if(options) { child_id = wait3(&status, options, NULL); @@ -622,9 +622,9 @@ PHP_FUNCTION(pcntl_wait) PCNTL_G(last_error) = errno; } - Z_IVAL_P(z_status) = status; + Z_LVAL_P(z_status) = status; - RETURN_INT((php_int_t) child_id); + RETURN_LONG((zend_long) child_id); } /* }}} */ @@ -633,9 +633,9 @@ PHP_FUNCTION(pcntl_wait) PHP_FUNCTION(pcntl_wifexited) { #ifdef WIFEXITED - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } @@ -651,9 +651,9 @@ PHP_FUNCTION(pcntl_wifexited) PHP_FUNCTION(pcntl_wifstopped) { #ifdef WIFSTOPPED - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } @@ -669,9 +669,9 @@ PHP_FUNCTION(pcntl_wifstopped) PHP_FUNCTION(pcntl_wifsignaled) { #ifdef WIFSIGNALED - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } @@ -687,13 +687,13 @@ PHP_FUNCTION(pcntl_wifsignaled) PHP_FUNCTION(pcntl_wexitstatus) { #ifdef WEXITSTATUS - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } - RETURN_INT(WEXITSTATUS(status_word)); + RETURN_LONG(WEXITSTATUS(status_word)); #else RETURN_FALSE; #endif @@ -705,13 +705,13 @@ PHP_FUNCTION(pcntl_wexitstatus) PHP_FUNCTION(pcntl_wtermsig) { #ifdef WTERMSIG - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } - RETURN_INT(WTERMSIG(status_word)); + RETURN_LONG(WTERMSIG(status_word)); #else RETURN_FALSE; #endif @@ -723,13 +723,13 @@ PHP_FUNCTION(pcntl_wtermsig) PHP_FUNCTION(pcntl_wstopsig) { #ifdef WSTOPSIG - php_int_t status_word; + zend_long status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { return; } - RETURN_INT(WSTOPSIG(status_word)); + RETURN_LONG(WSTOPSIG(status_word)); #else RETURN_FALSE; #endif @@ -751,7 +751,7 @@ PHP_FUNCTION(pcntl_exec) zend_string *key; char *path; int path_len; - php_uint_t key_num; + zend_ulong key_num; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) { return; @@ -788,22 +788,22 @@ PHP_FUNCTION(pcntl_exec) ZEND_HASH_FOREACH_KEY_VAL(envs_hash, key_num, key, element) { if (envi >= envc) break; if (!key) { - key = zend_int_to_str(key_num); + key = zend_longo_str(key_num); } else { - STR_ADDREF(key); + zend_string_addref(key); } convert_to_string_ex(element); /* Length of element + equal sign + length of key + null */ - pair_length = Z_STRSIZE_P(element) + key->len + 2; + pair_length = Z_STRLEN_P(element) + key->len + 2; *pair = emalloc(pair_length); strlcpy(*pair, key->val, key->len + 1); strlcat(*pair, "=", pair_length); strlcat(*pair, Z_STRVAL_P(element), pair_length); /* Cleanup */ - STR_RELEASE(key); + zend_string_release(key); envi++; pair++; } ZEND_HASH_FOREACH_END(); @@ -837,10 +837,10 @@ PHP_FUNCTION(pcntl_signal) { zval *handle; zend_string *func_name; - php_int_t signo; + zend_long signo; zend_bool restart_syscalls = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz|b", &signo, &handle, &restart_syscalls) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) { return; } @@ -863,12 +863,12 @@ PHP_FUNCTION(pcntl_signal) } /* Special long value case for SIG_DFL and SIG_IGN */ - if (Z_TYPE_P(handle) == IS_INT) { - if (Z_IVAL_P(handle) != (php_int_t) SIG_DFL && Z_IVAL_P(handle) != (php_int_t) SIG_IGN) { + if (Z_TYPE_P(handle) == IS_LONG) { + if (Z_LVAL_P(handle) != (zend_long) SIG_DFL && Z_LVAL_P(handle) != (zend_long) SIG_IGN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified"); RETURN_FALSE; } - if (php_signal(signo, (Sigfunc *) Z_IVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { + if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal"); RETURN_FALSE; @@ -879,10 +879,10 @@ PHP_FUNCTION(pcntl_signal) if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) { PCNTL_G(last_error) = EINVAL; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name->val); - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } - STR_RELEASE(func_name); + zend_string_release(func_name); /* Add the function name to our signal table */ if (zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle)) { @@ -912,11 +912,11 @@ PHP_FUNCTION(pcntl_signal_dispatch) Examine and change blocked signals */ PHP_FUNCTION(pcntl_sigprocmask) { - php_int_t how, signo; + zend_long how, signo; zval *user_set, *user_oldset = NULL, *user_signo; sigset_t set, oldset; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ia|z/", &how, &user_set, &user_oldset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|z/", &how, &user_set, &user_oldset) == FAILURE) { return; } @@ -927,11 +927,11 @@ PHP_FUNCTION(pcntl_sigprocmask) } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_INT) { + if (Z_TYPE_P(user_signo) != IS_LONG) { SEPARATE_ZVAL(user_signo); convert_to_int_ex(user_signo); } - signo = Z_IVAL_P(user_signo); + signo = Z_LVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -956,7 +956,7 @@ PHP_FUNCTION(pcntl_sigprocmask) if (sigismember(&oldset, signo) != 1) { continue; } - add_next_index_int(user_oldset, signo); + add_next_index_long(user_oldset, signo); } } @@ -969,14 +969,14 @@ PHP_FUNCTION(pcntl_sigprocmask) static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{{ */ { zval *user_set, *user_signo, *user_siginfo = NULL; - php_int_t tv_sec = 0, tv_nsec = 0; + zend_long tv_sec = 0, tv_nsec = 0; sigset_t set; int signo; siginfo_t siginfo; struct timespec timeout; if (timedwait) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ii", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { return; } } else { @@ -992,11 +992,11 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_INT) { + if (Z_TYPE_P(user_signo) != IS_LONG) { SEPARATE_ZVAL(user_signo); convert_to_int_ex(user_signo); } - signo = Z_IVAL_P(user_signo); + signo = Z_LVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -1031,41 +1031,41 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); } - add_assoc_int_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); - add_assoc_int_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); - add_assoc_int_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); + add_assoc_long_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); + add_assoc_long_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); + add_assoc_long_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); switch(signo) { #ifdef SIGCHLD case SIGCHLD: - add_assoc_int_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); + add_assoc_long_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); # ifdef si_utime add_assoc_double_ex(user_siginfo, "utime", sizeof("utime")-1, siginfo.si_utime); # endif # ifdef si_stime add_assoc_double_ex(user_siginfo, "stime", sizeof("stime")-1, siginfo.si_stime); # endif - add_assoc_int_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); - add_assoc_int_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); + add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); + add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); break; #endif case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: - add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (php_int_t)siginfo.si_addr); + add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (zend_long)siginfo.si_addr); break; #ifdef SIGPOLL case SIGPOLL: - add_assoc_int_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); + add_assoc_long_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); # ifdef si_fd - add_assoc_int_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); + add_assoc_long_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); # endif break; #endif } } - RETURN_INT(signo); + RETURN_LONG(signo); } /* }}} */ @@ -1091,11 +1091,11 @@ PHP_FUNCTION(pcntl_sigtimedwait) Get the priority of any process */ PHP_FUNCTION(pcntl_getpriority) { - php_int_t who = PRIO_PROCESS; - php_int_t pid = getpid(); + zend_long who = PRIO_PROCESS; + zend_long pid = getpid(); int pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &pid, &who) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) { RETURN_FALSE; } @@ -1120,7 +1120,7 @@ PHP_FUNCTION(pcntl_getpriority) RETURN_FALSE; } - RETURN_INT(pri); + RETURN_LONG(pri); } /* }}} */ #endif @@ -1130,11 +1130,11 @@ PHP_FUNCTION(pcntl_getpriority) Change the priority of any process */ PHP_FUNCTION(pcntl_setpriority) { - php_int_t who = PRIO_PROCESS; - php_int_t pid = getpid(); - php_int_t pri; + zend_long who = PRIO_PROCESS; + zend_long pid = getpid(); + zend_long pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &pri, &pid, &who) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &pri, &pid, &who) == FAILURE) { RETURN_FALSE; } @@ -1169,7 +1169,7 @@ PHP_FUNCTION(pcntl_setpriority) Retrieve the error number set by the last pcntl function which failed. */ PHP_FUNCTION(pcntl_get_last_error) { - RETURN_INT(PCNTL_G(last_error)); + RETURN_LONG(PCNTL_G(last_error)); } /* }}} */ @@ -1177,9 +1177,9 @@ PHP_FUNCTION(pcntl_get_last_error) Retrieve the system error message associated with the given errno. */ PHP_FUNCTION(pcntl_strerror) { - php_int_t error; + zend_long error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) { RETURN_FALSE; } @@ -1242,7 +1242,7 @@ void pcntl_signal_dispatch() while (queue) { if ((handle = zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo)) != NULL) { ZVAL_NULL(&retval); - ZVAL_INT(¶m, queue->signo); + ZVAL_LONG(¶m, queue->signo); /* Call php signal handler - Note that we do not report errors, and we ignore the return value */ /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */ diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index ed1811f5d6..05c7f45566 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -61,7 +61,7 @@ PHP_FUNCTION(pcntl_setpriority); struct php_pcntl_pending_signal { struct php_pcntl_pending_signal *next; - php_int_t signo; + zend_long signo; }; ZEND_BEGIN_MODULE_GLOBALS(pcntl) @@ -77,7 +77,7 @@ ZEND_END_MODULE_GLOBALS(pcntl) #define PCNTL_G(v) (pcntl_globals.v) #endif -#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_INT_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) +#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) #endif /* PHP_PCNTL_H */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index d7c7c56a93..6aec12e9b1 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -143,20 +143,20 @@ static PHP_MINIT_FUNCTION(pcre) { REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT); return SUCCESS; @@ -527,7 +527,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset, /* Add (match, offset) to the return value */ add_next_index_stringl(&match_pair, str, len); - add_next_index_int(&match_pair, offset); + add_next_index_long(&match_pair, offset); if (name) { zval_add_ref(&match_pair); @@ -544,11 +544,11 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * zend_string *subject; /* String to match against */ pcre_cache_entry *pce; /* Compiled regular expression */ zval *subpats = NULL; /* Array for subpatterns */ - php_int_t flags = 0; /* Match control flags */ - php_int_t start_offset = 0; /* Where the new search starts */ + zend_long flags = 0; /* Match control flags */ + zend_long start_offset = 0; /* Where the new search starts */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ii", ®ex, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ll", ®ex, &subject, &subpats, &flags, &start_offset) == FAILURE) { RETURN_FALSE; } @@ -558,8 +558,8 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * Z_PARAM_STR(subject) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_EX(subpats, 0, 1) - Z_PARAM_INT(flags) - Z_PARAM_INT(start_offset) + Z_PARAM_LONG(flags) + Z_PARAM_LONG(start_offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif @@ -887,7 +887,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec /* Did we encounter an error? */ if (PCRE_G(error_code) == PHP_PCRE_NO_ERROR) { - RETVAL_INT(matched); + RETVAL_LONG(matched); } else { RETVAL_FALSE; } @@ -983,7 +983,7 @@ static zend_string *preg_do_repl_func(zval *function, char *subject, int *offset php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function"); } - result_str = STR_INIT(&subject[offsets[0]], offsets[1] - offsets[0], 0); + result_str = zend_string_init(&subject[offsets[0]], offsets[1] - offsets[0], 0); } zval_ptr_dtor(&args[0]); @@ -1034,7 +1034,7 @@ static zend_string *preg_do_eval(char *eval_str, int eval_str_len, char *subject if (match_len) { esc_match = php_addslashes(match, match_len, 0 TSRMLS_CC); } else { - esc_match = STR_INIT(match, match_len, 0); + esc_match = zend_string_init(match, match_len, 0); } } else { esc_match = STR_EMPTY_ALLOC(); @@ -1044,7 +1044,7 @@ static zend_string *preg_do_eval(char *eval_str, int eval_str_len, char *subject segment = walk; /* Clean up and reassign */ - STR_RELEASE(esc_match); + zend_string_release(esc_match); continue; } } @@ -1141,7 +1141,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, } } else { replace = Z_STRVAL_P(replace_val); - replace_len = Z_STRSIZE_P(replace_val); + replace_len = Z_STRLEN_P(replace_val); replace_end = replace + replace_len; } @@ -1171,7 +1171,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, } alloc_len = 2 * subject_len; - result = STR_ALLOC(alloc_len * sizeof(char), 0); + result = zend_string_alloc(alloc_len * sizeof(char), 0); /* Initialize */ match = NULL; @@ -1241,7 +1241,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, if (new_len > alloc_len) { alloc_len = alloc_len + 2 * new_len; - result = STR_REALLOC(result, alloc_len, 0); + result = zend_string_realloc(result, alloc_len, 0); } /* copy the part of the string before the match */ memcpy(&result->val[result_len], piece, match-piece); @@ -1255,7 +1255,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, if (eval || is_callable_replace) { memcpy(walkbuf, eval_result->val, eval_result->len); result_len += eval_result->len; - if (eval_result) STR_RELEASE(eval_result); + if (eval_result) zend_string_release(eval_result); } else { /* do regular backreference copying */ walk = replace; walk_last = 0; @@ -1300,7 +1300,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, new_len = result_len + subject_len - start_offset; if (new_len > alloc_len) { alloc_len = new_len; /* now we know exactly how long it is */ - result = STR_REALLOC(result, alloc_len, 0); + result = zend_string_realloc(result, alloc_len, 0); } /* stick that last bit of string on our output */ memcpy(&result->val[result_len], piece, subject_len - start_offset); @@ -1310,7 +1310,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, } } else { pcre_handle_exec_error(count TSRMLS_CC); - STR_FREE(result); + zend_string_free(result); result = NULL; break; } @@ -1398,15 +1398,15 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub is_callable_replace, limit, replace_count TSRMLS_CC)) != NULL) { - STR_RELEASE(subject_str); + zend_string_release(subject_str); subject_str = result; } else { - STR_RELEASE(subject_str); - STR_RELEASE(regex_str); + zend_string_release(subject_str); + zend_string_release(regex_str); return NULL; } - STR_RELEASE(regex_str); + zend_string_release(regex_str); } ZEND_HASH_FOREACH_END(); return subject_str; @@ -1418,7 +1418,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub is_callable_replace, limit, replace_count TSRMLS_CC); - STR_RELEASE(subject_str); + zend_string_release(subject_str); return result; } } @@ -1434,16 +1434,16 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl *subject_entry, *zcount = NULL; int limit_val = -1; - php_int_t limit = -1; + zend_long limit = -1; zend_string *result; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; zend_string *callback_name; int replace_count=0, old_replace_count; #ifndef FAST_ZPP /* Get function parameters and do error-checking. */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|iz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { return; } #else @@ -1452,7 +1452,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl Z_PARAM_ZVAL(replace) Z_PARAM_ZVAL(subject) Z_PARAM_OPTIONAL - Z_PARAM_INT(limit) + Z_PARAM_LONG(limit) Z_PARAM_ZVAL_EX(zcount, 0, 1) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1469,11 +1469,11 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl if (is_callable_replace) { if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%s', to be a valid callback", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); ZVAL_DUP(return_value, subject); return; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); } if (ZEND_NUM_ARGS() > 3) { @@ -1502,7 +1502,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl add_index_str(return_value, num_key, result); } } else { - STR_RELEASE(result); + zend_string_release(result); } } } ZEND_HASH_FOREACH_END(); @@ -1512,13 +1512,13 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl if (!is_filter || replace_count > old_replace_count) { RETVAL_STR(result); } else { - STR_RELEASE(result); + zend_string_release(result); } } } if (ZEND_NUM_ARGS() > 4) { zval_dtor(zcount); - ZVAL_INT(zcount, replace_count); + ZVAL_LONG(zcount, replace_count); } } @@ -1554,13 +1554,13 @@ static PHP_FUNCTION(preg_split) { zend_string *regex; /* Regular expression */ zend_string *subject; /* String to match against */ - php_int_t limit_val = -1;/* Integer value of limit */ - php_int_t flags = 0; /* Match control flags */ + zend_long limit_val = -1;/* Integer value of limit */ + zend_long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get function parameters and do error checking */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", ®ex, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", ®ex, &subject, &subject_len, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } @@ -1569,8 +1569,8 @@ static PHP_FUNCTION(preg_split) Z_PARAM_STR(regex) Z_PARAM_STR(subject) Z_PARAM_OPTIONAL - Z_PARAM_INT(limit_val) - Z_PARAM_INT(flags) + Z_PARAM_LONG(limit_val) + Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif @@ -1701,9 +1701,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec if (pce->compile_options & PCRE_UTF8) { if (re_bump == NULL) { int dummy; - zend_string *regex = STR_INIT("/./us", sizeof("/./us")-1, 0); + zend_string *regex = zend_string_init("/./us", sizeof("/./us")-1, 0); re_bump = pcre_get_compiled_regex(regex, &extra_bump, &dummy TSRMLS_CC); - STR_RELEASE(regex); + zend_string_release(regex); if (re_bump == NULL) { RETURN_FALSE; } @@ -1804,7 +1804,7 @@ static PHP_FUNCTION(preg_quote) /* Allocate enough memory so that even if each character is quoted, we won't run out of room */ - out_str = STR_SAFE_ALLOC(4, in_str_len, 0, 0); + out_str = zend_string_safe_alloc(4, in_str_len, 0, 0); /* Go through the string and quote necessary characters */ for (p = in_str, q = out_str->val; p != in_str_end; p++) { @@ -1851,7 +1851,7 @@ static PHP_FUNCTION(preg_quote) *q = '\0'; /* Reallocate string and return it */ - out_str = STR_REALLOC(out_str, q - out_str->val, 0); + out_str = zend_string_realloc(out_str, q - out_str->val, 0); RETURN_STR(out_str); } /* }}} */ @@ -1862,12 +1862,12 @@ static PHP_FUNCTION(preg_grep) { zend_string *regex; /* Regular expression */ zval *input; /* Input array */ - php_int_t flags = 0; /* Match control flags */ + zend_long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|i", ®ex, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex, &input, &flags) == FAILURE) { return; } @@ -1876,7 +1876,7 @@ static PHP_FUNCTION(preg_grep) Z_PARAM_STR(regex) Z_PARAM_ARRAY(input) Z_PARAM_OPTIONAL - Z_PARAM_INT(flags) + Z_PARAM_LONG(flags) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1898,7 +1898,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return int size_offsets; /* Size of the offsets array */ int count = 0; /* Count of matched subpatterns */ zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; zend_bool invert; /* Whether to return non-matching entries */ ALLOCA_FLAG(use_heap); @@ -1943,7 +1943,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return count = size_offsets/3; } else if (count < 0 && count != PCRE_ERROR_NOMATCH) { pcre_handle_exec_error(count TSRMLS_CC); - STR_RELEASE(subject_str); + zend_string_release(subject_str); break; } @@ -1961,7 +1961,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return } } - STR_RELEASE(subject_str); + zend_string_release(subject_str); } ZEND_HASH_FOREACH_END(); /* Clean up */ @@ -1986,7 +1986,7 @@ static PHP_FUNCTION(preg_last_error) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_INT(PCRE_G(error_code)); + RETURN_LONG(PCRE_G(error_code)); } /* }}} */ diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 440f5a7e0c..bb2f808cbc 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -208,7 +208,7 @@ pdo_driver_t *pdo_find_driver(const char *name, int namelen) /* {{{ */ } /* }}} */ -PDO_API int php_pdo_parse_data_source(const char *data_source, php_uint_t data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */ +PDO_API int php_pdo_parse_data_source(const char *data_source, zend_ulong data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */ { int i, j; int valstart = -1; @@ -314,7 +314,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ char buffer[65]; char outbuf[65] = ""; register char *p; - php_int_t long_val; + zend_long long_val; char *dst = outbuf; if (i64 < 0) { @@ -337,9 +337,9 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ *--p = digit_vec[rem]; i64 = (pdo_int64_t)quo; } - long_val = (php_int_t)i64; + long_val = (zend_long)i64; while (long_val != 0) { - php_int_t quo = long_val / 10; + zend_long quo = long_val / 10; *--p = digit_vec[(unsigned int)(long_val - quo * 10)]; long_val = quo; } diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 576b81762e..06d8c71235 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -36,7 +36,7 @@ #include "zend_object_handlers.h" #include "zend_hash.h" -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC); +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC); void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp TSRMLS_DC) /* {{{ */ { @@ -85,7 +85,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate array_init(&info); add_next_index_string(&info, *pdo_err); - add_next_index_int(&info, 0); + add_next_index_long(&info, 0); zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info TSRMLS_CC); zval_ptr_dtor(&info); @@ -103,7 +103,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ pdo_error_type *pdo_err = &dbh->error_code; const char *msg = "<<Unknown>>"; char *supp = NULL; - php_int_t native_code = 0; + zend_long native_code = 0; zend_string *message = NULL; zval info; @@ -131,11 +131,11 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ zval *item; if ((item = zend_hash_index_find(Z_ARRVAL(info), 1)) != NULL) { - native_code = Z_IVAL_P(item); + native_code = Z_LVAL_P(item); } if ((item = zend_hash_index_find(Z_ARRVAL(info), 2)) != NULL) { - supp = estrndup(Z_STRVAL_P(item), Z_STRSIZE_P(item)); + supp = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item)); } } } @@ -169,7 +169,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ } if (message) { - STR_RELEASE(message); + zend_string_release(message); } if (supp) { @@ -277,7 +277,7 @@ static PHP_METHOD(PDO, dbh_constructor) if ((v = zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_PERSISTENT)) != NULL) { if (Z_TYPE_P(v) == IS_STRING && - !is_numeric_string(Z_STRVAL_P(v), Z_STRSIZE_P(v), NULL, NULL, 0) && Z_STRSIZE_P(v) > 0) { + !is_numeric_string(Z_STRVAL_P(v), Z_STRLEN_P(v), NULL, NULL, 0) && Z_STRLEN_P(v) > 0) { /* user specified key */ plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source, username ? username : "", @@ -286,7 +286,7 @@ static PHP_METHOD(PDO, dbh_constructor) is_persistent = 1; } else { convert_to_int_ex(v); - is_persistent = Z_IVAL_P(v) ? 1 : 0; + is_persistent = Z_LVAL_P(v) ? 1 : 0; plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source, username ? username : "", password ? password : ""); @@ -350,7 +350,7 @@ static PHP_METHOD(PDO, dbh_constructor) dbh->default_fetch_type = PDO_FETCH_BOTH; } - dbh->auto_commit = pdo_attr_ival(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); + dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory"); @@ -385,7 +385,7 @@ static PHP_METHOD(PDO, dbh_constructor) options: if (options) { zval *attr_value; - php_uint_t long_key; + zend_ulong long_key; zend_string *str_key = NULL; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), long_key, str_key, attr_value) { @@ -675,11 +675,11 @@ static PHP_METHOD(PDO, inTransaction) } /* }}} */ -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC) /* {{{ */ +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC) /* {{{ */ { -#define PDO_INT_PARAM_CHECK \ - if (Z_TYPE_P(value) != IS_INT && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ +#define PDO_LONG_PARAM_CHECK \ + if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \ PDO_HANDLE_DBH_ERR(); \ return FAILURE; \ @@ -687,13 +687,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR switch (attr) { case PDO_ATTR_ERRMODE: - PDO_INT_PARAM_CHECK; + PDO_LONG_PARAM_CHECK; convert_to_int(value); - switch (Z_IVAL_P(value)) { + switch (Z_LVAL_P(value)) { case PDO_ERRMODE_SILENT: case PDO_ERRMODE_WARNING: case PDO_ERRMODE_EXCEPTION: - dbh->error_mode = Z_IVAL_P(value); + dbh->error_mode = Z_LVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode" TSRMLS_CC); @@ -703,13 +703,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR return FAILURE; case PDO_ATTR_CASE: - PDO_INT_PARAM_CHECK; + PDO_LONG_PARAM_CHECK; convert_to_int(value); - switch (Z_IVAL_P(value)) { + switch (Z_LVAL_P(value)) { case PDO_CASE_NATURAL: case PDO_CASE_UPPER: case PDO_CASE_LOWER: - dbh->desired_case = Z_IVAL_P(value); + dbh->desired_case = Z_LVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode" TSRMLS_CC); @@ -719,35 +719,35 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSR return FAILURE; case PDO_ATTR_ORACLE_NULLS: - PDO_INT_PARAM_CHECK; + PDO_LONG_PARAM_CHECK; convert_to_int(value); - dbh->oracle_nulls = Z_IVAL_P(value); + dbh->oracle_nulls = Z_LVAL_P(value); return SUCCESS; case PDO_ATTR_DEFAULT_FETCH_MODE: if (Z_TYPE_P(value) == IS_ARRAY) { zval *tmp; - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_INT) { - if (Z_IVAL_P(tmp) == PDO_FETCH_INTO || Z_IVAL_P(tmp) == PDO_FETCH_CLASS) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { + if (Z_LVAL_P(tmp) == PDO_FETCH_INTO || Z_LVAL_P(tmp) == PDO_FETCH_CLASS) { pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC); return FAILURE; } } } else { - PDO_INT_PARAM_CHECK; + PDO_LONG_PARAM_CHECK; } convert_to_int(value); - if (Z_IVAL_P(value) == PDO_FETCH_USE_DEFAULT) { + if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) { pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC); return FAILURE; } - dbh->default_fetch_type = Z_IVAL_P(value); + dbh->default_fetch_type = Z_LVAL_P(value); return SUCCESS; case PDO_ATTR_STRINGIFY_FETCHES: - PDO_INT_PARAM_CHECK; + PDO_LONG_PARAM_CHECK; convert_to_int(value); - dbh->stringify = Z_IVAL_P(value) ? 1 : 0; + dbh->stringify = Z_LVAL_P(value) ? 1 : 0; return SUCCESS; case PDO_ATTR_STATEMENT_CLASS: { @@ -835,10 +835,10 @@ fail: static PHP_METHOD(PDO, setAttribute) { pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); - php_int_t attr; + zend_long attr; zval *value; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &attr, &value)) { RETURN_FALSE; } @@ -857,9 +857,9 @@ static PHP_METHOD(PDO, setAttribute) static PHP_METHOD(PDO, getAttribute) { pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); - php_int_t attr; + zend_long attr; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { RETURN_FALSE; } @@ -872,27 +872,27 @@ static PHP_METHOD(PDO, getAttribute) RETURN_BOOL(dbh->is_persistent); case PDO_ATTR_CASE: - RETURN_INT(dbh->desired_case); + RETURN_LONG(dbh->desired_case); case PDO_ATTR_ORACLE_NULLS: - RETURN_INT(dbh->oracle_nulls); + RETURN_LONG(dbh->oracle_nulls); case PDO_ATTR_ERRMODE: - RETURN_INT(dbh->error_mode); + RETURN_LONG(dbh->error_mode); case PDO_ATTR_DRIVER_NAME: RETURN_STRINGL((char*)dbh->driver->driver_name, dbh->driver->driver_name_len); case PDO_ATTR_STATEMENT_CLASS: array_init(return_value); - add_next_index_str(return_value, STR_COPY(dbh->def_stmt_ce->name)); + add_next_index_str(return_value, zend_string_copy(dbh->def_stmt_ce->name)); if (!Z_ISUNDEF(dbh->def_stmt_ctor_args)) { if (Z_REFCOUNTED(dbh->def_stmt_ctor_args)) Z_ADDREF(dbh->def_stmt_ctor_args); add_next_index_zval(return_value, &dbh->def_stmt_ctor_args); } return; case PDO_ATTR_DEFAULT_FETCH_MODE: - RETURN_INT(dbh->default_fetch_type); + RETURN_LONG(dbh->default_fetch_type); default: break; } @@ -924,7 +924,7 @@ static PHP_METHOD(PDO, exec) pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); char *statement; int statement_len; - php_int_t ret; + zend_long ret; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &statement, &statement_len)) { RETURN_FALSE; @@ -941,7 +941,7 @@ static PHP_METHOD(PDO, exec) PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } else { - RETURN_INT(ret); + RETURN_LONG(ret); } } /* }}} */ @@ -1136,11 +1136,11 @@ static PHP_METHOD(PDO, quote) pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); char *str; int str_len; - php_int_t paramtype = PDO_PARAM_STR; + zend_long paramtype = PDO_PARAM_STR; char *qstr; int qlen; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, ¶mtype)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, ¶mtype)) { RETURN_FALSE; } @@ -1259,7 +1259,7 @@ const zend_function_entry pdo_dbh_functions[] = /* {{{ */ { static void cls_method_dtor(zval *el) /* {{{ */ { zend_function *func = (zend_function*)Z_PTR_P(el); if (func->common.function_name) { - STR_RELEASE(func->common.function_name); + zend_string_release(func->common.function_name); } efree(func); } @@ -1291,7 +1291,7 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC) while (funcs->fname) { ifunc->type = ZEND_INTERNAL_FUNCTION; ifunc->handler = funcs->handler; - ifunc->function_name = STR_INIT(funcs->fname, strlen(funcs->fname), 0); + ifunc->function_name = zend_string_init(funcs->fname, strlen(funcs->fname), 0); ifunc->scope = dbh_obj->std.ce; ifunc->prototype = NULL; if (funcs->flags) { @@ -1337,7 +1337,7 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m pdo_dbh_object_t *dbh_obj = php_pdo_dbh_fetch_object(*object); zend_string *lc_method_name; - lc_method_name = STR_INIT(method_name->val, method_name->len, 0); + lc_method_name = zend_string_init(method_name->val, method_name->len, 0); zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len); if ((fbc = std_object_handlers.get_method(object, method_name, key TSRMLS_CC)) == NULL) { @@ -1355,7 +1355,7 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m } out: - STR_RELEASE(lc_method_name); + zend_string_release(lc_method_name); return fbc; } @@ -1382,100 +1382,100 @@ void pdo_dbh_init(TSRMLS_D) pdo_dbh_object_handlers.get_method = dbh_method_get; pdo_dbh_object_handlers.compare_objects = dbh_compare; - REGISTER_PDO_CLASS_CONST_INT("PARAM_BOOL", (php_int_t)PDO_PARAM_BOOL); - REGISTER_PDO_CLASS_CONST_INT("PARAM_NULL", (php_int_t)PDO_PARAM_NULL); - REGISTER_PDO_CLASS_CONST_INT("PARAM_INT", (php_int_t)PDO_PARAM_INT); - REGISTER_PDO_CLASS_CONST_INT("PARAM_STR", (php_int_t)PDO_PARAM_STR); - REGISTER_PDO_CLASS_CONST_INT("PARAM_LOB", (php_int_t)PDO_PARAM_LOB); - REGISTER_PDO_CLASS_CONST_INT("PARAM_STMT", (php_int_t)PDO_PARAM_STMT); - REGISTER_PDO_CLASS_CONST_INT("PARAM_INPUT_OUTPUT", (php_int_t)PDO_PARAM_INPUT_OUTPUT); - - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_ALLOC", (php_int_t)PDO_PARAM_EVT_ALLOC); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FREE", (php_int_t)PDO_PARAM_EVT_FREE); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_PRE", (php_int_t)PDO_PARAM_EVT_EXEC_PRE); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_POST", (php_int_t)PDO_PARAM_EVT_EXEC_POST); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_PRE", (php_int_t)PDO_PARAM_EVT_FETCH_PRE); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_POST", (php_int_t)PDO_PARAM_EVT_FETCH_POST); - REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_NORMALIZE", (php_int_t)PDO_PARAM_EVT_NORMALIZE); - - REGISTER_PDO_CLASS_CONST_INT("FETCH_LAZY", (php_int_t)PDO_FETCH_LAZY); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ASSOC", (php_int_t)PDO_FETCH_ASSOC); - REGISTER_PDO_CLASS_CONST_INT("FETCH_NUM", (php_int_t)PDO_FETCH_NUM); - REGISTER_PDO_CLASS_CONST_INT("FETCH_BOTH", (php_int_t)PDO_FETCH_BOTH); - REGISTER_PDO_CLASS_CONST_INT("FETCH_OBJ", (php_int_t)PDO_FETCH_OBJ); - REGISTER_PDO_CLASS_CONST_INT("FETCH_BOUND", (php_int_t)PDO_FETCH_BOUND); - REGISTER_PDO_CLASS_CONST_INT("FETCH_COLUMN", (php_int_t)PDO_FETCH_COLUMN); - REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASS", (php_int_t)PDO_FETCH_CLASS); - REGISTER_PDO_CLASS_CONST_INT("FETCH_INTO", (php_int_t)PDO_FETCH_INTO); - REGISTER_PDO_CLASS_CONST_INT("FETCH_FUNC", (php_int_t)PDO_FETCH_FUNC); - REGISTER_PDO_CLASS_CONST_INT("FETCH_GROUP", (php_int_t)PDO_FETCH_GROUP); - REGISTER_PDO_CLASS_CONST_INT("FETCH_UNIQUE", (php_int_t)PDO_FETCH_UNIQUE); - REGISTER_PDO_CLASS_CONST_INT("FETCH_KEY_PAIR", (php_int_t)PDO_FETCH_KEY_PAIR); - REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASSTYPE", (php_int_t)PDO_FETCH_CLASSTYPE); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (zend_long)PDO_PARAM_BOOL); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (zend_long)PDO_PARAM_NULL); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_INT", (zend_long)PDO_PARAM_INT); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_STR", (zend_long)PDO_PARAM_STR); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_LOB", (zend_long)PDO_PARAM_LOB); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_STMT", (zend_long)PDO_PARAM_STMT); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_INPUT_OUTPUT", (zend_long)PDO_PARAM_INPUT_OUTPUT); + + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_ALLOC", (zend_long)PDO_PARAM_EVT_ALLOC); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FREE", (zend_long)PDO_PARAM_EVT_FREE); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_PRE", (zend_long)PDO_PARAM_EVT_EXEC_PRE); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_POST", (zend_long)PDO_PARAM_EVT_EXEC_POST); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_PRE", (zend_long)PDO_PARAM_EVT_FETCH_PRE); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_POST", (zend_long)PDO_PARAM_EVT_FETCH_POST); + REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_NORMALIZE", (zend_long)PDO_PARAM_EVT_NORMALIZE); + + REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (zend_long)PDO_FETCH_LAZY); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC", (zend_long)PDO_FETCH_ASSOC); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (zend_long)PDO_FETCH_NUM); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOTH", (zend_long)PDO_FETCH_BOTH); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_OBJ", (zend_long)PDO_FETCH_OBJ); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOUND", (zend_long)PDO_FETCH_BOUND); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_COLUMN", (zend_long)PDO_FETCH_COLUMN); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASS", (zend_long)PDO_FETCH_CLASS); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_INTO", (zend_long)PDO_FETCH_INTO); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (zend_long)PDO_FETCH_FUNC); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP", (zend_long)PDO_FETCH_GROUP); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE", (zend_long)PDO_FETCH_UNIQUE); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR", (zend_long)PDO_FETCH_KEY_PAIR); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE", (zend_long)PDO_FETCH_CLASSTYPE); #if PHP_VERSION_ID >= 50100 - REGISTER_PDO_CLASS_CONST_INT("FETCH_SERIALIZE",(php_int_t)PDO_FETCH_SERIALIZE); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(zend_long)PDO_FETCH_SERIALIZE); #endif - REGISTER_PDO_CLASS_CONST_INT("FETCH_PROPS_LATE", (php_int_t)PDO_FETCH_PROPS_LATE); - REGISTER_PDO_CLASS_CONST_INT("FETCH_NAMED", (php_int_t)PDO_FETCH_NAMED); - - REGISTER_PDO_CLASS_CONST_INT("ATTR_AUTOCOMMIT", (php_int_t)PDO_ATTR_AUTOCOMMIT); - REGISTER_PDO_CLASS_CONST_INT("ATTR_PREFETCH", (php_int_t)PDO_ATTR_PREFETCH); - REGISTER_PDO_CLASS_CONST_INT("ATTR_TIMEOUT", (php_int_t)PDO_ATTR_TIMEOUT); - REGISTER_PDO_CLASS_CONST_INT("ATTR_ERRMODE", (php_int_t)PDO_ATTR_ERRMODE); - REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_VERSION", (php_int_t)PDO_ATTR_SERVER_VERSION); - REGISTER_PDO_CLASS_CONST_INT("ATTR_CLIENT_VERSION", (php_int_t)PDO_ATTR_CLIENT_VERSION); - REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_INFO", (php_int_t)PDO_ATTR_SERVER_INFO); - REGISTER_PDO_CLASS_CONST_INT("ATTR_CONNECTION_STATUS", (php_int_t)PDO_ATTR_CONNECTION_STATUS); - REGISTER_PDO_CLASS_CONST_INT("ATTR_CASE", (php_int_t)PDO_ATTR_CASE); - REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR_NAME", (php_int_t)PDO_ATTR_CURSOR_NAME); - REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR", (php_int_t)PDO_ATTR_CURSOR); - REGISTER_PDO_CLASS_CONST_INT("ATTR_ORACLE_NULLS", (php_int_t)PDO_ATTR_ORACLE_NULLS); - REGISTER_PDO_CLASS_CONST_INT("ATTR_PERSISTENT", (php_int_t)PDO_ATTR_PERSISTENT); - REGISTER_PDO_CLASS_CONST_INT("ATTR_STATEMENT_CLASS", (php_int_t)PDO_ATTR_STATEMENT_CLASS); - REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_TABLE_NAMES", (php_int_t)PDO_ATTR_FETCH_TABLE_NAMES); - REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_CATALOG_NAMES", (php_int_t)PDO_ATTR_FETCH_CATALOG_NAMES); - REGISTER_PDO_CLASS_CONST_INT("ATTR_DRIVER_NAME", (php_int_t)PDO_ATTR_DRIVER_NAME); - REGISTER_PDO_CLASS_CONST_INT("ATTR_STRINGIFY_FETCHES", (php_int_t)PDO_ATTR_STRINGIFY_FETCHES); - REGISTER_PDO_CLASS_CONST_INT("ATTR_MAX_COLUMN_LEN", (php_int_t)PDO_ATTR_MAX_COLUMN_LEN); - REGISTER_PDO_CLASS_CONST_INT("ATTR_EMULATE_PREPARES", (php_int_t)PDO_ATTR_EMULATE_PREPARES); - REGISTER_PDO_CLASS_CONST_INT("ATTR_DEFAULT_FETCH_MODE", (php_int_t)PDO_ATTR_DEFAULT_FETCH_MODE); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE", (zend_long)PDO_FETCH_PROPS_LATE); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_NAMED", (zend_long)PDO_FETCH_NAMED); + + REGISTER_PDO_CLASS_CONST_LONG("ATTR_AUTOCOMMIT", (zend_long)PDO_ATTR_AUTOCOMMIT); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_PREFETCH", (zend_long)PDO_ATTR_PREFETCH); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_TIMEOUT", (zend_long)PDO_ATTR_TIMEOUT); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_ERRMODE", (zend_long)PDO_ATTR_ERRMODE); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_VERSION", (zend_long)PDO_ATTR_SERVER_VERSION); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_CLIENT_VERSION", (zend_long)PDO_ATTR_CLIENT_VERSION); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_INFO", (zend_long)PDO_ATTR_SERVER_INFO); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_CONNECTION_STATUS", (zend_long)PDO_ATTR_CONNECTION_STATUS); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_CASE", (zend_long)PDO_ATTR_CASE); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR_NAME", (zend_long)PDO_ATTR_CURSOR_NAME); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR", (zend_long)PDO_ATTR_CURSOR); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_ORACLE_NULLS", (zend_long)PDO_ATTR_ORACLE_NULLS); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_PERSISTENT", (zend_long)PDO_ATTR_PERSISTENT); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_STATEMENT_CLASS", (zend_long)PDO_ATTR_STATEMENT_CLASS); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_TABLE_NAMES", (zend_long)PDO_ATTR_FETCH_TABLE_NAMES); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_CATALOG_NAMES", (zend_long)PDO_ATTR_FETCH_CATALOG_NAMES); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_DRIVER_NAME", (zend_long)PDO_ATTR_DRIVER_NAME); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_STRINGIFY_FETCHES", (zend_long)PDO_ATTR_STRINGIFY_FETCHES); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN", (zend_long)PDO_ATTR_MAX_COLUMN_LEN); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_EMULATE_PREPARES", (zend_long)PDO_ATTR_EMULATE_PREPARES); + REGISTER_PDO_CLASS_CONST_LONG("ATTR_DEFAULT_FETCH_MODE", (zend_long)PDO_ATTR_DEFAULT_FETCH_MODE); - REGISTER_PDO_CLASS_CONST_INT("ERRMODE_SILENT", (php_int_t)PDO_ERRMODE_SILENT); - REGISTER_PDO_CLASS_CONST_INT("ERRMODE_WARNING", (php_int_t)PDO_ERRMODE_WARNING); - REGISTER_PDO_CLASS_CONST_INT("ERRMODE_EXCEPTION", (php_int_t)PDO_ERRMODE_EXCEPTION); + REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (zend_long)PDO_ERRMODE_SILENT); + REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (zend_long)PDO_ERRMODE_WARNING); + REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_EXCEPTION", (zend_long)PDO_ERRMODE_EXCEPTION); - REGISTER_PDO_CLASS_CONST_INT("CASE_NATURAL", (php_int_t)PDO_CASE_NATURAL); - REGISTER_PDO_CLASS_CONST_INT("CASE_LOWER", (php_int_t)PDO_CASE_LOWER); - REGISTER_PDO_CLASS_CONST_INT("CASE_UPPER", (php_int_t)PDO_CASE_UPPER); + REGISTER_PDO_CLASS_CONST_LONG("CASE_NATURAL", (zend_long)PDO_CASE_NATURAL); + REGISTER_PDO_CLASS_CONST_LONG("CASE_LOWER", (zend_long)PDO_CASE_LOWER); + REGISTER_PDO_CLASS_CONST_LONG("CASE_UPPER", (zend_long)PDO_CASE_UPPER); - REGISTER_PDO_CLASS_CONST_INT("NULL_NATURAL", (php_int_t)PDO_NULL_NATURAL); - REGISTER_PDO_CLASS_CONST_INT("NULL_EMPTY_STRING", (php_int_t)PDO_NULL_EMPTY_STRING); - REGISTER_PDO_CLASS_CONST_INT("NULL_TO_STRING", (php_int_t)PDO_NULL_TO_STRING); + REGISTER_PDO_CLASS_CONST_LONG("NULL_NATURAL", (zend_long)PDO_NULL_NATURAL); + REGISTER_PDO_CLASS_CONST_LONG("NULL_EMPTY_STRING", (zend_long)PDO_NULL_EMPTY_STRING); + REGISTER_PDO_CLASS_CONST_LONG("NULL_TO_STRING", (zend_long)PDO_NULL_TO_STRING); REGISTER_PDO_CLASS_CONST_STRING("ERR_NONE", PDO_ERR_NONE); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_NEXT", (php_int_t)PDO_FETCH_ORI_NEXT); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_PRIOR", (php_int_t)PDO_FETCH_ORI_PRIOR); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_FIRST", (php_int_t)PDO_FETCH_ORI_FIRST); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_LAST", (php_int_t)PDO_FETCH_ORI_LAST); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_ABS", (php_int_t)PDO_FETCH_ORI_ABS); - REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_REL", (php_int_t)PDO_FETCH_ORI_REL); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_NEXT", (zend_long)PDO_FETCH_ORI_NEXT); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_PRIOR", (zend_long)PDO_FETCH_ORI_PRIOR); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_FIRST", (zend_long)PDO_FETCH_ORI_FIRST); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_LAST", (zend_long)PDO_FETCH_ORI_LAST); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_ABS", (zend_long)PDO_FETCH_ORI_ABS); + REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_REL", (zend_long)PDO_FETCH_ORI_REL); - REGISTER_PDO_CLASS_CONST_INT("CURSOR_FWDONLY", (php_int_t)PDO_CURSOR_FWDONLY); - REGISTER_PDO_CLASS_CONST_INT("CURSOR_SCROLL", (php_int_t)PDO_CURSOR_SCROLL); + REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (zend_long)PDO_CURSOR_FWDONLY); + REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (zend_long)PDO_CURSOR_SCROLL); #if 0 - REGISTER_PDO_CLASS_CONST_INT("ERR_CANT_MAP", (php_int_t)PDO_ERR_CANT_MAP); - REGISTER_PDO_CLASS_CONST_INT("ERR_SYNTAX", (php_int_t)PDO_ERR_SYNTAX); - REGISTER_PDO_CLASS_CONST_INT("ERR_CONSTRAINT", (php_int_t)PDO_ERR_CONSTRAINT); - REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_FOUND", (php_int_t)PDO_ERR_NOT_FOUND); - REGISTER_PDO_CLASS_CONST_INT("ERR_ALREADY_EXISTS", (php_int_t)PDO_ERR_ALREADY_EXISTS); - REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_IMPLEMENTED", (php_int_t)PDO_ERR_NOT_IMPLEMENTED); - REGISTER_PDO_CLASS_CONST_INT("ERR_MISMATCH", (php_int_t)PDO_ERR_MISMATCH); - REGISTER_PDO_CLASS_CONST_INT("ERR_TRUNCATED", (php_int_t)PDO_ERR_TRUNCATED); - REGISTER_PDO_CLASS_CONST_INT("ERR_DISCONNECTED", (php_int_t)PDO_ERR_DISCONNECTED); - REGISTER_PDO_CLASS_CONST_INT("ERR_NO_PERM", (php_int_t)PDO_ERR_NO_PERM); + REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (zend_long)PDO_ERR_CANT_MAP); + REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (zend_long)PDO_ERR_SYNTAX); + REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (zend_long)PDO_ERR_CONSTRAINT); + REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (zend_long)PDO_ERR_NOT_FOUND); + REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (zend_long)PDO_ERR_ALREADY_EXISTS); + REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (zend_long)PDO_ERR_NOT_IMPLEMENTED); + REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (zend_long)PDO_ERR_MISMATCH); + REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (zend_long)PDO_ERR_TRUNCATED); + REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (zend_long)PDO_ERR_DISCONNECTED); + REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (zend_long)PDO_ERR_NO_PERM); #endif } diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index 6530e2222c..61fba9f131 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -561,12 +561,12 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - STR_RELEASE(buf); + zend_string_release(buf); } goto clean_up; } if (buf) { - STR_RELEASE(buf); + zend_string_release(buf); } } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); @@ -588,10 +588,10 @@ safe: case IS_TRUE: convert_to_int(&tmp_param); /* fall through */ - case IS_INT: + case IS_LONG: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRSIZE(tmp_param); + plc->qlen = Z_STRLEN(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -599,7 +599,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, + Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -618,7 +618,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRSIZE_P(parameter); + plc->qlen = Z_STRLEN_P(parameter); } newbuffer_len += plc->qlen; } @@ -769,7 +769,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRSIZE_P(param->parameter); + newbuffer_len += padding * Z_STRLEN_P(param->parameter); } zend_hash_move_forward(params); } @@ -805,16 +805,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); - ptr += Z_STRSIZE_P(param->parameter); - *outquery_len += (Z_STRSIZE_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); + ptr += Z_STRLEN_P(param->parameter); + *outquery_len += (Z_STRLEN_P(param->parameter)); } } else { @@ -841,16 +841,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); - ptr += Z_STRSIZE_P(param->parameter); - *outquery_len += (Z_STRSIZE_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); + ptr += Z_STRLEN_P(param->parameter); + *outquery_len += (Z_STRLEN_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 8effb4f5e7..e2723bb883 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -223,12 +223,12 @@ safe: ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); if (buf) { - STR_RELEASE(buf); + zend_string_release(buf); } goto clean_up; } if (buf) { - STR_RELEASE(buf); + zend_string_release(buf); } } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); @@ -250,10 +250,10 @@ safe: case IS_TRUE: convert_to_int(&tmp_param); /* fall through */ - case IS_INT: + case IS_LONG: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRSIZE(tmp_param); + plc->qlen = Z_STRLEN(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -261,7 +261,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, + Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -280,7 +280,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRSIZE_P(parameter); + plc->qlen = Z_STRLEN_P(parameter); } newbuffer_len += plc->qlen; } @@ -431,7 +431,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRSIZE_P(param->parameter); + newbuffer_len += padding * Z_STRLEN_P(param->parameter); } zend_hash_move_forward(params); } @@ -467,16 +467,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); - ptr += Z_STRSIZE_P(param->parameter); - *outquery_len += (Z_STRSIZE_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); + ptr += Z_STRLEN_P(param->parameter); + *outquery_len += (Z_STRLEN_P(param->parameter)); } } else { @@ -503,16 +503,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); - ptr += Z_STRSIZE_P(param->parameter); - *outquery_len += (Z_STRSIZE_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); + ptr += Z_STRLEN_P(param->parameter); + *outquery_len += (Z_STRLEN_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 8c85a38575..f9ae46e6e9 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -138,7 +138,7 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa if (!param->name) { /* do the reverse; map the parameter number to the name */ if ((name = zend_hash_index_find_ptr(stmt->bound_param_map, param->paramno)) != NULL) { - param->name = STR_INIT(name, strlen(name), 0); + param->name = zend_string_init(name, strlen(name), 0); return 1; } pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC); @@ -279,7 +279,7 @@ static void param_dtor(zval *el) /* {{{ */ } if (param->name) { - STR_RELEASE(param->name); + zend_string_release(param->name); } if (!Z_ISUNDEF(param->parameter)) { @@ -329,7 +329,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s } } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) { convert_to_int(parameter); - } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_INT) { + } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) { convert_to_boolean(parameter); } @@ -363,18 +363,18 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s if (param->name) { if (is_param && param->name->val[0] != ':') { - zend_string *temp = STR_ALLOC(param->name->len + 1, 0); + zend_string *temp = zend_string_alloc(param->name->len + 1, 0); temp->val[0] = ':'; memmove(temp->val + 1, param->name->val, param->name->len + 1); param->name = temp; } else { - param->name = STR_INIT(param->name->val, param->name->len, 0); + param->name = zend_string_init(param->name->val, param->name->len, 0); } } if (is_param && !rewrite_name_to_position(stmt, param TSRMLS_CC)) { if (param->name) { - STR_RELEASE(param->name); + zend_string_release(param->name); param->name = NULL; } return 0; @@ -388,7 +388,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s if (!stmt->methods->param_hook(stmt, param, PDO_PARAM_EVT_NORMALIZE TSRMLS_CC)) { if (param->name) { - STR_RELEASE(param->name); + zend_string_release(param->name); param->name = NULL; } return 0; @@ -447,7 +447,7 @@ static PHP_METHOD(PDOStatement, execute) struct pdo_bound_param_data param; zval *tmp; zend_string *key = NULL; - php_uint_t num_index; + zend_ulong num_index; if (stmt->bound_params) { zend_hash_destroy(stmt->bound_params); @@ -571,8 +571,8 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ break; case PDO_PARAM_INT: - if (value && value_len == sizeof(php_int_t)) { - ZVAL_INT(dest, *(php_int_t*)value); + if (value && value_len == sizeof(zend_long)) { + ZVAL_LONG(dest, *(zend_long*)value); break; } ZVAL_NULL(dest); @@ -661,7 +661,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ if (stmt->dbh->stringify) { switch (Z_TYPE_P(dest)) { - case IS_INT: + case IS_LONG: case IS_DOUBLE: convert_to_string(dest); break; @@ -674,7 +674,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ } /* }}} */ -static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset, int do_bind TSRMLS_DC) /* {{{ */ +static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset, int do_bind TSRMLS_DC) /* {{{ */ { if (!stmt->executed) { return 0; @@ -832,7 +832,7 @@ static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) / /* perform a fetch. If do_bind is true, update any bound columns. * If return_value is not null, store values into it according to HOW. */ -static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, php_int_t offset, zval *return_all TSRMLS_DC) /* {{{ */ +static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all TSRMLS_DC) /* {{{ */ { int flags, idx, old_arg_count = 0; zend_class_entry *ce = NULL, *old_ce = NULL; @@ -1032,8 +1032,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval tmp; fetch_value(stmt, &tmp, ++i, NULL TSRMLS_CC); - if (Z_TYPE(val) == IS_INT) { - zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_IVAL(val), &tmp); + if (Z_TYPE(val) == IS_LONG) { + zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_LVAL(val), &tmp); } else { convert_to_string(&val); zend_symtable_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_STR(val), &tmp); @@ -1110,7 +1110,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ php_unserialize_data_t var_hash; PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRSIZE(val), NULL TSRMLS_CC) == FAILURE) { + if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL TSRMLS_CC) == FAILURE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data" TSRMLS_CC); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return 0; @@ -1121,7 +1121,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); return 0; - } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRSIZE(val) : 0, NULL TSRMLS_CC) == FAILURE) { + } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL TSRMLS_CC) == FAILURE) { zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); zval_dtor(return_value); @@ -1213,7 +1213,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } /* }}} */ -static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, php_int_t mode, int fetch_all TSRMLS_DC) /* {{{ */ +static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all TSRMLS_DC) /* {{{ */ { int flags = mode & PDO_FETCH_FLAGS; @@ -1269,12 +1269,12 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, php_int_t mode, int fetch_all Fetches the next row and returns it, or false if there are no more rows */ static PHP_METHOD(PDOStatement, fetch) { - php_int_t how = PDO_FETCH_USE_DEFAULT; - php_int_t ori = PDO_FETCH_ORI_NEXT; - php_int_t off = 0; + zend_long how = PDO_FETCH_USE_DEFAULT; + zend_long ori = PDO_FETCH_ORI_NEXT; + zend_long off = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iii", &how, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lll", &how, &ori, &off)) { RETURN_FALSE; } @@ -1296,9 +1296,9 @@ static PHP_METHOD(PDOStatement, fetch) Fetches the next row and returns it as an object. */ static PHP_METHOD(PDOStatement, fetchObject) { - php_int_t how = PDO_FETCH_CLASS; - php_int_t ori = PDO_FETCH_ORI_NEXT; - php_int_t off = 0; + zend_long how = PDO_FETCH_CLASS; + zend_long ori = PDO_FETCH_ORI_NEXT; + zend_long off = 0; zend_string *class_name = NULL; zend_class_entry *old_ce; zval old_ctor_args, *ctor_args = NULL; @@ -1361,10 +1361,10 @@ static PHP_METHOD(PDOStatement, fetchObject) Returns a data of the specified column in the result set. */ static PHP_METHOD(PDOStatement, fetchColumn) { - php_int_t col_n = 0; + zend_long col_n = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &col_n)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &col_n)) { RETURN_FALSE; } @@ -1383,7 +1383,7 @@ static PHP_METHOD(PDOStatement, fetchColumn) Returns an array of all of the results. */ static PHP_METHOD(PDOStatement, fetchAll) { - php_int_t how = PDO_FETCH_USE_DEFAULT; + zend_long how = PDO_FETCH_USE_DEFAULT; zval data, *return_all; zval *arg2; zend_class_entry *old_ce; @@ -1391,7 +1391,7 @@ static PHP_METHOD(PDOStatement, fetchAll) int error = 0, flags, old_arg_count; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|izz", &how, &arg2, &ctor_args)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lzz", &how, &arg2, &ctor_args)) { RETURN_FALSE; } @@ -1471,7 +1471,7 @@ static PHP_METHOD(PDOStatement, fetchAll) break; case 2: convert_to_int(arg2); - stmt->fetch.column = Z_IVAL_P(arg2); + stmt->fetch.column = Z_LVAL_P(arg2); break; case 3: pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC); @@ -1545,15 +1545,15 @@ static PHP_METHOD(PDOStatement, fetchAll) static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ { struct pdo_bound_param_data param = {0}; - php_int_t param_type = PDO_PARAM_STR; + zend_long param_type = PDO_PARAM_STR; zval *parameter; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "iz|iiz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, + "lz|llz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|iiz!", ¶m.name, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|llz!", ¶m.name, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { return 0; @@ -1584,15 +1584,15 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, static PHP_METHOD(PDOStatement, bindValue) { struct pdo_bound_param_data param = {0}; - php_int_t param_type = PDO_PARAM_STR; + zend_long param_type = PDO_PARAM_STR; zval *parameter; PHP_STMT_GET_OBJ; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "iz/|i", ¶m.paramno, ¶meter, ¶m_type)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", ¶m.name, + "lz/|l", ¶m.paramno, ¶meter, ¶m_type)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", ¶m.name, ¶meter, ¶m_type)) { RETURN_FALSE; } @@ -1643,7 +1643,7 @@ static PHP_METHOD(PDOStatement, rowCount) { PHP_STMT_GET_OBJ; - RETURN_INT(stmt->row_count); + RETURN_LONG(stmt->row_count); } /* }}} */ @@ -1703,11 +1703,11 @@ static PHP_METHOD(PDOStatement, errorInfo) Set an attribute */ static PHP_METHOD(PDOStatement, setAttribute) { - php_int_t attr; + zend_long attr; zval *value = NULL; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz!", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) { RETURN_FALSE; } @@ -1733,7 +1733,7 @@ fail: /* {{{ proto mixed PDOStatement::getAttribute(long attribute) Get an attribute */ -static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, php_int_t attr) +static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, zend_long attr) { switch (attr) { case PDO_ATTR_EMULATE_PREPARES: @@ -1745,10 +1745,10 @@ static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, php_int_t static PHP_METHOD(PDOStatement, getAttribute) { - php_int_t attr; + zend_long attr; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { RETURN_FALSE; } @@ -1790,7 +1790,7 @@ static PHP_METHOD(PDOStatement, columnCount) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_INT(stmt->column_count); + RETURN_LONG(stmt->column_count); } /* }}} */ @@ -1798,11 +1798,11 @@ static PHP_METHOD(PDOStatement, columnCount) Returns meta data for a numbered column */ static PHP_METHOD(PDOStatement, getColumnMeta) { - php_int_t colno; + zend_long colno; struct pdo_column_data *col; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &colno)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colno)) { RETURN_FALSE; } if(colno < 0) { @@ -1824,11 +1824,11 @@ static PHP_METHOD(PDOStatement, getColumnMeta) /* add stock items */ col = &stmt->columns[colno]; add_assoc_string(return_value, "name", col->name); - add_assoc_int(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ - add_assoc_int(return_value, "precision", col->precision); + add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ + add_assoc_long(return_value, "precision", col->precision); if (col->param_type != PDO_PARAM_ZVAL) { /* if param_type is PDO_PARAM_ZVAL the driver has to provide correct data */ - add_assoc_int(return_value, "pdo_type", col->param_type); + add_assoc_long(return_value, "pdo_type", col->param_type); } } /* }}} */ @@ -1838,7 +1838,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta) int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip) { - php_int_t mode = PDO_FETCH_BOTH; + zend_long mode = PDO_FETCH_BOTH; int flags = 0, argc = ZEND_NUM_ARGS() - skip; zval *args; zend_class_entry *cep; @@ -1868,11 +1868,11 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); if (SUCCESS == retval) { - if (Z_TYPE(args[skip]) != IS_INT) { + if (Z_TYPE(args[skip]) != IS_LONG) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer" TSRMLS_CC); retval = FAILURE; } else { - mode = Z_IVAL(args[skip]); + mode = Z_LVAL(args[skip]); flags = mode & PDO_FETCH_FLAGS; retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC); @@ -1906,10 +1906,10 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_COLUMN: if (argc != 2) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument" TSRMLS_CC); - } else if (Z_TYPE(args[skip+1]) != IS_INT) { + } else if (Z_TYPE(args[skip+1]) != IS_LONG) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer" TSRMLS_CC); } else { - stmt->fetch.column = Z_IVAL(args[skip+1]); + stmt->fetch.column = Z_LVAL(args[skip+1]); retval = SUCCESS; } break; @@ -2119,7 +2119,7 @@ static PHP_METHOD(PDOStatement, debugDumpParams) stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0); if (stmt->bound_params) { - php_uint_t num; + zend_ulong num; zend_string *key = NULL; ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) { if (key) { @@ -2215,7 +2215,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str zend_string *lc_method_name; zend_object *object = *object_pp; - lc_method_name = STR_ALLOC(method_name->len, 0); + lc_method_name = zend_string_alloc(method_name->len, 0); zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len); if ((fbc = zend_hash_find_ptr(&object->ce->function_table, lc_method_name)) == NULL) { @@ -2241,7 +2241,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str } out: - STR_RELEASE(lc_method_name); + zend_string_release(lc_method_name); return fbc; } @@ -2372,7 +2372,7 @@ zend_object *pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC) struct php_pdo_iterator { zend_object_iterator iter; - php_uint_t key; + zend_ulong key; zval fetch_ahead; }; @@ -2413,7 +2413,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_D if (I->key == (ulong)-1) { ZVAL_NULL(key); } else { - ZVAL_INT(key, I->key); + ZVAL_LONG(key, I->key); } } @@ -2489,9 +2489,9 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl ZVAL_NULL(rv); if (stmt) { - if (Z_TYPE_P(member) == IS_INT) { - if (Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count) { - fetch_value(stmt, rv, Z_IVAL_P(member), NULL TSRMLS_CC); + if (Z_TYPE_P(member) == IS_LONG) { + if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) { + fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC); } } else { convert_to_string(member); @@ -2543,8 +2543,8 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c int colno = -1; if (stmt) { - if (Z_TYPE_P(member) == IS_INT) { - return Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count; + if (Z_TYPE_P(member) == IS_LONG) { + return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count; } else { convert_to_string(member); @@ -2606,15 +2606,15 @@ static union _zend_function *row_method_get( zend_function *fbc; zend_string *lc_method_name; - lc_method_name = STR_ALLOC(method_name->len, 0); + lc_method_name = zend_string_alloc(method_name->len, 0); zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len); if ((fbc = zend_hash_find_ptr(&pdo_row_ce->function_table, lc_method_name)) == NULL) { - STR_RELEASE(lc_method_name); + zend_string_release(lc_method_name); return NULL; } - STR_RELEASE(lc_method_name); + zend_string_release(lc_method_name); return fbc; } @@ -2628,7 +2628,7 @@ static union _zend_function *row_get_ctor(zend_object *object TSRMLS_DC) static zend_internal_function ctor = {0}; ctor.type = ZEND_INTERNAL_FUNCTION; - ctor.function_name = STR_INIT("__construct", sizeof("__construct") - 1, 0); + ctor.function_name = zend_string_init("__construct", sizeof("__construct") - 1, 0); ctor.scope = pdo_row_ce; ctor.handler = ZEND_FN(dbstmt_constructor); ctor.fn_flags = ZEND_ACC_PUBLIC; @@ -2646,7 +2646,7 @@ static zend_string *row_get_classname(const zend_object *object, int parent TSRM if (parent) { return NULL; } else { - return STR_INIT("PDORow", sizeof("PDORow") - 1, 0); + return zend_string_init("PDORow", sizeof("PDORow") - 1, 0); } } diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h index 2072dd3469..0dca85779a 100644 --- a/ext/pdo/php_pdo.h +++ b/ext/pdo/php_pdo.h @@ -49,7 +49,7 @@ PHP_MSHUTDOWN_FUNCTION(pdo); PHP_MINFO_FUNCTION(pdo); ZEND_BEGIN_MODULE_GLOBALS(pdo) - php_int_t global_value; + zend_long global_value; ZEND_END_MODULE_GLOBALS(pdo) #ifdef ZTS @@ -58,13 +58,13 @@ ZEND_END_MODULE_GLOBALS(pdo) # define PDOG(v) (pdo_globals.v) #endif -#define REGISTER_PDO_CLASS_CONST_INT(const_name, value) \ - zend_declare_class_constant_int(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); +#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \ + zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); #define REGISTER_PDO_CONST_LONG(const_name, value) { \ zend_class_entry **pce; \ if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \ - zend_declare_class_constant_int(*pce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); \ + zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); \ } \ #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \ diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index b7f7f46250..7368a07126 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -194,13 +194,13 @@ enum pdo_null_handling { }; /* {{{ utils for reading attributes set as driver_options */ -static inline php_int_t pdo_attr_ival(zval *options, enum pdo_attribute_type option_name, php_int_t defval TSRMLS_DC) +static inline zend_long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, zend_long defval TSRMLS_DC) { zval *v; if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { convert_to_int_ex(v); - return Z_IVAL_P(v); + return Z_LVAL_P(v); } return defval; } @@ -210,7 +210,7 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { convert_to_string_ex(v); - return estrndup(Z_STRVAL_P(v), Z_STRSIZE_P(v)); + return estrndup(Z_STRVAL_P(v), Z_STRLEN_P(v)); } return defval ? estrdup(defval) : NULL; } @@ -220,8 +220,8 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio * initialized */ typedef struct { const char *driver_name; - php_uint_t driver_name_len; - php_uint_t api_version; /* needs to be compatible with PDO */ + zend_ulong driver_name_len; + zend_ulong api_version; /* needs to be compatible with PDO */ #define PDO_DRIVER_HEADER(name) \ #name, sizeof(#name)-1, \ @@ -244,10 +244,10 @@ typedef struct { typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh TSRMLS_DC); /* prepare a statement and stash driver specific portion into stmt */ -typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC); +typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC); /* execute a statement (that does not return a result set) */ -typedef php_int_t (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC); +typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC); /* quote a string */ typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC); @@ -256,7 +256,7 @@ typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unqu typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC); /* setting of attributes */ -typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC); /* return last insert id. NULL indicates error condition, otherwise, the return value * MUST be an emalloc'd NULL terminated string. */ @@ -271,7 +271,7 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC); /* fetching of attributes */ -typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC); /* checking/pinging persistent connections; return SUCCESS if the connection * is still alive and ready to be used, FAILURE otherwise. @@ -329,7 +329,7 @@ typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt TSRMLS_DC); * more rows. The ori and offset params modify which row should be returned, * if the stmt represents a scrollable cursor */ typedef int (*pdo_stmt_fetch_func)(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC); + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC); /* queries information about the type of a column, by index (0 based). * Driver should populate stmt->columns[colno] with appropriate info */ @@ -341,7 +341,7 @@ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC) * If the driver sets caller_frees, ptr should point to emalloc'd memory * and PDO will free it as soon as it is done using it. */ -typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC); +typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC); /* hook for bound params */ enum pdo_param_event { @@ -357,10 +357,10 @@ enum pdo_param_event { typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC); /* setting of attributes */ -typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC); /* fetching of attributes */ -typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC); /* retrieves meta data for a numbered column. * Returns SUCCESS/FAILURE. @@ -390,7 +390,7 @@ typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *va * or * 'flags' => array('not_null', 'mysql:some_flag'); // to add data to an existing key */ -typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC); +typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC); /* advances the statement to the next rowset of the batch. * If it returns 1, PDO will tear down its idea of columns @@ -469,7 +469,7 @@ struct _pdo_dbh_t { /* data source string used to open this handle */ const char *data_source; - php_uint_t data_source_len; + zend_ulong data_source_len; /* the global error code. */ pdo_error_type error_code; @@ -529,9 +529,9 @@ static inline pdo_dbh_object_t *php_pdo_dbh_fetch_object(zend_object *obj) { struct pdo_column_data { char *name; int namelen; - php_uint_t maxlen; + zend_ulong maxlen; enum pdo_param_type param_type; - php_uint_t precision; + zend_ulong precision; /* don't touch this unless your name is dbdo */ void *dbdo_data; @@ -539,10 +539,10 @@ struct pdo_column_data { /* describes a bound parameter */ struct pdo_bound_param_data { - php_int_t paramno; /* if -1, then it has a name, and we don't know the index *yet* */ + zend_long paramno; /* if -1, then it has a name, and we don't know the index *yet* */ zend_string *name; - php_int_t max_value_len; /* as a hint for pre-allocation */ + zend_long max_value_len; /* as a hint for pre-allocation */ zval parameter; /* the variable itself */ enum pdo_param_type param_type; /* desired or suggested type */ @@ -591,7 +591,7 @@ struct _pdo_stmt_t { HashTable *bound_columns; /* not always meaningful */ - php_int_t row_count; + zend_long row_count; /* used to hold the statement's current query */ char *query_string; @@ -607,7 +607,7 @@ struct _pdo_stmt_t { /* for lazy fetches, we always return the same lazy object handle. * Let's keep it here. */ zval lazy_object_ref; - php_uint_t refcount; + zend_ulong refcount; /* defaults for fetches */ enum pdo_fetch_type default_fetch_type; @@ -669,7 +669,7 @@ struct pdo_data_src_parser { }; PDO_API int php_pdo_parse_data_source(const char *data_source, - php_uint_t data_source_len, struct pdo_data_src_parser *parsed, + zend_ulong data_source_len, struct pdo_data_src_parser *parsed, int nparams); PDO_API zend_class_entry *php_pdo_get_dbh_ce(void); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index f329435e23..ddf182b190 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -60,12 +60,12 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS spprintf(&message, 0, "%s [%d] (severity %d) [%s]", msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : ""); - add_next_index_int(info, einfo->dberr); + add_next_index_long(info, einfo->dberr); // TODO: avoid reallocation ??? add_next_index_string(info, message); efree(message); - add_next_index_int(info, einfo->oserr); - add_next_index_int(info, einfo->severity); + add_next_index_long(info, einfo->oserr); + add_next_index_long(info, einfo->severity); if (einfo->oserrstr) { add_next_index_string(info, einfo->oserrstr); } @@ -93,7 +93,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) return 0; } -static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; pdo_dblib_stmt *S = ecalloc(1, sizeof(*S)); @@ -107,7 +107,7 @@ static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_ return 1; } -static php_int_t dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) +static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; RETCODE ret, resret; diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index fa071c0e26..6bd2a5976e 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -171,7 +171,7 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) } static int pdo_dblib_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) { RETCODE ret; @@ -213,7 +213,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) } static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, - php_uint_t *len, int *caller_frees TSRMLS_DC) + zend_ulong *len, int *caller_frees TSRMLS_DC) { pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data; @@ -287,7 +287,7 @@ static int pdo_dblib_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da return 1; } -static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) +static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC) { pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data; pdo_dblib_db_handle *H = S->H; @@ -303,13 +303,13 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zva if(!dbtypeinfo) return FAILURE; - add_assoc_int(return_value, "max_length", dbcollen(H->link, colno+1) ); - add_assoc_int(return_value, "precision", (int) dbtypeinfo->precision ); - add_assoc_int(return_value, "scale", (int) dbtypeinfo->scale ); + add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) ); + add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision ); + add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale ); add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1)); add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1))); - add_assoc_int(return_value, "native_type_id", dbcoltype(H->link, colno+1)); - add_assoc_int(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); + add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1)); + add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); return 1; } diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index fb3979863b..ab4612a119 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -33,11 +33,11 @@ #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" -static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, php_int_t, XSQLDA*, isc_stmt_handle*, +static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, zend_long, XSQLDA*, isc_stmt_handle*, HashTable* TSRMLS_DC); /* map driver specific error message to PDO error */ -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC) /* {{{ */ +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line TSRMLS_DC) /* {{{ */ { #if 0 pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H @@ -132,7 +132,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* called by PDO to prepare an SQL query */ -static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */ +static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */ pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -218,7 +218,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t s /* }}} */ /* called by PDO to execute a statement that doesn't produce a result set */ -static php_int_t firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) /* {{{ */ +static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; isc_stmt_handle stmt = NULL; @@ -391,12 +391,12 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* used by prepare and exec to allocate a statement handle and prepare the SQL */ -static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */ +static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, /* {{{ */ XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; char *c, *new_sql, in_quote, in_param, pname[64], *ppname; - php_int_t l, pindex = -1; + zend_long l, pindex = -1; /* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */ if (sql_len > 65536) { @@ -448,7 +448,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_ *ppname++ = 0; if (named_params) { zval tmp; - ZVAL_INT(&tmp, pindex); + ZVAL_LONG(&tmp, pindex); zend_hash_str_update(named_params, pname, (unsigned int)(ppname - pname - 1), &tmp); } } @@ -470,7 +470,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_ /* }}} */ /* called by PDO to set a driver-specific dbh attribute */ -static int firebird_handle_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -545,7 +545,7 @@ static void firebird_info_cb(void *arg, char const *s) /* {{{ */ /* }}} */ /* called by PDO to get a driver-specific dbh attribute */ -static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -553,7 +553,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *v char tmp[512]; case PDO_ATTR_AUTOCOMMIT: - ZVAL_INT(val,dbh->auto_commit); + ZVAL_LONG(val,dbh->auto_commit); return 1; case PDO_ATTR_CONNECTION_STATUS: @@ -606,10 +606,10 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; const ISC_STATUS *s = H->isc_status; char buf[400]; - php_int_t i = 0, l, sqlcode = isc_sqlcode(s); + zend_long i = 0, l, sqlcode = isc_sqlcode(s); if (sqlcode) { - add_next_index_int(info, sqlcode); + add_next_index_long(info, sqlcode); while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) { i += l; @@ -617,7 +617,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval } add_next_index_string(info, buf); } else if (H->last_app_error) { - add_next_index_int(info, -999); + add_next_index_long(info, -999); add_next_index_string(info, const_cast(H->last_app_error)); } return 1; diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index bf6431c09e..622cbc39a3 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -88,7 +88,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; - php_uint_t affected_rows = 0; + zend_ulong affected_rows = 0; static char info_count[] = {isc_info_sql_records}; char result[64]; @@ -153,7 +153,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* called by PDO to fetch the next row from a statement */ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -219,7 +219,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ /* fetch a blob into a fetch buffer */ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - php_uint_t *len, ISC_QUAD *blob_id TSRMLS_DC) + zend_ulong *len, ISC_QUAD *blob_id TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -263,7 +263,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ * /* we've found the blob's length, now fetch! */ if (*len) { - php_uint_t cur_len; + zend_ulong cur_len; unsigned short seg_len; ISC_STATUS stat; @@ -296,7 +296,7 @@ fetch_blob_end: /* }}} */ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - php_uint_t *len, int *caller_frees TSRMLS_DC) + zend_ulong *len, int *caller_frees TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; @@ -413,7 +413,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; isc_blob_handle h = NULL; - php_uint_t put_cnt = 0, rem_cnt; + zend_ulong put_cnt = 0, rem_cnt; unsigned short chunk_size; int result = 1; @@ -425,7 +425,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T SEPARATE_ZVAL(param); convert_to_string_ex(param); - for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -467,7 +467,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat /* try to determine the index by looking in the named_params hash */ if ((index = zend_hash_find(S->named_params, param->name)) != NULL) { - param->paramno = Z_IVAL_P(index); + param->paramno = Z_LVAL_P(index); } else { /* ... or by looking in the input descriptor */ int i; @@ -495,7 +495,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (event_type) { char *value; - php_uint_t value_len; + zend_ulong value_len; int caller_frees; zval *parameter; @@ -549,11 +549,11 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (Z_TYPE_P(parameter)) { int force_null; - case IS_INT: + case IS_LONG: /* keep the allow-NULL flag */ - var->sqltype = (sizeof(php_int_t) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); - var->sqldata = (void*)&Z_IVAL_P(parameter); - var->sqllen = sizeof(php_int_t); + var->sqltype = (sizeof(zend_long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); + var->sqldata = (void*)&Z_LVAL_P(parameter); + var->sqllen = sizeof(zend_long); break; case IS_DOUBLE: /* keep the allow-NULL flag */ @@ -574,13 +574,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRSIZE_P(parameter) == 0); + force_null = (Z_STRLEN_P(parameter) == 0); } if (!force_null) { /* keep the allow-NULL flag */ var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(parameter); - var->sqllen = Z_STRSIZE_P(parameter); + var->sqllen = Z_STRLEN_P(parameter); break; } case IS_NULL: @@ -626,7 +626,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_INT: if (value) { - ZVAL_INT(parameter, *(php_int_t*)value); + ZVAL_LONG(parameter, *(zend_long*)value); break; } case PDO_PARAM_EVT_NORMALIZE: @@ -654,7 +654,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } /* }}} */ -static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; @@ -675,7 +675,7 @@ static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *v } /* }}} */ -static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index e81b7c553f..4eea0b69de 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -62,9 +62,9 @@ ZEND_GET_MODULE(pdo_firebird) PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */ { - REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_DATE_FORMAT", (php_int_t) PDO_FB_ATTR_DATE_FORMAT); - REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIME_FORMAT", (php_int_t) PDO_FB_ATTR_TIME_FORMAT); - REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIMESTAMP_FORMAT", (php_int_t) PDO_FB_ATTR_TIMESTAMP_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (zend_long) PDO_FB_ATTR_DATE_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (zend_long) PDO_FB_ATTR_TIME_FORMAT); + REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (zend_long) PDO_FB_ATTR_TIMESTAMP_FORMAT); php_pdo_register_driver(&pdo_firebird_driver); diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index 831fa59726..20baebacaa 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -128,7 +128,7 @@ extern pdo_driver_t pdo_firebird_driver; extern struct pdo_stmt_methods firebird_stmt_methods; -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC); +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line TSRMLS_DC); enum { PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC, diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 8dd981f42e..6243a47e07 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -129,7 +129,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in } if (einfo->errcode) { - add_next_index_int(info, einfo->errcode); + add_next_index_long(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -161,7 +161,7 @@ static int mysql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* }}} */ /* {{{ mysql_handle_preparer */ -static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt)); @@ -235,12 +235,12 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_ #else S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND)); S->in_null = ecalloc(S->num_params, sizeof(my_bool)); - S->in_length = ecalloc(S->num_params, sizeof(php_uint_t)); + S->in_length = ecalloc(S->num_params, sizeof(zend_ulong)); #endif } dbh->alloc_own_columns = 1; - S->max_length = pdo_attr_ival(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); + S->max_length = pdo_attr_lval(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); PDO_DBG_RETURN(1); @@ -253,7 +253,7 @@ end: /* }}} */ /* {{{ mysql_handle_doer */ -static php_int_t mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) +static zend_long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; PDO_DBG_ENTER("mysql_handle_doer"); @@ -368,7 +368,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh TSRMLS_DC) /* }}} */ /* {{{ pdo_mysql_set_attribute */ -static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) +static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) { PDO_DBG_ENTER("pdo_mysql_set_attribute"); PDO_DBG_INF_FMT("dbh=%p", dbh); @@ -401,12 +401,12 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSR #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: convert_to_int(val); - if (Z_IVAL_P(val) < 0) { + if (Z_LVAL_P(val) < 0) { /* TODO: Johannes, can we throw a warning here? */ ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size); } else { - ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_IVAL_P(val); + ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val); } PDO_DBG_RETURN(1); break; @@ -419,7 +419,7 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSR /* }}} */ /* {{{ pdo_mysql_get_attribute */ -static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) +static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; @@ -456,20 +456,20 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_ } break; case PDO_ATTR_AUTOCOMMIT: - ZVAL_INT(return_value, dbh->auto_commit); + ZVAL_LONG(return_value, dbh->auto_commit); break; case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY: - ZVAL_INT(return_value, H->buffered); + ZVAL_LONG(return_value, H->buffered); break; case PDO_MYSQL_ATTR_DIRECT_QUERY: - ZVAL_INT(return_value, H->emulate_prepare); + ZVAL_LONG(return_value, H->emulate_prepare); break; #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - ZVAL_INT(return_value, H->max_buffer_size); + ZVAL_LONG(return_value, H->max_buffer_size); break; #endif @@ -596,30 +596,30 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ /* handle MySQL options */ if (driver_options) { - php_int_t connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); - php_int_t local_infile = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); + zend_long connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + zend_long local_infile = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); char *init_cmd = NULL; #ifndef PDO_USE_MYSQLND char *default_file = NULL, *default_group = NULL; #endif - php_int_t compress = 0; + zend_long compress = 0; char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL; - H->buffered = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); + H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); - H->emulate_prepare = pdo_attr_ival(driver_options, + H->emulate_prepare = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_DIRECT_QUERY, H->emulate_prepare TSRMLS_CC); - H->emulate_prepare = pdo_attr_ival(driver_options, + H->emulate_prepare = pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare TSRMLS_CC); #ifndef PDO_USE_MYSQLND - H->max_buffer_size = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); + H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); #endif - if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { + if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { connect_opts |= CLIENT_FOUND_ROWS; } - if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { + if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { connect_opts |= CLIENT_IGNORE_SPACE; } @@ -648,7 +648,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ * mysqlnd doesn't support reconnect, thus we don't have "|| defined(PDO_USE_MYSQLND)" */ { - php_int_t reconnect = 1; + zend_long reconnect = 1; mysql_options(H->server, MYSQL_OPT_RECONNECT, (const char*)&reconnect); } #endif @@ -682,7 +682,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ efree(default_group); } #endif - compress = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); + compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); if (compress) { if (mysql_options(H->server, MYSQL_OPT_COMPRESS, 0)) { pdo_mysql_error(dbh); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 17a6345432..909527eed2 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -116,10 +116,10 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { - php_int_t row_count; + zend_long row_count; pdo_mysql_stmt *S = stmt->driver_data; - row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt); - if (row_count != (php_int_t)-1) { + row_count = (zend_long) mysql_stmt_affected_rows(S->stmt); + if (row_count != (zend_long)-1) { stmt->row_count = row_count; } } @@ -146,12 +146,12 @@ static int pdo_mysql_fill_stmt_from_result(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ PDO_DBG_RETURN(0); } - stmt->row_count = (php_int_t) mysql_num_rows(S->result); + stmt->row_count = (zend_long) mysql_num_rows(S->result); stmt->column_count = (int) mysql_num_fields(S->result); S->fields = mysql_fetch_fields(S->result); } else { /* this was a DML or DDL query (INSERT, UPDATE, DELETE, ... */ - stmt->row_count = (php_int_t) row_count; + stmt->row_count = (zend_long) row_count; } PDO_DBG_RETURN(1); @@ -200,7 +200,7 @@ static int pdo_mysql_stmt_execute_prepared_libmysql(pdo_stmt_t *stmt TSRMLS_DC) stmt->column_count = (int)mysql_num_fields(S->result); S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND)); S->out_null = ecalloc(stmt->column_count, sizeof(my_bool)); - S->out_length = ecalloc(stmt->column_count, sizeof(php_uint_t)); + S->out_length = ecalloc(stmt->column_count, sizeof(zend_ulong)); /* summon memory to hold the row */ for (i = 0; i < stmt->column_count; i++) { @@ -343,7 +343,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; pdo_mysql_db_handle *H = S->H; #if PDO_USE_MYSQLND - php_int_t row_count; + zend_long row_count; #endif PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset"); PDO_DBG_INF_FMT("stmt=%p", S->stmt); @@ -393,8 +393,8 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } } } - row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt); - if (row_count != (php_int_t)-1) { + row_count = (zend_long) mysql_stmt_affected_rows(S->stmt); + if (row_count != (zend_long)-1) { stmt->row_count = row_count; } PDO_DBG_RETURN(1); @@ -550,7 +550,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_VAR_STRING); break; - case IS_INT: + case IS_LONG: #if SIZEOF_ZEND_INT==8 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONGLONG); #elif SIZEOF_ZEND_INT==4 @@ -576,13 +576,13 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: b->buffer_type = MYSQL_TYPE_STRING; b->buffer = Z_STRVAL_P(parameter); - b->buffer_length = Z_STRSIZE_P(parameter); - *b->length = Z_STRSIZE_P(parameter); + b->buffer_length = Z_STRLEN_P(parameter); + *b->length = Z_STRLEN_P(parameter); PDO_DBG_RETURN(1); - case IS_INT: + case IS_LONG: b->buffer_type = MYSQL_TYPE_LONG; - b->buffer = &Z_IVAL_P(parameter); + b->buffer = &Z_LVAL_P(parameter); PDO_DBG_RETURN(1); case IS_DOUBLE: @@ -608,7 +608,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da } /* }}} */ -static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; #if PDO_USE_MYSQLND @@ -722,7 +722,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ } /* }}} */ -static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; @@ -823,7 +823,7 @@ static char *type_to_name_native(int type) /* {{{ */ #undef PDO_MYSQL_NATIVE_TYPE_NAME } /* }}} */ -static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; const MYSQL_FIELD *F; @@ -879,10 +879,10 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *retu #if SIZEOF_LONG==8 case MYSQL_TYPE_LONGLONG: #endif - add_assoc_int(return_value, "pdo_type", PDO_PARAM_INT); + add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT); break; default: - add_assoc_int(return_value, "pdo_type", PDO_PARAM_STR); + add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR); break; } #endif diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index f57e06ca37..3a06741a05 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -106,25 +106,25 @@ static PHP_MINIT_FUNCTION(pdo_mysql) { REGISTER_INI_ENTRIES(); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_USE_BUFFERED_QUERY", (php_int_t)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_LOCAL_INFILE", (php_int_t)PDO_MYSQL_ATTR_LOCAL_INFILE); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_INIT_COMMAND", (php_int_t)PDO_MYSQL_ATTR_INIT_COMMAND); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY", (zend_long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE", (zend_long)PDO_MYSQL_ATTR_LOCAL_INFILE); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND", (zend_long)PDO_MYSQL_ATTR_INIT_COMMAND); #ifndef PDO_USE_MYSQLND - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_MAX_BUFFER_SIZE", (php_int_t)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_FILE", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_GROUP", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MAX_BUFFER_SIZE", (zend_long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE", (zend_long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (zend_long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); #endif - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_COMPRESS", (php_int_t)PDO_MYSQL_ATTR_COMPRESS); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_DIRECT_QUERY", (php_int_t)PDO_MYSQL_ATTR_DIRECT_QUERY); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_FOUND_ROWS", (php_int_t)PDO_MYSQL_ATTR_FOUND_ROWS); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_IGNORE_SPACE", (php_int_t)PDO_MYSQL_ATTR_IGNORE_SPACE); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_KEY", (php_int_t)PDO_MYSQL_ATTR_SSL_KEY); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CERT", (php_int_t)PDO_MYSQL_ATTR_SSL_CERT); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CA", (php_int_t)PDO_MYSQL_ATTR_SSL_CA); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CAPATH", (php_int_t)PDO_MYSQL_ATTR_SSL_CAPATH); - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CIPHER", (php_int_t)PDO_MYSQL_ATTR_SSL_CIPHER); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (zend_long)PDO_MYSQL_ATTR_COMPRESS); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (zend_long)PDO_MYSQL_ATTR_DIRECT_QUERY); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS", (zend_long)PDO_MYSQL_ATTR_FOUND_ROWS); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE", (zend_long)PDO_MYSQL_ATTR_IGNORE_SPACE); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_KEY", (zend_long)PDO_MYSQL_ATTR_SSL_KEY); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CERT", (zend_long)PDO_MYSQL_ATTR_SSL_CERT); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (zend_long)PDO_MYSQL_ATTR_SSL_CA); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (zend_long)PDO_MYSQL_ATTR_SSL_CAPATH); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (zend_long)PDO_MYSQL_ATTR_SSL_CIPHER); #if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) - REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SERVER_PUBLIC_KEY", (php_int_t)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); + REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (zend_long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); #endif diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index fe2d216a5f..31ccb5d02a 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -106,7 +106,7 @@ typedef struct { unsigned fetch_table_names:1; unsigned _reserved:31; #if !PDO_USE_MYSQLND - php_uint_t max_buffer_size; + zend_ulong max_buffer_size; #endif pdo_mysql_error_info einfo; @@ -122,9 +122,9 @@ typedef struct { const MYSQL_FIELD *fields; MYSQL_ROW current_data; #if PDO_USE_MYSQLND - php_uint_t *current_lengths; + zend_ulong *current_lengths; #else - php_int_t *current_lengths; + zend_long *current_lengths; #endif pdo_mysql_error_info einfo; #if PDO_USE_MYSQLND @@ -136,11 +136,11 @@ typedef struct { PDO_MYSQL_PARAM_BIND *params; #ifndef PDO_USE_MYSQLND my_bool *in_null; - php_uint_t *in_length; + zend_ulong *in_length; #endif PDO_MYSQL_PARAM_BIND *bound_result; my_bool *out_null; - php_uint_t *out_length; + zend_ulong *out_length; unsigned int params_given; unsigned max_length:1; } pdo_mysql_stmt; diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 279fda7439..e9d297cab8 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -49,7 +49,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info } if (einfo->errcode) { - add_next_index_int(info, einfo->errcode); + add_next_index_long(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -258,7 +258,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd int ret; #if HAVE_OCISTMTFETCH2 - S->exec_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, + S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT; #else @@ -302,7 +302,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd } - prefetch = pdo_oci_sanitize_prefetch(pdo_attr_ival(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); + prefetch = pdo_oci_sanitize_prefetch(pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); if (prefetch) { H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, H->err); @@ -458,7 +458,7 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_ convert_to_int(val); - dbh->auto_commit = Z_IVAL_P(val); + dbh->auto_commit = Z_LVAL_P(val); return 1; } else { return 0; diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 226e3ee493..4e341c08be 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -209,7 +209,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv /* regular string bind */ convert_to_string(param->parameter); *bufpp = Z_STRVAL_P(param->parameter); - *alenp = Z_STRSIZE_P(param->parameter); + *alenp = Z_STRLEN_P(param->parameter); } *piecep = OCI_ONE_PIECE; @@ -244,11 +244,11 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d convert_to_string(param->parameter); zval_dtor(param->parameter); - Z_STRSIZE_P(param->parameter) = param->max_value_len; - Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRSIZE_P(param->parameter)+1); + Z_STRLEN_P(param->parameter) = param->max_value_len; + Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRLEN_P(param->parameter)+1); P->used_for_output = 1; - P->actual_len = Z_STRSIZE_P(param->parameter); + P->actual_len = Z_STRLEN_P(param->parameter); *alenpp = &P->actual_len; *bufpp = Z_STRVAL_P(param->parameter); *piecep = OCI_ONE_PIECE; @@ -360,7 +360,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa && Z_STRVAL_P(param->parameter) != empty_string #endif ) { - Z_STRSIZE_P(param->parameter) = P->actual_len; + Z_STRLEN_P(param->parameter) = P->actual_len; Z_STRVAL_P(param->parameter) = erealloc(Z_STRVAL_P(param->parameter), P->actual_len+1); Z_STRVAL_P(param->parameter)[P->actual_len] = '\0'; } @@ -410,7 +410,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa } else if (Z_TYPE_P(param->parameter) == IS_STRING) { /* stick the string into the LOB */ consume = Z_STRVAL_P(param->parameter); - n = Z_STRSIZE_P(param->parameter); + n = Z_STRLEN_P(param->parameter); if (n) { OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE); while (n) { diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 3a7bf0a37b..e99463de58 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -48,7 +48,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf einfo->what, einfo->last_error, einfo->file, einfo->line); - add_next_index_int(info, einfo->last_error); + add_next_index_long(info, einfo->last_error); add_next_index_str(info, message); add_next_index_string(info, einfo->last_state); @@ -142,7 +142,7 @@ static int odbc_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) return 0; } -static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { RETCODE rc; pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; @@ -181,7 +181,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_l return 0; } - cursor_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); + cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); if (cursor_type != PDO_CURSOR_FWDONLY) { rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -220,7 +220,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_l return 1; } -static php_int_t odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) +static zend_long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; RETCODE rc; @@ -336,7 +336,7 @@ static int odbc_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) return 1; } -static int odbc_handle_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) +static int odbc_handle_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; switch (attr) { @@ -351,7 +351,7 @@ static int odbc_handle_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS } } -static int odbc_handle_get_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) +static int odbc_handle_get_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; switch (attr) { @@ -431,7 +431,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D } /* set up the cursor library, if needed, or if configured explicitly */ - cursor_lib = pdo_attr_ival(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); + cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_INTEGER); if (rc != SQL_SUCCESS && cursor_lib != SQL_CUR_USE_IF_NEEDED) { pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS"); diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 7e2b958a53..274ce9b0d6 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -58,7 +58,7 @@ static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype) } static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf, - php_uint_t buflen, php_uint_t *outlen) + zend_ulong buflen, zend_ulong *outlen) { #ifdef PHP_WIN32 if (is_unicode && buflen) { @@ -93,7 +93,7 @@ static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf, } static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf, - php_uint_t buflen, php_uint_t *outlen) + zend_ulong buflen, zend_ulong *outlen) { #ifdef PHP_WIN32 if (is_unicode && buflen) { @@ -190,16 +190,16 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) } if (Z_TYPE_P(parameter) != IS_RESOURCE) { /* they passed in a string */ - php_uint_t ulen; + zend_ulong ulen; convert_to_string(parameter); switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRSIZE_P(parameter), + Z_STRLEN_P(parameter), &ulen)) { case PDO_ODBC_CONV_NOT_REQUIRED: SQLPutData(S->stmt, Z_STRVAL_P(parameter), - Z_STRSIZE_P(parameter)); + Z_STRLEN_P(parameter)); break; case PDO_ODBC_CONV_OK: SQLPutData(S->stmt, S->convbuf, ulen); @@ -447,10 +447,10 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } else { convert_to_string(parameter); if (P->outbuf) { - P->len = Z_STRSIZE_P(parameter); + P->len = Z_STRLEN_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); } } } else if (Z_TYPE_P(parameter) == IS_NULL || PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL) { @@ -458,14 +458,14 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } else { convert_to_string(parameter); if (P->outbuf) { - php_uint_t ulen; + zend_ulong ulen; switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRSIZE_P(parameter), + Z_STRLEN_P(parameter), &ulen)) { case PDO_ODBC_CONV_FAIL: case PDO_ODBC_CONV_NOT_REQUIRED: - P->len = Z_STRSIZE_P(parameter); + P->len = Z_STRLEN_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); break; case PDO_ODBC_CONV_OK: @@ -474,7 +474,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p break; } } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); } } return 1; @@ -483,9 +483,9 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p P = param->driver_data; if (P->outbuf) { - php_uint_t ulen; + zend_ulong ulen; char *srcbuf; - php_uint_t srclen = 0; + zend_ulong srclen = 0; if (Z_ISREF(param->parameter)) { parameter = Z_REFVAL(param->parameter); @@ -512,9 +512,9 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p break; } - ZVAL_NEW_STR(parameter, STR_ALLOC(srclen, 0)); + ZVAL_NEW_STR(parameter, zend_string_alloc(srclen, 0)); memcpy(Z_STRVAL_P(parameter), srcbuf, srclen); - Z_STRVAL_P(parameter)[Z_STRSIZE_P(parameter)] = '\0'; + Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0'; } } return 1; @@ -524,7 +524,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } static int odbc_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) { RETCODE rc; SQLSMALLINT odbcori; @@ -628,15 +628,15 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) +static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC) { pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; pdo_odbc_column *C = &S->cols[colno]; - php_uint_t ulen; + zend_ulong ulen; /* if it is a column containing "long" data, perform late binding now */ if (C->is_long) { - php_uint_t used = 0; + zend_ulong used = 0; char *buf; RETCODE rc; @@ -755,7 +755,7 @@ in_data: return 1; } -static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) +static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) { SQLRETURN rc; pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; @@ -763,7 +763,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRML switch (attr) { case PDO_ATTR_CURSOR_NAME: convert_to_string(val); - rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { return 1; @@ -782,7 +782,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRML } } -static int odbc_stmt_get_attr(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) +static int odbc_stmt_get_attr(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC) { SQLRETURN rc; pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index f78b1af8ec..1fe17c1c30 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -136,11 +136,11 @@ PHP_MINIT_FUNCTION(pdo_odbc) } #endif - REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); - REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); - REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); - REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); - REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); + REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); return SUCCESS; } diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h index c467ecf83a..90d9d5d505 100644 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ b/ext/pdo_odbc/php_pdo_odbc_int.h @@ -135,7 +135,7 @@ typedef struct { typedef struct { char *data; - php_uint_t datalen; + zend_ulong datalen; SQLLEN fetched_len; SWORD coltype; char colname[128]; @@ -150,7 +150,7 @@ typedef struct { pdo_odbc_db_handle *H; pdo_odbc_errinfo einfo; char *convbuf; - php_uint_t convbufsize; + zend_ulong convbufsize; unsigned going_long:1; unsigned assume_utf8:1; unsigned _spare:30; diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c index fc7aa827ab..5fbad7d4a0 100644 --- a/ext/pdo_pgsql/pdo_pgsql.c +++ b/ext/pdo_pgsql/pdo_pgsql.c @@ -85,13 +85,13 @@ ZEND_GET_MODULE(pdo_pgsql) */ PHP_MINIT_FUNCTION(pdo_pgsql) { - REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_IDLE", (php_int_t)PGSQL_TRANSACTION_IDLE); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_ACTIVE", (php_int_t)PGSQL_TRANSACTION_ACTIVE); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INTRANS", (php_int_t)PGSQL_TRANSACTION_INTRANS); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INERROR", (php_int_t)PGSQL_TRANSACTION_INERROR); - REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_UNKNOWN", (php_int_t)PGSQL_TRANSACTION_UNKNOWN); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR); + REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN); php_pdo_register_driver(&pdo_pgsql_driver); return SUCCESS; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index b79a098569..f8e43391f2 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -113,7 +113,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in pdo_pgsql_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_int(info, einfo->errcode); + add_next_index_long(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -214,7 +214,7 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ } /* }}} */ -static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt)); @@ -229,7 +229,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_ stmt->driver_data = S; stmt->methods = &pgsql_stmt_methods; - scrollable = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, + scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL; if (scrollable) { @@ -239,14 +239,14 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_ spprintf(&S->cursor_name, 0, "pdo_crsr_%08x", ++H->stmt_counter); emulate = 1; } else if (driver_options) { - if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { + if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); emulate = 1; } - if (pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { + if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { emulate = 1; } - if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { + if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { execute_only = 1; } } else { @@ -287,11 +287,11 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_ return 1; } -static php_int_t pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) +static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; PGresult *res; - php_int_t ret = 1; + zend_long ret = 1; ExecStatusType qs; if (!(res = PQexec(H->server, sql))) { @@ -354,7 +354,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned if (H->pgoid == InvalidOid) { return NULL; } - *len = spprintf(&id, 0, ZEND_INT_FMT, (php_int_t) H->pgoid); + *len = spprintf(&id, 0, ZEND_INT_FMT, (zend_long) H->pgoid); } else { PGresult *res; ExecStatusType status; @@ -377,7 +377,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned return id; } -static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) +static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; @@ -577,12 +577,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) int query_len; convert_to_string_ex(tmp); - if (buffer_len < Z_STRSIZE_P(tmp)) { - buffer_len = Z_STRSIZE_P(tmp); + if (buffer_len < Z_STRLEN_P(tmp)) { + buffer_len = Z_STRLEN_P(tmp); query = erealloc(query, buffer_len + 2); /* room for \n\0 */ } - memcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); - query_len = Z_STRSIZE_P(tmp); + memcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + query_len = Z_STRLEN_P(tmp); if (query[query_len - 1] != '\n') { query[query_len++] = '\n'; } @@ -910,7 +910,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate) lfd = lo_creat(H->server, INV_READ|INV_WRITE); if (lfd != InvalidOid) { - zend_string *buf = strpprintf(0, ZEND_UINT_FMT, (php_int_t) lfd); + zend_string *buf = strpprintf(0, ZEND_UINT_FMT, (zend_long) lfd); RETURN_STR(buf); } @@ -1015,11 +1015,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) { pdo_dbh_t *dbh; pdo_pgsql_db_handle *H; - php_int_t result_type = PDO_FETCH_USE_DEFAULT; - php_int_t ms_timeout = 0; + zend_long result_type = PDO_FETCH_USE_DEFAULT; + zend_long ms_timeout = 0; PGnotify *pgsql_notify; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &result_type, &ms_timeout)) { RETURN_FALSE; } @@ -1060,11 +1060,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) array_init(return_value); if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_int(return_value, 1, pgsql_notify->be_pid); + add_index_long(return_value, 1, pgsql_notify->be_pid); } if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_int(return_value, "pid", pgsql_notify->be_pid); + add_assoc_long(return_value, "pid", pgsql_notify->be_pid); } PQfreemem(pgsql_notify); @@ -1083,7 +1083,7 @@ static PHP_METHOD(PDO, pgsqlGetPid) H = (pdo_pgsql_db_handle *)dbh->driver_data; - RETURN_INT(PQbackendPID(H->server)); + RETURN_LONG(PQbackendPID(H->server)); } /* }}} */ @@ -1111,23 +1111,23 @@ static const zend_function_entry *pdo_pgsql_get_driver_methods(pdo_dbh_t *dbh, i } } -static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) +static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; switch (attr) { case PDO_ATTR_EMULATE_PREPARES: convert_to_int(val); - H->emulate_prepares = Z_IVAL_P(val); + H->emulate_prepares = Z_LVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT: convert_to_int(val); php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); - H->disable_native_prepares = Z_IVAL_P(val); + H->disable_native_prepares = Z_LVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_PREPARES: convert_to_int(val); - H->disable_prepares = Z_IVAL_P(val); + H->disable_prepares = Z_LVAL_P(val); return 1; default: return 0; @@ -1158,7 +1158,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ int ret = 0; char *conn_str, *p, *e; char *tmp_pass; - php_int_t connect_timeout = 30; + zend_long connect_timeout = 30; H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent); dbh->driver_data = H; @@ -1176,7 +1176,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ } if (driver_options) { - connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); } if (dbh->password) { diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index eb13548558..f50e95e6be 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -233,7 +233,7 @@ stmt_retry: ZEND_ATOI(stmt->row_count, PQcmdTuples(S->result)); H->pgoid = PQoidValue(S->result); } else { - stmt->row_count = (php_int_t)PQntuples(S->result); + stmt->row_count = (zend_long)PQntuples(S->result); } return 1; @@ -359,7 +359,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * //SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); convert_to_string_ex(parameter); S->param_values[param->paramno] = Z_STRVAL_P(parameter); - S->param_lengths[param->paramno] = Z_STRSIZE_P(parameter); + S->param_lengths[param->paramno] = Z_STRLEN_P(parameter); S->param_formats[param->paramno] = 0; } @@ -391,7 +391,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * } static int pgsql_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; @@ -480,7 +480,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) break; case INT8OID: - if (sizeof(php_int_t)>=8) { + if (sizeof(zend_long)>=8) { cols[colno].param_type = PDO_PARAM_INT; } else { cols[colno].param_type = PDO_PARAM_STR; @@ -498,7 +498,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) +static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; struct pdo_column_data *cols = stmt->columns; @@ -521,7 +521,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_ case PDO_PARAM_INT: ZEND_ATOI(S->cols[colno].intval, *ptr); *ptr = (char *) &(S->cols[colno].intval); - *len = sizeof(php_int_t); + *len = sizeof(zend_long); break; case PDO_PARAM_BOOL: @@ -577,7 +577,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_ return 1; } -static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) +static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; PGresult *res; @@ -593,7 +593,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *r } array_init(return_value); - add_assoc_int(return_value, "pgsql:oid", S->cols[colno].pgsql_type); + add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 0462daff1f..d6f7ad48aa 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -54,7 +54,7 @@ typedef struct { typedef struct { char *def; Oid pgsql_type; - php_int_t intval; + zend_long intval; zend_bool boolval; } pdo_pgsql_column; diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 50887b4bb3..da69448d5d 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -92,7 +92,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i pdo_sqlite_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_int(info, einfo->errcode); + add_next_index_long(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -175,7 +175,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ } /* }}} */ -static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt)); @@ -187,7 +187,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql stmt->methods = &sqlite_stmt_methods; stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED; - if (PDO_CURSOR_FWDONLY != pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { + if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { H->einfo.errcode = SQLITE_ERROR; pdo_sqlite_error(dbh); return 0; @@ -203,7 +203,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql return 0; } -static php_int_t sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) +static zend_long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; @@ -280,7 +280,7 @@ static int sqlite_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) return 1; } -static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) +static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value TSRMLS_DC) { switch (attr) { case PDO_ATTR_CLIENT_VERSION: @@ -295,14 +295,14 @@ static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return return 1; } -static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) +static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; switch (attr) { case PDO_ATTR_TIMEOUT: convert_to_int(val); - sqlite3_busy_timeout(H->db, Z_IVAL_P(val) * 1000); + sqlite3_busy_timeout(H->db, Z_LVAL_P(val) * 1000); return 1; } return 0; @@ -351,14 +351,14 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, } ZVAL_REF(&zargs[0], agg_context); } - ZVAL_INT(&zargs[1], sqlite3_aggregate_count(context)); + ZVAL_LONG(&zargs[1], sqlite3_aggregate_count(context)); } for (i = 0; i < argc; i++) { /* get the value */ switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: - ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); break; case SQLITE_FLOAT: @@ -399,8 +399,8 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_INT: - sqlite3_result_int(context, Z_IVAL(retval)); + case IS_LONG: + sqlite3_result_int(context, Z_LVAL(retval)); break; case IS_NULL: @@ -413,7 +413,7 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); break; } } else { @@ -496,13 +496,13 @@ static int php_sqlite3_collation_callback(void *context, if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc TSRMLS_CC)) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_INT) { + if (Z_TYPE(retval) != IS_LONG) { convert_to_int_ex(&retval); } ret = 0; - if (Z_IVAL(retval) > 0) { + if (Z_LVAL(retval) > 0) { ret = 1; - } else if (Z_IVAL(retval) < 0) { + } else if (Z_LVAL(retval) < 0) { ret = -1; } zval_ptr_dtor(&retval); @@ -522,13 +522,13 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) zval *callback; char *func_name; int func_name_len; - php_int_t argc = -1; + zend_long argc = -1; zend_string *cbname = NULL; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &func_name, &func_name_len, &callback, &argc)) { RETURN_FALSE; } @@ -538,10 +538,10 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val); - STR_RELEASE(cbname); + zend_string_release(cbname); RETURN_FALSE; } - STR_RELEASE(cbname); + zend_string_release(cbname); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -592,13 +592,13 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) zval *step_callback, *fini_callback; char *func_name; int func_name_len; - php_int_t argc = -1; + zend_long argc = -1; zend_string *cbname = NULL; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &func_name, &func_name_len, &step_callback, &fini_callback, &argc)) { RETURN_FALSE; } @@ -608,16 +608,16 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) if (!zend_is_callable(step_callback, 0, &cbname TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val); - STR_RELEASE(cbname); + zend_string_release(cbname); RETURN_FALSE; } - STR_RELEASE(cbname); + zend_string_release(cbname); if (!zend_is_callable(fini_callback, 0, &cbname TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val); - STR_RELEASE(cbname); + zend_string_release(cbname); RETURN_FALSE; } - STR_RELEASE(cbname); + zend_string_release(cbname); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -668,10 +668,10 @@ static PHP_METHOD(SQLite, sqliteCreateCollation) if (!zend_is_callable(callback, 0, &cbname TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname->val); - STR_RELEASE(cbname); + zend_string_release(cbname); RETURN_FALSE; } - STR_RELEASE(cbname); + zend_string_release(cbname); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -792,7 +792,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS { pdo_sqlite_db_handle *H; int i, ret = 0; - php_int_t timeout = 60; + zend_long timeout = 60; char *filename; H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent); @@ -823,7 +823,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS } if (driver_options) { - timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); + timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); } sqlite3_busy_timeout(H->db, timeout * 1000); diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index ee6879544a..739bcc6de8 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -119,11 +119,11 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d } else { convert_to_int(parameter); #if PHP_INT_MAX > 2147483647 - if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { + if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { return 1; } #else - if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { + if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { return 1; } #endif @@ -159,7 +159,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d if (SQLITE_OK == sqlite3_bind_blob(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRSIZE_P(parameter), + Z_STRLEN_P(parameter), SQLITE_STATIC)) { return 1; } @@ -180,7 +180,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d convert_to_string(parameter); if (SQLITE_OK == sqlite3_bind_text(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRSIZE_P(parameter), + Z_STRLEN_P(parameter), SQLITE_STATIC)) { return 1; } @@ -198,7 +198,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d } static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) + enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; int i; @@ -259,7 +259,7 @@ static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) +static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; if (!S->stmt) { @@ -288,7 +288,7 @@ static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_ } } -static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) +static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; const char *str; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 5be85aea1c..ad75b23312 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -63,7 +63,7 @@ #define PGSQL_STATUS_LONG 1 #define PGSQL_STATUS_STRING 2 -#define PGSQL_MAX_LENGTH_OF_ZEND_INT 30 +#define PGSQL_MAX_LENGTH_OF_LONG 30 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60 #if PHP_INT_MAX < UINT_MAX @@ -74,10 +74,10 @@ smart_str_0(&s); \ RETURN_STR(s.s); \ } \ - RETURN_INT((php_int_t)oid); \ + RETURN_LONG((zend_long)oid); \ } while(0) #else -#define PGSQL_RETURN_OID(oid) RETURN_INT((php_int_t)oid) +#define PGSQL_RETURN_OID(oid) RETURN_LONG((zend_long)oid) #endif #if HAVE_PQSETNONBLOCKING @@ -968,7 +968,7 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message) if (PGG(log_notices)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message); } - zend_hash_index_update_ptr(&PGG(notices), (php_uint_t)resource_id, notice); + zend_hash_index_update_ptr(&PGG(notices), (zend_ulong)resource_id, notice); } } /* }}} */ @@ -1113,88 +1113,88 @@ PHP_MINIT_FUNCTION(pgsql) REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT); #endif /* For connection option */ - REGISTER_INT_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); /* For pg_fetch_array() */ - REGISTER_INT_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); /* For pg_connection_status() */ - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); #ifdef CONNECTION_SSL_STARTUP - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); /* For pg_connect_poll() */ - REGISTER_INT_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); #if HAVE_PGTRANSACTIONSTATUS /* For pg_transaction_status() */ - REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_PQSETERRORVERBOSITY /* For pg_set_error_verbosity() */ - REGISTER_INT_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); #endif /* For lo_seek() */ - REGISTER_INT_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value type */ - REGISTER_INT_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value */ - REGISTER_INT_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); #if HAVE_PQRESULTERRORFIELD /* For pg_result_error_field() field codes */ - REGISTER_INT_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); #ifdef PG_DIAG_INTERNAL_POSITION - REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); #endif #ifdef PG_DIAG_INTERNAL_QUERY - REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); #endif /* pg_convert options */ - REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); /* pg_insert/update/delete/select options */ - REGISTER_INT_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -1288,16 +1288,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections * can re-use this connection. Bug #39979 */ - if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_INT) { - if (Z_IVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { + if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_LONG) { + if (Z_LVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { continue; - } else if (Z_IVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { - smart_str_append_int(&str, Z_IVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); + } else if (Z_LVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { + smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); } } convert_to_string_ex(&args[i]); smart_str_appendc(&str, '_'); - smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); + smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i])); } smart_str_0(&str); @@ -1307,7 +1307,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */ connstring = Z_STRVAL(args[0]); convert_to_int_ex(&args[1]); - connect_type = Z_IVAL(args[1]); + connect_type = Z_LVAL(args[1]); } else { host = Z_STRVAL(args[0]); port = Z_STRVAL(args[1]); @@ -1535,7 +1535,7 @@ PHP_FUNCTION(pg_connect_poll) ret = PQconnectPoll(pgsql); - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1642,7 +1642,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type array_init(return_value); add_assoc_string(return_value, "client", PG_VERSION); #if HAVE_PQPROTOCOLVERSION - add_assoc_int(return_value, "protocol", PQprotocolVersion(pgsql)); + add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql)); #if HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3) { /* 8.0 or grater supports protorol version 3 */ @@ -1977,7 +1977,7 @@ PHP_FUNCTION(pg_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_ptr_dtor(&tmp_val); } i++; @@ -2178,7 +2178,7 @@ PHP_FUNCTION(pg_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -2252,17 +2252,17 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty switch (entry_type) { case PHP_PG_NUM_ROWS: - RETVAL_INT(PQntuples(pgsql_result)); + RETVAL_LONG(PQntuples(pgsql_result)); break; case PHP_PG_NUM_FIELDS: - RETVAL_INT(PQnfields(pgsql_result)); + RETVAL_LONG(PQnfields(pgsql_result)); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES - RETVAL_INT(atoi(PQcmdTuples(pgsql_result))); + RETVAL_LONG(atoi(PQcmdTuples(pgsql_result))); #else php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build"); - RETVAL_INT(0); + RETVAL_LONG(0); #endif break; default: @@ -2387,14 +2387,14 @@ PHP_FUNCTION(pg_field_table) { zval *result; pgsql_result_handle *pg_result; - php_int_t fnum = -1; + zend_long fnum = -1; zend_bool return_oid = 0; Oid oid; smart_str hash_key = {0}; char *table_name; zend_resource *field_table; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|b", &result, &fnum, &return_oid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b", &result, &fnum, &return_oid) == FAILURE) { return; } @@ -2420,7 +2420,7 @@ PHP_FUNCTION(pg_field_table) RETURN_STR(oidstr.s); } else #endif - RETURN_INT((php_int_t)oid); + RETURN_LONG((zend_long)oid); } /* try to lookup the table name in the resource list */ @@ -2480,12 +2480,12 @@ PHP_FUNCTION(pg_field_table) static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; - php_int_t field; + zend_long field; PGresult *pgsql_result; pgsql_result_handle *pg_result; Oid oid; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) { return; } @@ -2503,7 +2503,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ RETURN_STRING(PQfname(pgsql_result, field)); break; case PHP_PG_FIELD_SIZE: - RETURN_INT(PQfsize(pgsql_result, field)); + RETURN_LONG(PQfsize(pgsql_result, field)); break; case PHP_PG_FIELD_TYPE: { char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC); @@ -2523,7 +2523,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ } else #endif { - RETURN_INT((long)oid); + RETURN_LONG((long)oid); } break; default: @@ -2582,7 +2582,7 @@ PHP_FUNCTION(pg_field_num) pgsql_result = pg_result->result; - RETURN_INT(PQfnumber(pgsql_result, field)); + RETURN_LONG(PQfnumber(pgsql_result, field)); } /* }}} */ @@ -2591,7 +2591,7 @@ PHP_FUNCTION(pg_field_num) PHP_FUNCTION(pg_fetch_result) { zval *result, *field=NULL; - php_int_t row; + zend_long row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); @@ -2601,7 +2601,7 @@ PHP_FUNCTION(pg_fetch_result) return; } } else { - if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) { return; } } @@ -2621,7 +2621,7 @@ PHP_FUNCTION(pg_fetch_result) pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", - row, Z_IVAL_P(result)); + row, Z_LVAL_P(result)); RETURN_FALSE; } } @@ -2631,7 +2631,7 @@ PHP_FUNCTION(pg_fetch_result) break; default: convert_to_int_ex(field); - field_offset = Z_IVAL_P(field); + field_offset = Z_LVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2649,13 +2649,13 @@ PHP_FUNCTION(pg_fetch_result) /* }}} */ /* {{{ void php_pgsql_fetch_hash */ -static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int into_object) +static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int into_object) { zval *result, *zrow = NULL; PGresult *pgsql_result; pgsql_result_handle *pg_result; int i, num_fields, pgsql_row, use_row; - php_int_t row = -1; + zend_long row = -1; char *field_name; zval *ctor_params = NULL; zend_class_entry *ce = NULL; @@ -2677,7 +2677,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_ } result_type = PGSQL_ASSOC; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!i", &result, &zrow, &result_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!l", &result, &zrow, &result_type) == FAILURE) { return; } } @@ -2685,7 +2685,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_ row = -1; } else { convert_to_int(zrow); - row = Z_IVAL_P(zrow); + row = Z_LVAL_P(zrow); if (row < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The row parameter must be greater or equal to zero"); RETURN_FALSE; @@ -2707,7 +2707,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_ pg_result->row = pgsql_row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", - row, Z_IVAL_P(result)); + row, Z_LVAL_P(result)); RETURN_FALSE; } } else { @@ -2876,11 +2876,11 @@ PHP_FUNCTION(pg_fetch_all_columns) zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; - php_int_t colno=0; + zend_long colno=0; int pg_numrows, pg_row; size_t num_fields; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &colno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &colno) == FAILURE) { RETURN_FALSE; } @@ -2915,10 +2915,10 @@ PHP_FUNCTION(pg_fetch_all_columns) PHP_FUNCTION(pg_result_seek) { zval *result; - php_int_t row; + zend_long row; pgsql_result_handle *pg_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) { return; } @@ -2942,7 +2942,7 @@ PHP_FUNCTION(pg_result_seek) static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result, *field; - php_int_t row; + zend_long row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); @@ -2952,7 +2952,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) return; } } else { - if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) { return; } } @@ -2972,7 +2972,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", - row, Z_IVAL_P(result)); + row, Z_LVAL_P(result)); RETURN_FALSE; } } @@ -2984,7 +2984,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) break; default: convert_to_int_ex(field); - field_offset = Z_IVAL_P(field); + field_offset = Z_LVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2994,10 +2994,10 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_DATA_LENGTH: - RETVAL_INT(PQgetlength(pgsql_result, pgsql_row, field_offset)); + RETVAL_LONG(PQgetlength(pgsql_result, pgsql_row, field_offset)); break; case PHP_PG_DATA_ISNULL: - RETVAL_INT(PQgetisnull(pgsql_result, pgsql_row, field_offset)) + RETVAL_LONG(PQgetisnull(pgsql_result, pgsql_row, field_offset)) break; } } @@ -3179,19 +3179,19 @@ PHP_FUNCTION(pg_lo_create) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_INT: - if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) { + case IS_LONG: + if (Z_LVAL_P(oid) < (zend_long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_IVAL_P(oid); + wanted_oid = (Oid)Z_LVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3220,7 +3220,7 @@ PHP_FUNCTION(pg_lo_create) PHP_FUNCTION(pg_lo_unlink) { zval *pgsql_link = NULL; - php_int_t oid_long; + zend_long oid_long; char *oid_string, *end_ptr; int oid_strlen; PGconn *pgsql; @@ -3239,7 +3239,7 @@ PHP_FUNCTION(pg_lo_unlink) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "ri", &pgsql_link, &oid_long) == SUCCESS) { + "rl", &pgsql_link, &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3290,7 +3290,7 @@ PHP_FUNCTION(pg_lo_unlink) PHP_FUNCTION(pg_lo_open) { zval *pgsql_link = NULL; - php_int_t oid_long; + zend_long oid_long; char *oid_string, *end_ptr, *mode_string; int oid_strlen, mode_strlen; PGconn *pgsql; @@ -3311,7 +3311,7 @@ PHP_FUNCTION(pg_lo_open) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "ris", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) { + "rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3437,12 +3437,12 @@ PHP_FUNCTION(pg_lo_close) PHP_FUNCTION(pg_lo_read) { zval *pgsql_id; - php_int_t len; + zend_long len; int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes, argc = ZEND_NUM_ARGS(); zend_string *buf; pgLofp *pgsql; - if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &pgsql_id, &len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &pgsql_id, &len) == FAILURE) { return; } @@ -3452,9 +3452,9 @@ PHP_FUNCTION(pg_lo_read) buf_len = len; } - buf = STR_ALLOC(buf_len, 0); + buf = zend_string_alloc(buf_len, 0); if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf->val, buf->len))<0) { - STR_FREE(buf); + zend_string_free(buf); RETURN_FALSE; } @@ -3470,13 +3470,13 @@ PHP_FUNCTION(pg_lo_write) { zval *pgsql_id; char *str; - php_int_t z_len; + zend_long z_len; int str_len, nbytes; int len; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &pgsql_id, &str, &str_len, &z_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) { return; } @@ -3501,7 +3501,7 @@ PHP_FUNCTION(pg_lo_write) RETURN_FALSE; } - RETURN_INT(nbytes); + RETURN_LONG(nbytes); } /* }}} */ @@ -3526,7 +3526,7 @@ PHP_FUNCTION(pg_lo_read_all) PHPWRITE(buf, nbytes); tbytes += nbytes; } - RETURN_INT(tbytes); + RETURN_LONG(tbytes); } /* }}} */ @@ -3579,19 +3579,19 @@ PHP_FUNCTION(pg_lo_import) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_INT: - if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) { + case IS_LONG: + if (Z_LVAL_P(oid) < (zend_long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_IVAL_P(oid); + wanted_oid = (Oid)Z_LVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3625,14 +3625,14 @@ PHP_FUNCTION(pg_lo_export) char *file_out, *oid_string, *end_ptr; int oid_strlen; int id = -1, name_len; - php_int_t oid_long; + zend_long oid_long; Oid oid; PGconn *pgsql; int argc = ZEND_NUM_ARGS(); /* allow string to handle large OID value correctly */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "rip", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) { + "rlp", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3649,7 +3649,7 @@ PHP_FUNCTION(pg_lo_export) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "ip", &oid_long, &file_out, &name_len) == SUCCESS) { + "lp", &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3679,7 +3679,7 @@ PHP_FUNCTION(pg_lo_export) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "ipr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { + "lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used"); if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); @@ -3714,11 +3714,11 @@ PHP_FUNCTION(pg_lo_export) PHP_FUNCTION(pg_lo_seek) { zval *pgsql_id = NULL; - php_int_t result, offset = 0, whence = SEEK_CUR; + zend_long result, offset = 0, whence = SEEK_CUR; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &pgsql_id, &offset, &whence) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) { return; } if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) { @@ -3769,7 +3769,7 @@ PHP_FUNCTION(pg_lo_tell) #else offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd); #endif - RETURN_INT(offset); + RETURN_LONG(offset); } /* }}} */ @@ -3784,7 +3784,7 @@ PHP_FUNCTION(pg_lo_truncate) int argc = ZEND_NUM_ARGS(); int result; - if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_id, &size) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_id, &size) == FAILURE) { return; } @@ -3814,18 +3814,18 @@ PHP_FUNCTION(pg_lo_truncate) PHP_FUNCTION(pg_set_error_verbosity) { zval *pgsql_link = NULL; - php_int_t verbosity; + zend_long verbosity; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (argc == 1) { - if (zend_parse_parameters(argc TSRMLS_CC, "i", &verbosity) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) { return; } id = PGG(default_link)? PGG(default_link)->handle : -1; CHECK_DEFAULT_LINK(id); } else { - if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_link, &verbosity) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) { return; } } @@ -3837,7 +3837,7 @@ PHP_FUNCTION(pg_set_error_verbosity) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) { - RETURN_INT(PQsetErrorVerbosity(pgsql, verbosity)); + RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity)); } else { RETURN_FALSE; } @@ -3874,7 +3874,7 @@ PHP_FUNCTION(pg_set_client_encoding) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_INT(PQsetClientEncoding(pgsql, encoding)); + RETURN_LONG(PQsetClientEncoding(pgsql, encoding)); } /* }}} */ @@ -4175,10 +4175,10 @@ PHP_FUNCTION(pg_copy_from) #if HAVE_PQPUTCOPYDATA ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); - if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); + query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); + if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); @@ -4194,10 +4194,10 @@ PHP_FUNCTION(pg_copy_from) #else ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); - if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); + query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); + if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); @@ -4268,7 +4268,7 @@ PHP_FUNCTION(pg_escape_string) break; } - to = STR_ALLOC(from->len * 2, 0); + to = zend_string_alloc(from->len * 2, 0); #ifdef HAVE_PQESCAPE_CONN if (pgsql_link != NULL || id != -1) { ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); @@ -4279,7 +4279,7 @@ PHP_FUNCTION(pg_escape_string) to->len = (int) PQescapeString(to->val, from->val, (size_t)from->len); } - to = STR_REALLOC(to, to->len, 0); + to = zend_string_realloc(to, to->len, 0); RETURN_STR(to); } /* }}} */ @@ -4559,12 +4559,12 @@ PHP_FUNCTION(pg_result_error) PHP_FUNCTION(pg_result_error_field) { zval *result; - php_int_t fieldcode; + zend_long fieldcode; PGresult *pgsql_result; pgsql_result_handle *pg_result; char *field = NULL; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ri", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &fieldcode) == FAILURE) { RETURN_FALSE; } @@ -4613,7 +4613,7 @@ PHP_FUNCTION(pg_connection_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_INT(PQstatus(pgsql)); + RETURN_LONG(PQstatus(pgsql)); } /* }}} */ @@ -4634,7 +4634,7 @@ PHP_FUNCTION(pg_transaction_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_INT(PQtransactionStatus(pgsql)); + RETURN_LONG(PQtransactionStatus(pgsql)); } #endif @@ -4709,10 +4709,10 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch(entry_type) { case PHP_PG_ASYNC_IS_BUSY: PQconsumeInput(pgsql); - RETVAL_INT(PQisBusy(pgsql)); + RETVAL_LONG(PQisBusy(pgsql)); break; case PHP_PG_ASYNC_REQUEST_CANCEL: - RETVAL_INT(PQrequestCancel(pgsql)); + RETVAL_LONG(PQrequestCancel(pgsql)); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } @@ -4819,7 +4819,7 @@ PHP_FUNCTION(pg_send_query) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_INT(0); + RETURN_LONG(0); } } /* }}} */ @@ -4879,7 +4879,7 @@ PHP_FUNCTION(pg_send_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -4924,7 +4924,7 @@ PHP_FUNCTION(pg_send_query_params) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_INT(0); + RETURN_LONG(0); } } /* }}} */ @@ -4998,7 +4998,7 @@ PHP_FUNCTION(pg_send_prepare) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_INT(0); + RETURN_LONG(0); } } /* }}} */ @@ -5060,7 +5060,7 @@ PHP_FUNCTION(pg_send_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -5104,7 +5104,7 @@ PHP_FUNCTION(pg_send_execute) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_INT(0); + RETURN_LONG(0); } } /* }}} */ @@ -5144,12 +5144,12 @@ PHP_FUNCTION(pg_get_result) PHP_FUNCTION(pg_result_status) { zval *result; - php_int_t result_type = PGSQL_STATUS_LONG; + zend_long result_type = PGSQL_STATUS_LONG; ExecStatusType status; PGresult *pgsql_result; pgsql_result_handle *pg_result; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &result_type) == FAILURE) { RETURN_FALSE; } @@ -5159,7 +5159,7 @@ PHP_FUNCTION(pg_result_status) pgsql_result = pg_result->result; if (result_type == PGSQL_STATUS_LONG) { status = PQresultStatus(pgsql_result); - RETURN_INT((int)status); + RETURN_LONG((int)status); } else if (result_type == PGSQL_STATUS_STRING) { RETURN_STRING(PQcmdStatus(pgsql_result)); @@ -5177,11 +5177,11 @@ PHP_FUNCTION(pg_get_notify) { zval *pgsql_link; int id = -1; - php_int_t result_type = PGSQL_ASSOC; + zend_long result_type = PGSQL_ASSOC; PGconn *pgsql; PGnotify *pgsql_notify; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pgsql_link, &result_type) == FAILURE) { RETURN_FALSE; } @@ -5202,7 +5202,7 @@ PHP_FUNCTION(pg_get_notify) array_init(return_value); if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_int(return_value, 1, pgsql_notify->be_pid); + add_index_long(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5215,7 +5215,7 @@ PHP_FUNCTION(pg_get_notify) } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_int(return_value, "pid", pgsql_notify->be_pid); + add_assoc_long(return_value, "pid", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5245,7 +5245,7 @@ PHP_FUNCTION(pg_get_pid) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_INT(PQbackendPID(pgsql)); + RETURN_LONG(PQbackendPID(pgsql)); } /* }}} */ @@ -5384,7 +5384,7 @@ PHP_FUNCTION(pg_flush) switch (ret) { case 0: RETURN_TRUE; break; - case 1: RETURN_INT(0); break; + case 1: RETURN_LONG(0); break; default: RETURN_FALSE; } } @@ -5468,17 +5468,17 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z char *name; array_init(&elem); /* pg_attribute.attnum */ - add_assoc_int(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); + add_assoc_long(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); /* pg_type.typname */ add_assoc_string(&elem, "type", PQgetvalue(pg_result,i,2)); /* pg_attribute.attlen */ - add_assoc_int(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); + add_assoc_long(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); /* pg_attribute.attnonull */ add_assoc_bool(&elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t")); /* pg_attribute.atthasdef */ add_assoc_bool(&elem, "has default", !strcmp(PQgetvalue(pg_result,i,5), "t")); /* pg_attribute.attndims */ - add_assoc_int(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); + add_assoc_long(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); /* pg_type.typtype */ add_assoc_bool(&elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e")); if (extended) { @@ -5678,7 +5678,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) smart_str_appendc(&str, 'E'); smart_str_appendc(&str, '\''); - smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRSIZE_P(src)); + smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src)); smart_str_appendc(&str, '\''); smart_str_0(&str); @@ -5708,10 +5708,10 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) /* {{{ php_pgsql_convert * check and convert array values (fieldname=>vlaue pair) for sql */ -PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, php_uint_t opt TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt TSRMLS_DC) { zend_string *field = NULL; - php_uint_t num_idx = -1; + zend_ulong num_idx = -1; zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val; int err = 0, skip_field; php_pgsql_data_type data_type; @@ -5774,7 +5774,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* enums need to be treated like strings */ data_type = PG_TEXT; } else { - data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRSIZE_P(type)); + data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRLEN_P(type)); } switch(data_type) @@ -5782,7 +5782,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BOOL: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -5807,8 +5807,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_INT: - if (Z_IVAL_P(val)) { + case IS_LONG: + if (Z_LVAL_P(val)) { ZVAL_STRINGL(&new_val, "'t'", sizeof("'t'")-1); } else { @@ -5843,16 +5843,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); } } break; @@ -5862,8 +5862,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con convert_to_int_ex(&new_val); break; - case IS_INT: - ZVAL_INT(&new_val, Z_IVAL_P(val)); + case IS_LONG: + ZVAL_LONG(&new_val, Z_LVAL_P(val)); break; case IS_NULL: @@ -5885,12 +5885,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_FLOAT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { @@ -5899,8 +5899,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_INT: - ZVAL_INT(&new_val, Z_IVAL_P(val)); + case IS_LONG: + ZVAL_LONG(&new_val, Z_LVAL_P(val)); break; case IS_DOUBLE: @@ -5941,7 +5941,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_UNKNOWN: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { if (opt & PGSQL_CONV_FORCE_NULL) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { @@ -5951,17 +5951,17 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con else { zend_string *str; /* PostgreSQL ignores \0 */ - str = STR_ALLOC(Z_STRSIZE_P(val) * 2, 0); + str = zend_string_alloc(Z_STRLEN_P(val) * 2, 0); /* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */ - str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); - str = STR_REALLOC(str, str->len, 0); + str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + str = zend_string_realloc(str, str->len, 0); ZVAL_STR(&new_val, str); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } break; - case IS_INT: - ZVAL_INT(&new_val, Z_IVAL_P(val)); + case IS_LONG: + ZVAL_LONG(&new_val, Z_LVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -5988,16 +5988,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* these are the actallay a integer */ switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); convert_to_int_ex(&new_val); } } @@ -6008,8 +6008,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con convert_to_int_ex(&new_val); break; - case IS_INT: - ZVAL_INT(&new_val, Z_IVAL_P(val)); + case IS_LONG: + ZVAL_LONG(&new_val, Z_LVAL_P(val)); break; case IS_NULL: @@ -6029,16 +6029,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INET: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? IPV6 and IPV4 */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6062,13 +6062,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIMESTAMP_WITH_TIMEZONE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else if (!strcasecmp(Z_STRVAL_P(val), "now()")) { ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(&new_val, Z_STRVAL_P(val)); @@ -6093,16 +6093,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_DATE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6124,16 +6124,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIME: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6155,7 +6155,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INTERVAL: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6176,7 +6176,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10 sec'. */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(@?[ \\t]+)?(" /* Textual time units and their abbreviations: */ @@ -6234,7 +6234,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BYTEA: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6242,22 +6242,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con size_t to_len; smart_str s = {0}; #ifdef HAVE_PQESCAPE_BYTEA_CONN - tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRSIZE_P(val), &to_len); + tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRLEN_P(val), &to_len); #else - tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRSIZE_P(val), &to_len); + tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRLEN_P(val), &to_len); #endif ZVAL_STRINGL(&new_val, (char *)tmp, to_len - 1); /* PQescapeBytea's to_len includes additional '\0' */ PQfreemem(tmp); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); - smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRSIZE(new_val)); + smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val)); smart_str_0(&s); zval_ptr_dtor(&new_val); ZVAL_STR(&new_val, s.s); } break; - case IS_INT: - ZVAL_INT(&new_val, Z_IVAL_P(val)); + case IS_LONG: + ZVAL_LONG(&new_val, Z_LVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -6283,15 +6283,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_MACADDR: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRSIZE_P(val) == 0) { + if (Z_STRLEN_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6352,12 +6352,12 @@ PHP_FUNCTION(pg_convert) zval *pgsql_link, *values; char *table_name; int table_name_len; - php_uint_t option = 0; + zend_ulong option = 0; PGconn *pg_link; int id = -1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsa|i", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) { + "rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) { return; } if (option & ~PGSQL_CONV_OPTS) { @@ -6382,7 +6382,7 @@ PHP_FUNCTION(pg_convert) } /* }}} */ -static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, php_uint_t opt TSRMLS_DC) /* {{{ */ +static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt TSRMLS_DC) /* {{{ */ { if (opt & PGSQL_DML_ASYNC) { if (PQsendQuery(pg_link, querystr->s->val)) { @@ -6441,14 +6441,14 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c /* {{{ php_pgsql_insert */ -PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, php_uint_t opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql TSRMLS_DC) { zval *val, converted; char buf[256]; char *tmp; smart_str querystr = {0}; int ret = FAILURE; - php_uint_t num_idx; + zend_ulong num_idx; zend_string *fld; assert(pg_link != NULL); @@ -6502,18 +6502,18 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var if (opt & PGSQL_DML_ESCAPE) { size_t new_len; char *tmp; - tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); smart_str_appendc(&querystr, '\''); smart_str_appendl(&querystr, tmp, new_len); smart_str_appendc(&querystr, '\''); efree(tmp); } else { - smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); } break; - case IS_INT: - smart_str_append_int(&querystr, Z_IVAL_P(val)); + case IS_LONG: + smart_str_append_long(&querystr, Z_LVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val))); @@ -6563,7 +6563,7 @@ PHP_FUNCTION(pg_insert) zval *pgsql_link, *values; char *table; int table_len; - php_uint_t option = PGSQL_DML_EXEC, return_sql; + zend_ulong option = PGSQL_DML_EXEC, return_sql; PGconn *pg_link; PGresult *pg_result; ExecStatusType status; @@ -6571,7 +6571,7 @@ PHP_FUNCTION(pg_insert) zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", &pgsql_link, &table, &table_len, &values, &option) == FAILURE) { return; } @@ -6641,11 +6641,11 @@ PHP_FUNCTION(pg_insert) } /* }}} */ -static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, php_uint_t opt TSRMLS_DC) /* {{{ */ +static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, zend_ulong opt TSRMLS_DC) /* {{{ */ { char *tmp; char buf[256]; - php_uint_t num_idx; + zend_ulong num_idx; zend_string *fld; zval *val; @@ -6671,18 +6671,18 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, case IS_STRING: if (opt & PGSQL_DML_ESCAPE) { size_t new_len; - tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); smart_str_appendc(querystr, '\''); smart_str_appendl(querystr, tmp, new_len); smart_str_appendc(querystr, '\''); efree(tmp); } else { - smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); } break; - case IS_INT: - smart_str_append_int(querystr, Z_IVAL_P(val)); + case IS_LONG: + smart_str_append_long(querystr, Z_LVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf)-1)); @@ -6706,7 +6706,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, /* {{{ php_pgsql_update */ -PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC) { zval var_converted, ids_converted; smart_str querystr = {0}; @@ -6779,12 +6779,12 @@ PHP_FUNCTION(pg_update) zval *pgsql_link, *values, *ids; char *table; int table_len; - php_uint_t option = PGSQL_DML_EXEC; + zend_ulong option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|i", + if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|l", &pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) { return; } @@ -6810,7 +6810,7 @@ PHP_FUNCTION(pg_update) /* {{{ php_pgsql_delete */ -PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC) { zval ids_converted; smart_str querystr = {0}; @@ -6869,12 +6869,12 @@ PHP_FUNCTION(pg_delete) zval *pgsql_link, *ids; char *table; int table_len; - php_uint_t option = PGSQL_DML_EXEC; + zend_ulong option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) { return; } @@ -6936,7 +6936,7 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS /* {{{ php_pgsql_select */ -PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql TSRMLS_DC) { zval ids_converted; smart_str querystr = {0}; @@ -6999,12 +6999,12 @@ PHP_FUNCTION(pg_select) zval *pgsql_link, *ids; char *table; int table_len; - php_uint_t option = PGSQL_DML_EXEC; + zend_ulong option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) { return; } diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index d090a08797..9bfbf142f9 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -211,11 +211,11 @@ PHP_FUNCTION(pg_select); /* exported functions */ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_bool extended TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, php_uint_t opt TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, php_uint_t opt, zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, php_uint_t opt , zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, php_uint_t opt, zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, zend_ulong opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, zend_ulong opt , zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, zend_ulong opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, zend_ulong opt, zend_string **sql TSRMLS_DC); PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC); /* internal functions */ @@ -309,10 +309,10 @@ static php_stream_ops php_stream_pgsql_fd_ops = { }; ZEND_BEGIN_MODULE_GLOBALS(pgsql) - php_int_t num_links,num_persistent; - php_int_t max_links,max_persistent; - php_int_t allow_persistent; - php_int_t auto_reset_persistent; + zend_long num_links,num_persistent; + zend_long max_links,max_persistent; + zend_long allow_persistent; + zend_long auto_reset_persistent; int le_lofp,le_string; int ignore_notices,log_notices; HashTable notices; /* notice message for each connection */ diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index 53e6175ecb..238698022f 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -95,7 +95,7 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D size_t to_read; HashTable *data = (HashTable *)stream->abstract; zend_string *str_key; - php_uint_t unused; + zend_ulong unused; if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &str_key, &unused, 0, &data->nInternalPointer)) { return 0; @@ -184,7 +184,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) char *entry, *found, *save; zend_string *str_key; uint keylen; - php_uint_t unused; + zend_ulong unused; ALLOC_HASHTABLE(data); zend_hash_init(data, 64, NULL, NULL, 0); @@ -306,7 +306,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, php_stream *ret; char *internal_file, *error; zend_string *str_key; - php_uint_t unused; + zend_ulong unused; phar_archive_data *phar; phar_entry_info *entry = NULL; uint host_len; @@ -550,7 +550,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options php_url *resource = NULL; uint host_len; zend_string *str_key; - php_uint_t unused; + zend_ulong unused; uint path_len; /* pre-readonly check, we need to know if this is a data phar */ diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index b548516fc7..99bc98bc5b 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -98,8 +98,8 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */ zend_string *contents; zend_bool use_include_path = 0; php_stream *stream; - php_int_t offset = -1; - php_int_t maxlen = PHP_STREAM_COPY_ALL; + zend_long offset = -1; + zend_long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; if (!PHAR_G(intercepted)) { @@ -112,7 +112,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */ } /* Parse arguments */ - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { goto skip_phar; } @@ -205,7 +205,7 @@ phar_it: if (contents && contents->len > 0) { RETVAL_STR(contents); } else if (contents) { - STR_RELEASE(contents); + zend_string_release(contents); RETVAL_EMPTY_STRING(); } else { RETVAL_FALSE; @@ -307,7 +307,7 @@ notfound: } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_INT(size); + RETURN_LONG(size); } skip_phar: @@ -477,32 +477,32 @@ static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TS switch (type) { case FS_PERMS: - RETURN_INT((php_int_t)stat_sb->st_mode); + RETURN_LONG((zend_long)stat_sb->st_mode); case FS_INODE: - RETURN_INT((php_int_t)stat_sb->st_ino); + RETURN_LONG((zend_long)stat_sb->st_ino); case FS_SIZE: - RETURN_INT((php_int_t)stat_sb->st_size); + RETURN_LONG((zend_long)stat_sb->st_size); case FS_OWNER: - RETURN_INT((php_int_t)stat_sb->st_uid); + RETURN_LONG((zend_long)stat_sb->st_uid); case FS_GROUP: - RETURN_INT((php_int_t)stat_sb->st_gid); + RETURN_LONG((zend_long)stat_sb->st_gid); case FS_ATIME: #ifdef NETWARE - RETURN_INT((php_int_t)stat_sb->st_atime.tv_sec); + RETURN_LONG((zend_long)stat_sb->st_atime.tv_sec); #else - RETURN_INT((php_int_t)stat_sb->st_atime); + RETURN_LONG((zend_long)stat_sb->st_atime); #endif case FS_MTIME: #ifdef NETWARE - RETURN_INT((php_int_t)stat_sb->st_mtime.tv_sec); + RETURN_LONG((zend_long)stat_sb->st_mtime.tv_sec); #else - RETURN_INT((php_int_t)stat_sb->st_mtime); + RETURN_LONG((zend_long)stat_sb->st_mtime); #endif case FS_CTIME: #ifdef NETWARE - RETURN_INT((php_int_t)stat_sb->st_ctime.tv_sec); + RETURN_LONG((zend_long)stat_sb->st_ctime.tv_sec); #else - RETURN_INT((php_int_t)stat_sb->st_ctime); + RETURN_LONG((zend_long)stat_sb->st_ctime); #endif case FS_TYPE: if (S_ISLNK(stat_sb->st_mode)) { @@ -533,36 +533,36 @@ static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TS case FS_STAT: array_init(return_value); - ZVAL_INT(&stat_dev, stat_sb->st_dev); - ZVAL_INT(&stat_ino, stat_sb->st_ino); - ZVAL_INT(&stat_mode, stat_sb->st_mode); - ZVAL_INT(&stat_nlink, stat_sb->st_nlink); - ZVAL_INT(&stat_uid, stat_sb->st_uid); - ZVAL_INT(&stat_gid, stat_sb->st_gid); + ZVAL_LONG(&stat_dev, stat_sb->st_dev); + ZVAL_LONG(&stat_ino, stat_sb->st_ino); + ZVAL_LONG(&stat_mode, stat_sb->st_mode); + ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); + ZVAL_LONG(&stat_uid, stat_sb->st_uid); + ZVAL_LONG(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_INT(&stat_rdev, stat_sb->st_rdev); + ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_INT(&stat_rdev, -1); + ZVAL_LONG(&stat_rdev, -1); #endif - ZVAL_INT(&stat_size, stat_sb->st_size); + ZVAL_LONG(&stat_size, stat_sb->st_size); #ifdef NETWARE - ZVAL_INT(&stat_atime, (stat_sb->st_atime).tv_sec); - ZVAL_INT(&stat_mtime, (stat_sb->st_mtime).tv_sec); - ZVAL_INT(&stat_ctime, (stat_sb->st_ctime).tv_sec); + ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec); + ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec); + ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec); #else - ZVAL_INT(&stat_atime, stat_sb->st_atime); - ZVAL_INT(&stat_mtime, stat_sb->st_mtime); - ZVAL_INT(&stat_ctime, stat_sb->st_ctime); + ZVAL_LONG(&stat_atime, stat_sb->st_atime); + ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); + ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); #endif #ifdef HAVE_ST_BLKSIZE - ZVAL_INT(&stat_blksize, stat_sb->st_blksize); + ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_INT(&stat_blksize,-1); + ZVAL_LONG(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_INT(&stat_blocks, stat_sb->st_blocks); + ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_INT(&stat_blocks,-1); + ZVAL_LONG(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); diff --git a/ext/phar/phar.c b/ext/phar/phar.c index c0df89fc5c..1e184b8362 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -662,14 +662,14 @@ int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRM * This is used by phar_open_from_filename to process the manifest, but can be called * directly. */ -static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, php_int_t halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ +static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ { char b32[4], *buffer, *endbuffer, *savebuf; phar_archive_data *mydata = NULL; phar_entry_info entry; php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags; php_uint16 manifest_ver; - php_int_t offset; + zend_long offset; int sig_len, register_alias = 0, temp_alias = 0; char *signature = NULL; @@ -1575,9 +1575,9 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a char *pos, test = '\0'; const int window_size = 1024; char buffer[1024 + sizeof(token)]; /* a 1024 byte window + the size of the halt_compiler token (moving window) */ - const php_int_t readsize = sizeof(buffer) - sizeof(token); - const php_int_t tokenlen = sizeof(token) - 1; - php_int_t halt_offset; + const zend_long readsize = sizeof(buffer) - sizeof(token); + const zend_long tokenlen = sizeof(token) - 1; + zend_long halt_offset; size_t got; php_uint32 compression = PHAR_FILE_COMPRESSED_NONE; @@ -1618,7 +1618,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_int(&filterparams, "window", MAX_WBITS + 32); + add_assoc_long(&filterparams, "window", MAX_WBITS + 32); /* entire file is gzip-compressed, uncompress to temporary file */ if (!(temp = php_stream_fopen_tmpfile())) { @@ -1630,7 +1630,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a if (!filter) { err = 1; - add_assoc_int(&filterparams, "window", MAX_WBITS); + add_assoc_long(&filterparams, "window", MAX_WBITS); filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC); zval_dtor(&filterparams); @@ -1960,7 +1960,7 @@ woohoo: } } else { zend_string *str_key; - php_uint_t unused; + zend_ulong unused; for (zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map)); HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &str_key, &unused, 0, &PHAR_GLOBALS->phar_fname_map.nInternalPointer); @@ -2534,7 +2534,7 @@ char *phar_create_default_stub(const char *index_php, const char *web_index, siz * user_stub contains either a string, or a resource pointer, if len is a negative length. * user_stub and len should be both 0 if the default or existing stub should be used */ -int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC) /* {{{ */ +int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC) /* {{{ */ { char halt_stub[] = "__HALT_COMPILER();"; char *newstub, *tmp; @@ -2543,7 +2543,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv char *pos, has_dirs = 0; char manifest[18], entry_buffer[24]; php_off_t manifest_ftell; - php_int_t offset; + zend_long offset; size_t wrote; php_uint32 manifest_len, mytime, loc, new_manifest_count; php_uint32 newcrc32; @@ -2650,7 +2650,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname); } if (free_user_stub) { - STR_FREE(suser_stub); + zend_string_free(suser_stub); } return EOF; } @@ -2667,13 +2667,13 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname); } if (free_user_stub) { - STR_FREE(suser_stub); + zend_string_free(suser_stub); } return EOF; } phar->halt_offset = len + 5; if (free_user_stub) { - STR_FREE(suser_stub); + zend_string_free(suser_stub); } } else { size_t written; @@ -3230,7 +3230,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int conv zval filterparams; array_init(&filterparams); - add_assoc_int(&filterparams, "window", MAX_WBITS+16); + add_assoc_long(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index ff750d07cd..1bfd827fc0 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -249,11 +249,11 @@ typedef struct _phar_entry_info { char *filename; enum phar_fp_type fp_type; /* offset within original phar file of the file contents */ - php_int_t offset_abs; + zend_long offset_abs; /* offset within fp of the file contents */ - php_int_t offset; + zend_long offset; /* offset within original phar file of the file header (for zip-based/tar-based) */ - php_int_t header_offset; + zend_long header_offset; php_stream *fp; php_stream *cfp; int fp_refcount; @@ -334,7 +334,7 @@ struct _phar_archive_data { typedef struct _phar_entry_fp_info { enum phar_fp_type fp_type; /* offset within fp of the file contents */ - php_int_t offset; + zend_long offset; } phar_entry_fp_info; struct _phar_entry_fp { @@ -578,12 +578,12 @@ int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC); int phar_is_tar(char *buf, char *fname); int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC); int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); -int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC); +int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC); /* zip functions in zip.c */ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC); int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); -int phar_zip_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC); +int phar_zip_flush(phar_archive_data *archive, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC); #ifdef PHAR_MAIN static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error TSRMLS_DC); @@ -600,7 +600,7 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int pa phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC); phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); -int phar_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC); +int phar_flush(phar_archive_data *archive, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC); int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC); int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 9319645fac..1f88cae7e0 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -75,7 +75,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char /* PATH_INFO and PATH_TRANSLATED should always be munged */ if (NULL != (stuff = zend_hash_str_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRSIZE_P(stuff); + code = Z_STRLEN_P(stuff); if (code > entry_len && !memcmp(path_info, entry, entry_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len); @@ -99,7 +99,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRSIZE_P(stuff); + code = Z_STRLEN_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len); @@ -111,7 +111,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRSIZE_P(stuff); + code = Z_STRLEN_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); @@ -601,11 +601,11 @@ PHP_METHOD(Phar, webPhar) if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) && IS_STRING == Z_TYPE_P(z_path_info)) { - entry_len = Z_STRSIZE_P(z_path_info); + entry_len = Z_STRLEN_P(z_path_info); entry = estrndup(Z_STRVAL_P(z_path_info), entry_len); - path_info = emalloc(Z_STRSIZE_P(z_script_name) + entry_len + 1); - memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); - memcpy(path_info + Z_STRSIZE_P(z_script_name), entry, entry_len + 1); + path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1); + memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); + memcpy(path_info + Z_STRLEN_P(z_script_name), entry, entry_len + 1); free_pathinfo = 1; } else { entry_len = 0; @@ -613,7 +613,7 @@ PHP_METHOD(Phar, webPhar) path_info = Z_STRVAL_P(z_script_name); } - pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); + pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); } else { char *testit; @@ -702,8 +702,8 @@ PHP_METHOD(Phar, webPhar) switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); - entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRSIZE_P(fci.retval)); - entry_len = Z_STRSIZE_P(fci.retval); + entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); + entry_len = Z_STRLEN_P(fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -809,10 +809,10 @@ PHP_METHOD(Phar, webPhar) if (NULL != (val = zend_hash_str_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)))) { switch (Z_TYPE_P(val)) { - case IS_INT: - if (Z_IVAL_P(val) == PHAR_MIME_PHP || Z_IVAL_P(val) == PHAR_MIME_PHPS) { + case IS_LONG: + if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) { mime_type = ""; - code = Z_IVAL_P(val); + code = Z_LVAL_P(val); } else { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed"); #ifdef PHP_WIN32 @@ -876,11 +876,11 @@ PHP_METHOD(Phar, mungServer) return; } - if (Z_STRSIZE_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { + if (Z_STRLEN_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_PHP_SELF; } - if (Z_STRSIZE_P(data) == sizeof("REQUEST_URI")-1) { + if (Z_STRLEN_P(data) == sizeof("REQUEST_URI")-1) { if (!strncmp(Z_STRVAL_P(data), "REQUEST_URI", sizeof("REQUEST_URI")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_REQUEST_URI; } @@ -889,7 +889,7 @@ PHP_METHOD(Phar, mungServer) } } - if (Z_STRSIZE_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { + if (Z_STRLEN_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME; } } ZEND_HASH_FOREACH_END(); @@ -947,9 +947,9 @@ PHP_METHOD(Phar, mapPhar) { char *alias = NULL, *error; int alias_len = 0; - php_int_t dataoffset = 0; + zend_long dataoffset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!i", &alias, &alias_len, &dataoffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) { return; } @@ -999,9 +999,9 @@ PHP_METHOD(Phar, apiVersion) * Returns whether phar extension supports compression using zlib/bzip2 */ PHP_METHOD(Phar, canCompress) { - php_int_t method = 0; + zend_long method = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) { return; } @@ -1109,8 +1109,8 @@ PHP_METHOD(Phar, __construct) #else char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname; int fname_len, alias_len = 0, arch_len, entry_len, is_data; - php_int_t flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; - php_int_t format = 0; + zend_long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; + zend_long format = 0; phar_archive_object *phar_obj; phar_archive_data *phar_data; zval *zobj = getThis(), arg1, arg2; @@ -1120,11 +1120,11 @@ PHP_METHOD(Phar, __construct) is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC); if (is_data) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!i", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) { return; } } @@ -1214,7 +1214,7 @@ PHP_METHOD(Phar, __construct) } ZVAL_STRINGL(&arg1, fname, fname_len); - ZVAL_INT(&arg2, flags); + ZVAL_LONG(&arg2, flags); zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj), &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2); @@ -1435,7 +1435,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRSIZE(key); + str_key_len = Z_STRLEN(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1504,7 +1504,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ } fname = Z_STRVAL_P(value); - fname_len = Z_STRSIZE_P(value); + fname_len = Z_STRLEN_P(value); phar_spl_fileinfo: if (base_len) { @@ -1563,7 +1563,7 @@ phar_spl_fileinfo: return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRSIZE(key); + str_key_len = Z_STRLEN(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1737,7 +1737,7 @@ PHP_METHOD(Phar, buildFromDirectory) } ZVAL_STRINGL(&arg, dir, dir_len); - ZVAL_INT(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); + ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); @@ -1900,14 +1900,14 @@ PHP_METHOD(Phar, buildFromIterator) PHP_METHOD(Phar, count) { /* mode can be ignored, maximum depth is 1 */ - php_int_t mode; + zend_long mode; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { RETURN_FALSE; } - RETURN_INT(zend_hash_num_elements(&phar_obj->archive->manifest)); + RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest)); } /* }}} */ @@ -1917,10 +1917,10 @@ PHP_METHOD(Phar, count) */ PHP_METHOD(Phar, isFileFormat) { - php_int_t type; + zend_long type; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { RETURN_FALSE; } @@ -2300,10 +2300,10 @@ PHP_METHOD(Phar, convertToExecutable) php_uint32 flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */ - php_int_t format = 9021976, method = 9021976; + zend_long format = 9021976, method = 9021976; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) { return; } @@ -2403,10 +2403,10 @@ PHP_METHOD(Phar, convertToData) php_uint32 flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday so there) */ - php_int_t format = 9021976, method = 9021976; + zend_long format = 9021976, method = 9021976; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) { return; } @@ -2506,11 +2506,11 @@ PHP_METHOD(Phar, isCompressed) } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) { - RETURN_INT(PHAR_ENT_COMPRESSED_GZ); + RETURN_LONG(PHAR_ENT_COMPRESSED_GZ); } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) { - RETURN_INT(PHAR_ENT_COMPRESSED_BZ2); + RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2); } RETURN_FALSE; @@ -2812,7 +2812,7 @@ PHP_METHOD(Phar, setStub) zval *zstub; char *stub, *error; int stub_len; - php_int_t len = -1; + zend_long len = -1; php_stream *stream; PHAR_ARCHIVE_OBJECT(); @@ -2833,7 +2833,7 @@ PHP_METHOD(Phar, setStub) return; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zstub, &len) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zstub, &len) == SUCCESS) { if ((php_stream_from_zval_no_verify(stream, zstub)) != NULL) { if (len > 0) { len = -len; @@ -2962,7 +2962,7 @@ PHP_METHOD(Phar, setDefaultStub) */ PHP_METHOD(Phar, setSignatureAlgorithm) { - php_int_t algo; + zend_long algo; char *error, *key = NULL; int key_len = 0; @@ -2974,7 +2974,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm) return; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &algo, &key, &key_len) != SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &algo, &key, &key_len) != SUCCESS) { return; } @@ -3133,14 +3133,14 @@ static int pharobj_cancompress(HashTable *manifest TSRMLS_DC) /* {{{ */ */ PHP_METHOD(Phar, compress) { - php_int_t method; + zend_long method; char *ext = NULL; int ext_len = 0; php_uint32 flags; zend_object *ret; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &method, &ext, &ext_len) == FAILURE) { return; } @@ -3246,10 +3246,10 @@ PHP_METHOD(Phar, compressFiles) { char *error; php_uint32 flags; - php_int_t method; + zend_long method; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { return; } @@ -3889,7 +3889,7 @@ PHP_METHOD(Phar, getStub) php_stream_rewind(fp); carry_on: - buf = STR_ALLOC(len, 0); + buf = zend_string_alloc(len, 0); if (len != php_stream_read(fp, buf->val, len)) { if (fp != phar_obj->archive->fp) { @@ -3897,7 +3897,7 @@ carry_on: } zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Unable to read stub"); - STR_RELEASE(buf); + zend_string_release(buf); return; } @@ -4242,7 +4242,7 @@ PHP_METHOD(Phar, extractTo) goto all_files; case IS_STRING: filename = Z_STRVAL_P(zval_files); - filename_len = Z_STRSIZE_P(zval_files); + filename_len = Z_STRLEN_P(zval_files); break; case IS_ARRAY: nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); @@ -4419,7 +4419,7 @@ PHP_METHOD(PharFileInfo, getCompressedSize) return; } - RETURN_INT(entry_obj->entry->compressed_filesize); + RETURN_LONG(entry_obj->entry->compressed_filesize); } /* }}} */ @@ -4429,10 +4429,10 @@ PHP_METHOD(PharFileInfo, getCompressedSize) PHP_METHOD(PharFileInfo, isCompressed) { /* a number that is not Phar::GZ or Phar::BZ2 */ - php_int_t method = 9021976; + zend_long method = 9021976; PHAR_ENTRY_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) { return; } @@ -4468,7 +4468,7 @@ PHP_METHOD(PharFileInfo, getCRC32) } if (entry_obj->entry->is_crc_checked) { - RETURN_INT(entry_obj->entry->crc32); + RETURN_LONG(entry_obj->entry->crc32); } else { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ "Phar entry was not CRC checked"); \ @@ -4502,7 +4502,7 @@ PHP_METHOD(PharFileInfo, getPharFlags) return; } - RETURN_INT(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); + RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); } /* }}} */ @@ -4512,7 +4512,7 @@ PHP_METHOD(PharFileInfo, getPharFlags) PHP_METHOD(PharFileInfo, chmod) { char *error; - php_int_t perms; + zend_long perms; PHAR_ENTRY_OBJECT(); if (entry_obj->entry->is_temp_dir) { @@ -4526,7 +4526,7 @@ PHP_METHOD(PharFileInfo, chmod) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perms) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perms) == FAILURE) { return; } @@ -4774,11 +4774,11 @@ PHP_METHOD(PharFileInfo, getContent) */ PHP_METHOD(PharFileInfo, compress) { - php_int_t method; + zend_long method; char *error; PHAR_ENTRY_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { return; } @@ -5266,8 +5266,8 @@ zend_function_entry phar_exception_methods[] = { }; /* }}} */ -#define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \ - zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); +#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \ + zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); #define phar_exception_get_default() zend_exception_get_default(TSRMLS_C) @@ -5301,20 +5301,20 @@ void phar_object_init(TSRMLS_D) /* {{{ */ phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS; #endif - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHP", PHAR_MIME_PHP) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "MD5", PHAR_SIG_MD5) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) - REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHP", PHAR_MIME_PHP) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "MD5", PHAR_SIG_MD5) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) + REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) } /* }}} */ diff --git a/ext/phar/stream.c b/ext/phar/stream.c index a500758420..d50982babe 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -213,11 +213,11 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 && (pzoption = zend_hash_str_find(pharcontext, "compress", sizeof("compress")-1)) != NULL - && Z_TYPE_P(pzoption) == IS_INT - && (Z_IVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 + && Z_TYPE_P(pzoption) == IS_LONG + && (Z_LVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 ) { idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; - idata->internal_file->flags |= Z_IVAL_P(pzoption); + idata->internal_file->flags |= Z_LVAL_P(pzoption); } if ((pzoption = zend_hash_str_find(pharcontext, "metadata", sizeof("metadata")-1)) != NULL) { if (Z_TYPE(idata->internal_file->metadata) != IS_UNDEF) { @@ -906,7 +906,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcmp(str_key->val, resource_from->path+1, from_len) == 0 && IS_SLASH(str_key->val[from_len])) { - new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0); + new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0); memcpy(new_str_key->val, resource_to->path + 1, to_len); memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len); new_str_key->val[new_str_key->len] = 0; @@ -918,8 +918,8 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from entry->filename = estrndup(new_str_key->val, new_str_key->len); entry->filename_len = new_str_key->len; - STR_RELEASE(str_key); - b->h = STR_HASH_VAL(new_str_key); + zend_string_release(str_key); + b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } } ZEND_HASH_FOREACH_END(); @@ -931,13 +931,13 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcmp(str_key->val, resource_from->path+1, from_len) == 0 && (str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) { - new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0); + new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0); memcpy(new_str_key->val, resource_to->path + 1, to_len); memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len); new_str_key->val[new_str_key->len] = 0; - STR_RELEASE(str_key); - b->h = STR_HASH_VAL(new_str_key); + zend_string_release(str_key); + b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } } ZEND_HASH_FOREACH_END(); @@ -949,13 +949,13 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from memcmp(str_key->val, resource_from->path+1, from_len) == 0 && (str_key->len == from_len || IS_SLASH(str_key->val[from_len]))) { - new_str_key = STR_ALLOC(str_key->len + to_len - from_len, 0); + new_str_key = zend_string_alloc(str_key->len + to_len - from_len, 0); memcpy(new_str_key->val, resource_to->path + 1, to_len); memcpy(new_str_key->val + to_len, str_key->val + from_len, str_key->len - from_len); new_str_key->val[new_str_key->len] = 0; - STR_RELEASE(str_key); - b->h = STR_HASH_VAL(new_str_key); + zend_string_release(str_key); + b->h = zend_string_hash_val(new_str_key); b->key = new_str_key; } } ZEND_HASH_FOREACH_END(); diff --git a/ext/phar/tar.c b/ext/phar/tar.c index fd571eae48..fa97b73a44 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -921,7 +921,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */ } /* }}} */ -int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ +int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ { phar_entry_info entry = {0}; static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();"; @@ -1004,7 +1004,7 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int if (str) { len = str->len; user_stub = estrndup(str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); } else { user_stub = NULL; len = 0; @@ -1300,7 +1300,7 @@ nostub: #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_int(&filterparams, "window", MAX_WBITS + 16); + add_assoc_long(&filterparams, "window", MAX_WBITS + 16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/util.c b/ext/phar/util.c index c2a398d787..19aa03f9cc 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1406,7 +1406,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e ZVAL_EMPTY_STRING(&zp[0]); } - if (end != Z_STRSIZE(zp[0])) { + if (end != Z_STRLEN(zp[0])) { zval_dtor(&zp[0]); zval_dtor(&zp[1]); zval_dtor(&zp[2]); @@ -1457,15 +1457,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e switch (Z_TYPE(retval)) { default: - case IS_INT: + case IS_LONG: zval_dtor(&zp[1]); - if (1 == Z_IVAL(retval)) { + if (1 == Z_LVAL(retval)) { return SUCCESS; } return FAILURE; case IS_TRUE: - *signature = estrndup(Z_STRVAL(zp[1]), Z_STRSIZE(zp[1])); - *signature_len = Z_STRSIZE(zp[1]); + *signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1])); + *signature_len = Z_STRLEN(zp[1]); zval_dtor(&zp[1]); return SUCCESS; case IS_FALSE: @@ -1526,7 +1526,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0, &sig, &tempsig TSRMLS_CC)) { if (pubkey) { - STR_RELEASE(pubkey); + zend_string_release(pubkey); } if (error) { @@ -1537,7 +1537,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ } if (pubkey) { - STR_RELEASE(pubkey); + zend_string_release(pubkey); } sig_len = tempsig; @@ -1545,7 +1545,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ in = BIO_new_mem_buf(pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0); if (NULL == in) { - STR_RELEASE(pubkey); + zend_string_release(pubkey); if (error) { spprintf(error, 0, "openssl signature could not be processed"); } @@ -1554,7 +1554,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL); BIO_free(in); - STR_RELEASE(pubkey); + zend_string_release(pubkey); if (NULL == key) { if (error) { diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 2eb48f45a4..81d7a0b8b9 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -167,7 +167,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, { phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; - php_int_t size; + zend_long size; php_uint16 i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; @@ -241,7 +241,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, mydata->metadata_len = 0; /* if not valid serialized data, it is a regular string */ - ZVAL_STR(&mydata->metadata, STR_INIT(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent)); + ZVAL_STR(&mydata->metadata, zend_string_init(metadata, PHAR_GET_16(locator.comment_len), mydata->is_persistent)); } } else { ZVAL_UNDEF(&mydata->metadata); @@ -529,7 +529,7 @@ foundit: entry.metadata_len = 0; /* if not valid serialized data, it is a regular string */ - ZVAL_STR(&entry.metadata, STR_INIT(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent)); + ZVAL_STR(&entry.metadata, zend_string_init(buf, PHAR_GET_16(zipentry.comment_len), entry.is_persistent)); } } else { ZVAL_UNDEF(&entry.metadata); @@ -586,7 +586,7 @@ foundit: if (str) { entry.uncompressed_filesize = str->len; actual_alias = estrndup(str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -618,7 +618,7 @@ foundit: if (str) { entry.uncompressed_filesize = str->len; actual_alias = estrndup(str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -640,7 +640,7 @@ foundit: if (str) { entry.uncompressed_filesize = str->len; actual_alias = estrndup(str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); } else { actual_alias = NULL; entry.uncompressed_filesize = 0; @@ -1177,7 +1177,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas } /* }}} */ -int phar_zip_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ +int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ { char *pos; smart_str main_metadata_str = {0}; @@ -1274,7 +1274,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int if (str) { len = str->len; user_stub = estrndup(str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); } else { user_stub = NULL; len = 0; diff --git a/ext/posix/posix.c b/ext/posix/posix.c index d4047cb692..97ec81174f 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -325,24 +325,24 @@ static PHP_GINIT_FUNCTION(posix) /* {{{ */ */ static PHP_MINIT_FUNCTION(posix) { - REGISTER_INT_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); #ifdef S_IFREG - REGISTER_INT_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFCHR - REGISTER_INT_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFBLK - REGISTER_INT_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFIFO - REGISTER_INT_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFSOCK - REGISTER_INT_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -375,13 +375,13 @@ ZEND_GET_MODULE(posix) #define PHP_POSIX_NO_ARGS if (zend_parse_parameters_none() == FAILURE) return; -#define PHP_POSIX_RETURN_INT_FUNC(func_name) \ +#define PHP_POSIX_RETURN_LONG_FUNC(func_name) \ PHP_POSIX_NO_ARGS \ - RETURN_INT(func_name()); + RETURN_LONG(func_name()); #define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \ - php_int_t val; \ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) RETURN_FALSE; \ + zend_long val; \ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) RETURN_FALSE; \ if (func_name(val) < 0) { \ POSIX_G(last_error) = errno; \ RETURN_FALSE; \ @@ -393,9 +393,9 @@ ZEND_GET_MODULE(posix) PHP_FUNCTION(posix_kill) { - php_int_t pid, sig; + zend_long pid, sig; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &sig) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) == FAILURE) { RETURN_FALSE; } @@ -412,7 +412,7 @@ PHP_FUNCTION(posix_kill) Get the current process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getpid) { - PHP_POSIX_RETURN_INT_FUNC(getpid); + PHP_POSIX_RETURN_LONG_FUNC(getpid); } /* }}} */ @@ -420,7 +420,7 @@ PHP_FUNCTION(posix_getpid) Get the parent process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getppid) { - PHP_POSIX_RETURN_INT_FUNC(getppid); + PHP_POSIX_RETURN_LONG_FUNC(getppid); } /* }}} */ @@ -428,7 +428,7 @@ PHP_FUNCTION(posix_getppid) Get the current user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getuid) { - PHP_POSIX_RETURN_INT_FUNC(getuid); + PHP_POSIX_RETURN_LONG_FUNC(getuid); } /* }}} */ @@ -436,7 +436,7 @@ PHP_FUNCTION(posix_getuid) Get the current group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getgid) { - PHP_POSIX_RETURN_INT_FUNC(getgid); + PHP_POSIX_RETURN_LONG_FUNC(getgid); } /* }}} */ @@ -444,7 +444,7 @@ PHP_FUNCTION(posix_getgid) Get the current effective user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_geteuid) { - PHP_POSIX_RETURN_INT_FUNC(geteuid); + PHP_POSIX_RETURN_LONG_FUNC(geteuid); } /* }}} */ @@ -452,7 +452,7 @@ PHP_FUNCTION(posix_geteuid) Get the current effective group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getegid) { - PHP_POSIX_RETURN_INT_FUNC(getegid); + PHP_POSIX_RETURN_LONG_FUNC(getegid); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(posix_getgroups) array_init(return_value); for (i=0; i<result; i++) { - add_next_index_int(return_value, gidlist[i]); + add_next_index_long(return_value, gidlist[i]); } } #endif @@ -540,7 +540,7 @@ PHP_FUNCTION(posix_getlogin) Get current process group id (POSIX.1, 4.3.1) */ PHP_FUNCTION(posix_getpgrp) { - PHP_POSIX_RETURN_INT_FUNC(getpgrp); + PHP_POSIX_RETURN_LONG_FUNC(getpgrp); } /* }}} */ @@ -549,7 +549,7 @@ PHP_FUNCTION(posix_getpgrp) #ifdef HAVE_SETSID PHP_FUNCTION(posix_setsid) { - PHP_POSIX_RETURN_INT_FUNC(setsid); + PHP_POSIX_RETURN_LONG_FUNC(setsid); } #endif /* }}} */ @@ -558,9 +558,9 @@ PHP_FUNCTION(posix_setsid) Set process group id for job control (POSIX.1, 4.3.3) */ PHP_FUNCTION(posix_setpgid) { - php_int_t pid, pgid; + zend_long pid, pgid; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &pgid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) == FAILURE) { RETURN_FALSE; } @@ -578,8 +578,8 @@ PHP_FUNCTION(posix_setpgid) #ifdef HAVE_GETPGID PHP_FUNCTION(posix_getpgid) { - php_int_t val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) { + zend_long val; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) { RETURN_FALSE; } @@ -587,7 +587,7 @@ PHP_FUNCTION(posix_getpgid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_INT(val); + RETURN_LONG(val); } #endif /* }}} */ @@ -597,8 +597,8 @@ PHP_FUNCTION(posix_getpgid) #ifdef HAVE_GETSID PHP_FUNCTION(posix_getsid) { - php_int_t val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) { + zend_long val; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) { RETURN_FALSE; } @@ -606,7 +606,7 @@ PHP_FUNCTION(posix_getsid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_INT(val); + RETURN_LONG(val); } #endif /* }}} */ @@ -658,11 +658,11 @@ PHP_FUNCTION(posix_times) array_init(return_value); - add_assoc_int(return_value, "ticks", ticks); /* clock ticks */ - add_assoc_int(return_value, "utime", t.tms_utime); /* user time */ - add_assoc_int(return_value, "stime", t.tms_stime); /* system time */ - add_assoc_int(return_value, "cutime", t.tms_cutime); /* user time of children */ - add_assoc_int(return_value, "cstime", t.tms_cstime); /* system time of children */ + add_assoc_long(return_value, "ticks", ticks); /* clock ticks */ + add_assoc_long(return_value, "utime", t.tms_utime); /* user time */ + add_assoc_long(return_value, "stime", t.tms_stime); /* system time */ + add_assoc_long(return_value, "cutime", t.tms_cutime); /* user time of children */ + add_assoc_long(return_value, "cstime", t.tms_cstime); /* system time of children */ } /* }}} */ @@ -724,7 +724,7 @@ PHP_FUNCTION(posix_ttyname) char *p; int fd; #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) - php_int_t buflen; + zend_long buflen; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) { @@ -739,7 +739,7 @@ PHP_FUNCTION(posix_ttyname) break; default: convert_to_int_ex(z_fd); - fd = Z_IVAL_P(z_fd); + fd = Z_LVAL_P(z_fd); } #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) buflen = sysconf(_SC_TTY_NAME_MAX); @@ -784,7 +784,7 @@ PHP_FUNCTION(posix_isatty) break; default: convert_to_int_ex(z_fd); - fd = Z_IVAL_P(z_fd); + fd = Z_LVAL_P(z_fd); } if (isatty(fd)) { @@ -836,10 +836,10 @@ PHP_FUNCTION(posix_mkfifo) { char *path; int path_len; - php_int_t mode; + zend_long mode; int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &path, &path_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &path, &path_len, &mode) == FAILURE) { RETURN_FALSE; } @@ -865,14 +865,14 @@ PHP_FUNCTION(posix_mknod) { char *path; int path_len; - php_int_t mode; - php_int_t major = 0, minor = 0; + zend_long mode; + zend_long major = 0, minor = 0; int result; dev_t php_dev; php_dev = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|ii", &path, &path_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|ll", &path, &path_len, &mode, &major, &minor) == FAILURE) { RETURN_FALSE; } @@ -931,7 +931,7 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ add_next_index_string(&array_members, g->gr_mem[count]); } zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members); - add_assoc_int(array_group, "gid", g->gr_gid); + add_assoc_long(array_group, "gid", g->gr_gid); return 1; } /* }}} */ @@ -947,11 +947,11 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ Determine accessibility of a file (POSIX.1 5.6.3) */ PHP_FUNCTION(posix_access) { - php_int_t mode = 0; + zend_long mode = 0; int filename_len, ret; char *filename, *path; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &mode) == FAILURE) { RETURN_FALSE; } @@ -1039,7 +1039,7 @@ PHP_FUNCTION(posix_getgrnam) Group database access (POSIX.1, 9.2.1) */ PHP_FUNCTION(posix_getgrgid) { - php_int_t gid; + zend_long gid; #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) int ret; struct group _g; @@ -1049,7 +1049,7 @@ PHP_FUNCTION(posix_getgrgid) #endif struct group *g; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &gid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE) { RETURN_FALSE; } #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) @@ -1096,8 +1096,8 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */ add_assoc_string(return_value, "name", pw->pw_name); add_assoc_string(return_value, "passwd", pw->pw_passwd); - add_assoc_int (return_value, "uid", pw->pw_uid); - add_assoc_int (return_value, "gid", pw->pw_gid); + add_assoc_long (return_value, "uid", pw->pw_uid); + add_assoc_long (return_value, "gid", pw->pw_gid); add_assoc_string(return_value, "gecos", pw->pw_gecos); add_assoc_string(return_value, "dir", pw->pw_dir); add_assoc_string(return_value, "shell", pw->pw_shell); @@ -1158,7 +1158,7 @@ PHP_FUNCTION(posix_getpwnam) User database access (POSIX.1, 9.2.2) */ PHP_FUNCTION(posix_getpwuid) { - php_int_t uid; + zend_long uid; #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) struct passwd _pw; struct passwd *retpwptr = NULL; @@ -1168,7 +1168,7 @@ PHP_FUNCTION(posix_getpwuid) #endif struct passwd *pw; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &uid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) { RETURN_FALSE; } #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) @@ -1229,13 +1229,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) { if (rl.rlim_cur == RLIM_INFINITY) { add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_int(return_value, soft, rl.rlim_cur); + add_assoc_long(return_value, soft, rl.rlim_cur); } if (rl.rlim_max == RLIM_INFINITY) { add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_int(return_value, hard, rl.rlim_max); + add_assoc_long(return_value, hard, rl.rlim_max); } return SUCCESS; @@ -1328,7 +1328,7 @@ PHP_FUNCTION(posix_get_last_error) { PHP_POSIX_NO_ARGS; - RETURN_INT(POSIX_G(last_error)); + RETURN_LONG(POSIX_G(last_error)); } /* }}} */ @@ -1336,9 +1336,9 @@ PHP_FUNCTION(posix_get_last_error) Retrieve the system error message associated with the given errno. */ PHP_FUNCTION(posix_strerror) { - php_int_t error; + zend_long error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) { RETURN_FALSE; } @@ -1353,11 +1353,11 @@ PHP_FUNCTION(posix_strerror) Calculate the group access list for the user specified in name. */ PHP_FUNCTION(posix_initgroups) { - php_int_t basegid; + zend_long basegid; char *name; int name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &name, &name_len, &basegid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &name, &name_len, &basegid) == FAILURE) { RETURN_FALSE; } diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index 359f02fb15..ff97306ecf 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -249,10 +249,10 @@ static void php_pspell_close_config(zend_resource *rsrc TSRMLS_DC) */ static PHP_MINIT_FUNCTION(pspell) { - REGISTER_INT_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); - REGISTER_INT_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number); le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number); return SUCCESS; @@ -265,7 +265,7 @@ static PHP_FUNCTION(pspell_new) { char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; - php_int_t mode = Z_I(0), speed = Z_I(0); + zend_long mode = Z_I(0), speed = Z_I(0); int argc = ZEND_NUM_ARGS(); zval *ind; @@ -281,7 +281,7 @@ static PHP_FUNCTION(pspell_new) PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(argc TSRMLS_CC, "s|sssi", &language, &language_len, &spelling, &spelling_len, + if (zend_parse_parameters(argc TSRMLS_CC, "s|sssl", &language, &language_len, &spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) { return; } @@ -352,7 +352,7 @@ static PHP_FUNCTION(pspell_new) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_INT(Z_RES_HANDLE_P(ind)); + RETURN_LONG(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -362,7 +362,7 @@ static PHP_FUNCTION(pspell_new_personal) { char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; int personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; - php_int_t mode = Z_I(0), speed = Z_I(0); + zend_long mode = Z_I(0), speed = Z_I(0); int argc = ZEND_NUM_ARGS(); zval *ind; @@ -378,7 +378,7 @@ static PHP_FUNCTION(pspell_new_personal) PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssi", &personal, &personal_len, &language, &language_len, + if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssl", &personal, &personal_len, &language, &language_len, &spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) { return; } @@ -457,7 +457,7 @@ static PHP_FUNCTION(pspell_new_personal) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_INT(Z_RES_HANDLE_P(ind)); + RETURN_LONG(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -465,13 +465,13 @@ static PHP_FUNCTION(pspell_new_personal) Load a dictionary based on the given config */ static PHP_FUNCTION(pspell_new_config) { - php_int_t conf; + zend_long conf; zval *ind; PspellCanHaveError *ret; PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &conf) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &conf) == FAILURE) { return; } @@ -487,7 +487,7 @@ static PHP_FUNCTION(pspell_new_config) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_INT(Z_RES_HANDLE_P(ind)); + RETURN_LONG(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -496,11 +496,11 @@ static PHP_FUNCTION(pspell_new_config) static PHP_FUNCTION(pspell_check) { int word_len; - php_int_t scin; + zend_long scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { return; } @@ -518,14 +518,14 @@ static PHP_FUNCTION(pspell_check) Returns array of suggestions */ static PHP_FUNCTION(pspell_suggest) { - php_int_t scin; + zend_long scin; char *word; int word_len; PspellManager *manager; const PspellWordList *wl; const char *sug; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { return; } @@ -552,11 +552,11 @@ static PHP_FUNCTION(pspell_suggest) static PHP_FUNCTION(pspell_store_replacement) { int miss_len, corr_len; - php_int_t scin; + zend_long scin; char *miss, *corr; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) { return; } @@ -577,11 +577,11 @@ static PHP_FUNCTION(pspell_store_replacement) static PHP_FUNCTION(pspell_add_to_personal) { int word_len; - php_int_t scin; + zend_long scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { return; } @@ -607,11 +607,11 @@ static PHP_FUNCTION(pspell_add_to_personal) static PHP_FUNCTION(pspell_add_to_session) { int word_len; - php_int_t scin; + zend_long scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { return; } @@ -636,10 +636,10 @@ static PHP_FUNCTION(pspell_add_to_session) Clears the current session */ static PHP_FUNCTION(pspell_clear_session) { - php_int_t scin; + zend_long scin; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) { return; } @@ -659,10 +659,10 @@ static PHP_FUNCTION(pspell_clear_session) Saves the current (personal) wordlist */ static PHP_FUNCTION(pspell_save_wordlist) { - php_int_t scin; + zend_long scin; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) { return; } @@ -744,7 +744,7 @@ static PHP_FUNCTION(pspell_config_create) pspell_config_replace(config, "save-repl", "false"); ind = zend_list_insert(config, le_pspell_config TSRMLS_CC); - RETURN_INT(Z_RES_HANDLE_P(ind)); + RETURN_LONG(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -752,11 +752,11 @@ static PHP_FUNCTION(pspell_config_create) Consider run-together words as valid components */ static PHP_FUNCTION(pspell_config_runtogether) { - php_int_t conf; + zend_long conf; zend_bool runtogether; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &runtogether) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &runtogether) == FAILURE) { return; } @@ -772,10 +772,10 @@ static PHP_FUNCTION(pspell_config_runtogether) Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */ static PHP_FUNCTION(pspell_config_mode) { - php_int_t conf, mode; + zend_long conf, mode; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &mode) == FAILURE) { return; } @@ -798,11 +798,11 @@ static PHP_FUNCTION(pspell_config_mode) Ignore words <= n chars */ static PHP_FUNCTION(pspell_config_ignore) { - char ignore_str[MAX_LENGTH_OF_ZEND_INT + 1]; - php_int_t conf, ignore = 0L; + char ignore_str[MAX_LENGTH_OF_LONG + 1]; + zend_long conf, ignore = 0L; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &ignore) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &ignore) == FAILURE) { return; } @@ -817,12 +817,12 @@ static PHP_FUNCTION(pspell_config_ignore) static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option) { - php_int_t conf; + zend_long conf; char *value; int value_len; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &value, &value_len) == FAILURE) { return; } @@ -865,12 +865,12 @@ static PHP_FUNCTION(pspell_config_data_dir) Use a personal dictionary with replacement pairs for this config */ static PHP_FUNCTION(pspell_config_repl) { - php_int_t conf; + zend_long conf; char *repl; int repl_len; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &repl, &repl_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &repl, &repl_len) == FAILURE) { return; } @@ -892,11 +892,11 @@ static PHP_FUNCTION(pspell_config_repl) Save replacement pairs when personal list is saved for this config */ static PHP_FUNCTION(pspell_config_save_repl) { - php_int_t conf; + zend_long conf; zend_bool save; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &save) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &save) == FAILURE) { return; } diff --git a/ext/readline/readline.c b/ext/readline/readline.c index ef82d5f8a3..10bd44ce5d 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -250,21 +250,21 @@ PHP_FUNCTION(readline_info) if (!what) { array_init(return_value); add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer)); - add_assoc_int(return_value,"point",rl_point); - add_assoc_int(return_value,"end",rl_end); + add_assoc_long(return_value,"point",rl_point); + add_assoc_long(return_value,"end",rl_end); #ifdef HAVE_LIBREADLINE - add_assoc_int(return_value,"mark",rl_mark); - add_assoc_int(return_value,"done",rl_done); - add_assoc_int(return_value,"pending_input",rl_pending_input); + add_assoc_long(return_value,"mark",rl_mark); + add_assoc_long(return_value,"done",rl_done); + add_assoc_long(return_value,"pending_input",rl_pending_input); add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt)); add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name)); #endif #if HAVE_ERASE_EMPTY_LINE - add_assoc_int(return_value,"erase_empty_line",rl_erase_empty_line); + add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); #endif add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version)); add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name)); - add_assoc_int(return_value,"attempted_completion_over",rl_attempted_completion_over); + add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over); } else { if (!strcasecmp(what,"line_buffer")) { oldstr = rl_line_buffer; @@ -275,26 +275,26 @@ PHP_FUNCTION(readline_info) } RETVAL_STRING(SAFE_STRING(oldstr)); } else if (!strcasecmp(what, "point")) { - RETVAL_INT(rl_point); + RETVAL_LONG(rl_point); } else if (!strcasecmp(what, "end")) { - RETVAL_INT(rl_end); + RETVAL_LONG(rl_end); #ifdef HAVE_LIBREADLINE } else if (!strcasecmp(what, "mark")) { - RETVAL_INT(rl_mark); + RETVAL_LONG(rl_mark); } else if (!strcasecmp(what, "done")) { oldval = rl_done; if (value) { convert_to_int_ex(value); - rl_done = Z_IVAL_P(value); + rl_done = Z_LVAL_P(value); } - RETVAL_INT(oldval); + RETVAL_LONG(oldval); } else if (!strcasecmp(what, "pending_input")) { oldval = rl_pending_input; if (value) { convert_to_string_ex(value); rl_pending_input = Z_STRVAL_P(value)[0]; } - RETVAL_INT(oldval); + RETVAL_LONG(oldval); } else if (!strcasecmp(what, "prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt)); } else if (!strcasecmp(what, "terminal_name")) { @@ -305,9 +305,9 @@ PHP_FUNCTION(readline_info) oldval = rl_erase_empty_line; if (value) { convert_to_int_ex(value); - rl_erase_empty_line = Z_IVAL_PP(value); + rl_erase_empty_line = Z_LVAL_PP(value); } - RETVAL_INT(oldval); + RETVAL_LONG(oldval); #endif } else if (!strcasecmp(what,"library_version")) { RETVAL_STRING((char *)SAFE_STRING(rl_library_version)); @@ -323,9 +323,9 @@ PHP_FUNCTION(readline_info) oldval = rl_attempted_completion_over; if (value) { convert_to_int_ex(value); - rl_attempted_completion_over = Z_IVAL_P(value); + rl_attempted_completion_over = Z_LVAL_P(value); } - RETVAL_INT(oldval); + RETVAL_LONG(oldval); } } } @@ -473,7 +473,7 @@ static void _readline_string_zval(zval *ret, const char *str) static void _readline_long_zval(zval *ret, long l) { - ZVAL_INT(ret, l); + ZVAL_LONG(ret, l); } static char **_readline_completion_cb(const char *text, int start, int end) @@ -521,10 +521,10 @@ PHP_FUNCTION(readline_completion_function) if (!zend_is_callable(arg, 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name->val); - STR_RELEASE(name); + zend_string_release(name); RETURN_FALSE; } - STR_RELEASE(name); + zend_string_release(name); zval_dtor(&_readline_completion); ZVAL_DUP(&_readline_completion, arg); @@ -571,10 +571,10 @@ PHP_FUNCTION(readline_callback_handler_install) if (!zend_is_callable(callback, 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name->val); - STR_RELEASE(name); + zend_string_release(name); RETURN_FALSE; } - STR_RELEASE(name); + zend_string_release(name); if (Z_TYPE(_prepped_callback) != IS_UNDEF) { rl_callback_handler_remove(); diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 0ca9daf8ff..2279f7aaa1 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -530,10 +530,10 @@ TODO: class_name_end = strstr(text, "::"); if (class_name_end) { class_name_len = class_name_end - text; - class_name = STR_ALLOC(class_name_len, 0); + class_name = zend_string_alloc(class_name_len, 0); zend_str_tolower_copy(class_name->val, text, class_name_len); if ((ce = zend_lookup_class(class_name TSRMLS_CC)) == NULL) { - STR_RELEASE(class_name); + zend_string_release(class_name); return NULL; } lc_text = zend_str_tolower_dup(class_name_end + 2, textlen - 2 - class_name_len); @@ -564,7 +564,7 @@ TODO: } efree(lc_text); if (class_name_end) { - STR_RELEASE(class_name); + zend_string_release(class_name); } if (ce && retval) { int len = class_name_len + 2 + strlen(retval) + 1; @@ -631,13 +631,13 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ if (param) { zend_string *cmd; param++; - cmd = STR_INIT(&line[1], param - &line[1] - 1, 0); + cmd = zend_string_init(&line[1], param - &line[1] - 1, 0); zend_alter_ini_entry_ex(cmd, param, strlen(param), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(cmd); + zend_string_release(cmd); add_history(line); - STR_RELEASE(prompt); + zend_string_release(prompt); /* TODO: This might be wrong! */ prompt = cli_get_prompt("php", '>' TSRMLS_CC); continue; @@ -659,7 +659,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ } free(line); - STR_RELEASE(prompt); + zend_string_release(prompt); if (!cli_is_valid_code(code, pos, &prompt TSRMLS_CC)) { continue; @@ -697,7 +697,7 @@ static int readline_shell_run(TSRMLS_D) /* {{{ */ } free(history_file); efree(code); - STR_RELEASE(prompt); + zend_string_release(prompt); return EG(exit_status); } /* }}} */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8d3e0494f6..8262b86e1d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -110,8 +110,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) target = intern->ptr; \ /* Class constants */ -#define REGISTER_REFLECTION_CLASS_CONST_INT(class_name, const_name, value) \ - zend_declare_class_constant_int(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value) \ + zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* {{{ Smart string functions */ typedef struct _string { @@ -121,7 +121,7 @@ typedef struct _string { static void string_init(string *str) { - str->buf= STR_ALLOC(1024, 0); + str->buf= zend_string_alloc(1024, 0); str->alloced = 1024; str->buf->val[0] = '\0'; str->buf->len = 0; @@ -140,7 +140,7 @@ static string *string_printf(string *str, const char *format, ...) if (str->alloced < nlen) { int old_len = str->buf->len; str->alloced = nlen; - str->buf = STR_REALLOC(str->buf, str->alloced, 0); + str->buf = zend_string_realloc(str->buf, str->alloced, 0); str->buf->len = old_len; } memcpy(str->buf->val + str->buf->len, s_tmp, len + 1); @@ -157,7 +157,7 @@ static string *string_write(string *str, char *buf, int len) if (str->alloced < nlen) { int old_len = str->buf->len; str->alloced = nlen; - str->buf = STR_REALLOC(str->buf, str->alloced, 0); + str->buf = zend_string_realloc(str->buf, str->alloced, 0); str->buf->len = old_len; } memcpy(str->buf->val + str->buf->len, buf, len); @@ -176,7 +176,7 @@ static string *string_append(string *str, string *append) static void string_free(string *str) { - STR_RELEASE(str->buf); + zend_string_release(str->buf); str->alloced = 0; str->buf = NULL; } @@ -270,7 +270,7 @@ static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */ zend_function *copy_fptr; copy_fptr = emalloc(sizeof(zend_function)); memcpy(copy_fptr, fptr, sizeof(zend_function)); - copy_fptr->internal_function.function_name = STR_COPY(fptr->internal_function.function_name); + copy_fptr->internal_function.function_name = zend_string_copy(fptr->internal_function.function_name); return copy_fptr; } else { /* no copy needed */ @@ -285,7 +285,7 @@ static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */ && fptr->type == ZEND_INTERNAL_FUNCTION && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) { - STR_RELEASE(fptr->internal_function.function_name); + zend_string_release(fptr->internal_function.function_name); efree(fptr); } } @@ -312,7 +312,7 @@ static void reflection_free_objects_storage(zend_object *object TSRMLS_DC) /* {{ break; case REF_TYPE_DYNAMIC_PROPERTY: prop_reference = (property_reference*)intern->ptr; - STR_RELEASE(prop_reference->prop.name); + zend_string_release(prop_reference->prop.name); efree(intern->ptr); break; case REF_TYPE_OTHER: @@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in HashPosition pos; zval *value; zend_string *key; - php_uint_t num_index; + zend_ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); @@ -565,7 +565,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) { zend_string *prop_name; - php_uint_t index; + zend_ulong index; if (zend_hash_get_current_key_ex(properties, &prop_name, &index, 0, &pos) == HASH_KEY_IS_STRING) { if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */ @@ -602,7 +602,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { zend_string *key; - php_uint_t num_index; + zend_ulong num_index; uint len = mptr->common.function_name->len; /* Do not display old-style inherited constructors */ @@ -655,7 +655,7 @@ static void _const_string(string *str, char *name, zval *value, char *indent TSR string_printf(str, "%s Constant [ %s %s ] { %s }\n", indent, type, name, value_str->val); - STR_RELEASE(value_str); + zend_string_release(value_str); } /* }}} */ @@ -729,8 +729,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE(zv) == IS_STRING) { string_write(str, "'", sizeof("'")-1); - string_write(str, Z_STRVAL(zv), MIN(Z_STRSIZE(zv), 15)); - if (Z_STRSIZE(zv) > 15) { + string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15)); + if (Z_STRLEN(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); @@ -739,7 +739,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg } else { zend_string *zv_str = zval_get_string(&zv); string_write(str, zv_str->val, zv_str->len); - STR_RELEASE(zv_str); + zend_string_release(zv_str); } zval_ptr_dtor(&zv); } @@ -774,7 +774,7 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i static void _function_closure_string(string *str, zend_function *fptr, char* indent TSRMLS_DC) { zend_uint i, count; - php_uint_t num_index; + zend_ulong num_index; zend_string *key; HashTable *static_variables; HashPosition pos; @@ -834,7 +834,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry string_printf(str, ", inherits %s", fptr->common.scope->name->val); } else if (fptr->common.scope->parent) { lc_name_len = fptr->common.function_name->len; - lc_name = STR_ALLOC(lc_name_len, 0); + lc_name = zend_string_alloc(lc_name_len, 0); zend_str_tolower_copy(lc_name->val, fptr->common.function_name->val, lc_name_len); if ((overwrites = zend_hash_find_ptr(&fptr->common.scope->parent->function_table, lc_name)) != NULL) { if (fptr->common.scope != overwrites->common.scope) { @@ -1178,7 +1178,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR reflection_object *intern; zval name; - ZVAL_STR(&name, STR_COPY(ce->name)); + ZVAL_STR(&name, zend_string_copy(ce->name)); reflection_instantiate(reflection_class_ptr, object TSRMLS_CC); intern = Z_REFLECTION_P(object); intern->ptr = ce; @@ -1197,10 +1197,10 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM zend_string *lcname; struct _zend_module_entry *module; - lcname = STR_ALLOC(name_len, 0); + lcname = zend_string_alloc(name_len, 0); zend_str_tolower_copy(lcname->val, name_str, name_len); module = zend_hash_find_ptr(&module_registry, lcname); - STR_FREE(lcname); + zend_string_free(lcname); if (!module) { return; } @@ -1251,7 +1251,7 @@ static void reflection_function_factory(zend_function *function, zval *closure_o reflection_object *intern; zval name; - ZVAL_STR(&name, STR_COPY(function->common.function_name)); + ZVAL_STR(&name, zend_string_copy(function->common.function_name)); reflection_instantiate(reflection_function_ptr, object TSRMLS_CC); intern = Z_REFLECTION_P(object); @@ -1273,9 +1273,9 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho zval name; zval classname; - ZVAL_STR(&name, STR_COPY((method->common.scope && method->common.scope->trait_aliases)? + ZVAL_STR(&name, zend_string_copy((method->common.scope && method->common.scope->trait_aliases)? zend_resolve_method_name(ce, method) : method->common.function_name)); - ZVAL_STR(&classname, STR_COPY(method->common.scope->name)); + ZVAL_STR(&classname, zend_string_copy(method->common.scope->name)); reflection_instantiate(reflection_method_ptr, object TSRMLS_CC); intern = Z_REFLECTION_P(object); intern->ptr = method; @@ -1319,7 +1319,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info } ZVAL_STRING(&name, prop_name); - ZVAL_STR(&classname, STR_COPY(prop->ce->name)); + ZVAL_STR(&classname, zend_string_copy(prop->ce->name)); reflection_instantiate(reflection_property_ptr, object TSRMLS_CC); intern = Z_REFLECTION_P(object); @@ -1532,9 +1532,9 @@ ZEND_METHOD(reflection, export) Returns an array of modifier names */ ZEND_METHOD(reflection, getModifierNames) { - php_int_t modifiers; + zend_long modifiers; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &modifiers) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &modifiers) == FAILURE) { return; } @@ -1622,7 +1622,7 @@ ZEND_METHOD(reflection_function, __construct) return; } - ZVAL_STR(&name, STR_COPY(fptr->common.function_name)); + ZVAL_STR(&name, zend_string_copy(fptr->common.function_name)); reflection_update_property(object, "name", &name); intern->ptr = fptr; intern->ref_type = REF_TYPE_FUNCTION; @@ -1790,7 +1790,7 @@ ZEND_METHOD(reflection_function, getFileName) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_STR(STR_COPY(fptr->op_array.filename)); + RETURN_STR(zend_string_copy(fptr->op_array.filename)); } RETURN_FALSE; } @@ -1808,7 +1808,7 @@ ZEND_METHOD(reflection_function, getStartLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_INT(fptr->op_array.line_start); + RETURN_LONG(fptr->op_array.line_start); } RETURN_FALSE; } @@ -1826,7 +1826,7 @@ ZEND_METHOD(reflection_function, getEndLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_INT(fptr->op_array.line_end); + RETURN_LONG(fptr->op_array.line_end); } RETURN_FALSE; } @@ -1844,7 +1844,7 @@ ZEND_METHOD(reflection_function, getDocComment) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) { - RETURN_STR(STR_COPY(fptr->op_array.doc_comment)); + RETURN_STR(zend_string_copy(fptr->op_array.doc_comment)); } RETURN_FALSE; } @@ -2009,7 +2009,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_INT(fptr->common.num_args); + RETURN_LONG(fptr->common.num_args); } /* }}} */ @@ -2023,7 +2023,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_INT(fptr->common.required_num_args); + RETURN_LONG(fptr->common.required_num_args); } /* }}} */ @@ -2140,7 +2140,7 @@ ZEND_METHOD(reflection_parameter, __construct) unsigned int lcname_len; char *lcname; - lcname_len = Z_STRSIZE_P(reference); + lcname_len = Z_STRLEN_P(reference); lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len); if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) { efree(lcname); @@ -2178,7 +2178,7 @@ ZEND_METHOD(reflection_parameter, __construct) } convert_to_string_ex(method); - lcname_len = Z_STRSIZE_P(method); + lcname_len = Z_STRLEN_P(method); lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len); if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2219,12 +2219,12 @@ ZEND_METHOD(reflection_parameter, __construct) /* Now, search for the parameter */ arg_info = fptr->common.arg_info; - if (Z_TYPE_P(parameter) == IS_INT) { - position= Z_IVAL_P(parameter); + if (Z_TYPE_P(parameter) == IS_LONG) { + position= Z_LVAL_P(parameter); if (position < 0 || (zend_uint)position >= fptr->common.num_args) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fptr->common.function_name); + zend_string_release(fptr->common.function_name); } efree(fptr); } @@ -2248,7 +2248,7 @@ ZEND_METHOD(reflection_parameter, __construct) if (position == -1) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { - STR_RELEASE(fptr->common.function_name); + zend_string_release(fptr->common.function_name); } efree(fptr); } @@ -2396,9 +2396,9 @@ ZEND_METHOD(reflection_parameter, getClass) } ce = ce->parent; } else { - zend_string *name = STR_INIT(param->arg_info->class_name, param->arg_info->class_name_len, 0); + zend_string *name = zend_string_init(param->arg_info->class_name, param->arg_info->class_name_len, 0); ce = zend_lookup_class(name TSRMLS_CC); - STR_FREE(name); + zend_string_free(name); if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", param->arg_info->class_name); @@ -2503,7 +2503,7 @@ ZEND_METHOD(reflection_parameter, getPosition) } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_INT(param->offset); + RETVAL_LONG(param->offset); } /* }}} */ @@ -2626,7 +2626,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); if (precv && Z_TYPE_P(precv->op2.zv) == IS_CONSTANT) { - RETURN_STR(STR_COPY(Z_STR_P(precv->op2.zv))); + RETURN_STR(zend_string_copy(Z_STR_P(precv->op2.zv))); } } /* }}} */ @@ -2739,9 +2739,9 @@ ZEND_METHOD(reflection_method, __construct) } efree(lcname); - ZVAL_STR(&name, STR_COPY(mptr->common.scope->name)); + ZVAL_STR(&name, zend_string_copy(mptr->common.scope->name)); reflection_update_property(object, "class", &name); - ZVAL_STR(&name, STR_COPY(mptr->common.function_name)); + ZVAL_STR(&name, zend_string_copy(mptr->common.function_name)); reflection_update_property(object, "name", &name); intern->ptr = mptr; intern->ref_type = REF_TYPE_FUNCTION; @@ -3103,7 +3103,7 @@ ZEND_METHOD(reflection_function, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -3126,7 +3126,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -3149,10 +3149,10 @@ ZEND_METHOD(reflection_function, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -3203,7 +3203,7 @@ ZEND_METHOD(reflection_method, getModifiers) } GET_REFLECTION_OBJECT_PTR(mptr); - RETURN_INT(mptr->common.fn_flags); + RETURN_LONG(mptr->common.fn_flags); } /* }}} */ @@ -3304,7 +3304,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob } if (Z_TYPE_P(argument) == IS_OBJECT) { - ZVAL_STR(&classname, STR_COPY(Z_OBJCE_P(argument)->name)); + ZVAL_STR(&classname, zend_string_copy(Z_OBJCE_P(argument)->name)); reflection_update_property(object, "name", &classname); intern->ptr = Z_OBJCE_P(argument); if (is_object) { @@ -3320,7 +3320,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob return; } - ZVAL_STR(&classname, STR_COPY(ce->name)); + ZVAL_STR(&classname, zend_string_copy(ce->name)); reflection_update_property(object, "name", &classname); intern->ptr = ce; @@ -3343,7 +3343,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, prop_copy; zend_string *key; - php_uint_t num_index; + zend_ulong num_index; ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) { if (((prop_info->flags & ZEND_ACC_SHADOW) && @@ -3548,7 +3548,7 @@ ZEND_METHOD(reflection_class, getFileName) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { - RETURN_STR(STR_COPY(ce->info.user.filename)); + RETURN_STR(zend_string_copy(ce->info.user.filename)); } RETURN_FALSE; } @@ -3566,7 +3566,7 @@ ZEND_METHOD(reflection_class, getStartLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_FUNCTION) { - RETURN_INT(ce->info.user.line_start); + RETURN_LONG(ce->info.user.line_start); } RETURN_FALSE; } @@ -3584,7 +3584,7 @@ ZEND_METHOD(reflection_class, getEndLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { - RETURN_INT(ce->info.user.line_end); + RETURN_LONG(ce->info.user.line_end); } RETURN_FALSE; } @@ -3602,7 +3602,7 @@ ZEND_METHOD(reflection_class, getDocComment) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) { - RETURN_STR(STR_COPY(ce->info.user.doc_comment)); + RETURN_STR(zend_string_copy(ce->info.user.doc_comment)); } RETURN_FALSE; } @@ -3744,12 +3744,12 @@ ZEND_METHOD(reflection_class, getMethods) { reflection_object *intern; zend_class_entry *ce; - php_int_t filter = 0; + zend_long filter = 0; int argc = ZEND_NUM_ARGS(); METHOD_NOTSTATIC(reflection_class_ptr); if (argc) { - if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) { return; } } else { @@ -3794,7 +3794,7 @@ ZEND_METHOD(reflection_class, hasProperty) RETURN_TRUE; } else { if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) { - ZVAL_STR(&property, STR_COPY(name)); + ZVAL_STR(&property, zend_string_copy(name)); if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL TSRMLS_CC)) { zval_ptr_dtor(&property); RETURN_TRUE; @@ -3833,7 +3833,7 @@ ZEND_METHOD(reflection_class, getProperty) if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj TSRMLS_CC), name)) { zend_property_info property_info_tmp; property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC; - property_info_tmp.name = STR_COPY(name); + property_info_tmp.name = zend_string_copy(name); property_info_tmp.doc_comment = NULL; property_info_tmp.ce = ce; @@ -3847,7 +3847,7 @@ ZEND_METHOD(reflection_class, getProperty) str_name_len = name->len; if ((tmp = strstr(name->val, "::")) != NULL) { classname_len = tmp - name->val; - classname = STR_ALLOC(classname_len, 0); + classname = zend_string_alloc(classname_len, 0); zend_str_tolower_copy(classname->val, name->val, classname_len); classname->val[classname_len] = '\0'; str_name_len = name->len - (classname_len + 2); @@ -3858,10 +3858,10 @@ ZEND_METHOD(reflection_class, getProperty) if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname->val); } - STR_FREE(classname); + zend_string_free(classname); return; } - STR_FREE(classname); + zend_string_free(classname); if (!instanceof_function(ce, ce2 TSRMLS_CC)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name->val, str_name, ce->name->val); @@ -3934,12 +3934,12 @@ ZEND_METHOD(reflection_class, getProperties) { reflection_object *intern; zend_class_entry *ce; - php_int_t filter = 0; + zend_long filter = 0; int argc = ZEND_NUM_ARGS(); METHOD_NOTSTATIC(reflection_class_ptr); if (argc) { - if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) { return; } } else { @@ -4137,7 +4137,7 @@ ZEND_METHOD(reflection_class, getModifiers) } GET_REFLECTION_OBJECT_PTR(ce); - RETURN_INT(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); + RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); } /* }}} */ @@ -4380,7 +4380,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames) array_init(return_value); for (i=0; i < ce->num_interfaces; i++) { - add_next_index_str(return_value, STR_COPY(ce->interfaces[i]->name)); + add_next_index_str(return_value, zend_string_copy(ce->interfaces[i]->name)); } } /* }}} */ @@ -4424,7 +4424,7 @@ ZEND_METHOD(reflection_class, getTraitNames) array_init(return_value); for (i=0; i < ce->num_traits; i++) { - add_next_index_str(return_value, STR_COPY(ce->traits[i]->name)); + add_next_index_str(return_value, zend_string_copy(ce->traits[i]->name)); } } /* }}} */ @@ -4451,7 +4451,7 @@ ZEND_METHOD(reflection_class, getTraitAliases) if (ce->trait_aliases[i]->alias) { - mname = STR_ALLOC(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0); + mname = zend_string_alloc(cur_ref->ce->name->len + cur_ref->method_name->len + 2, 0); snprintf(mname->val, mname->len + 1, "%s::%s", cur_ref->ce->name->val, cur_ref->method_name->val); add_assoc_str_ex(return_value, ce->trait_aliases[i]->alias->val, ce->trait_aliases[i]->alias->len, mname); } @@ -4648,7 +4648,7 @@ ZEND_METHOD(reflection_class, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -4671,7 +4671,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -4694,10 +4694,10 @@ ZEND_METHOD(reflection_class, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -4797,10 +4797,10 @@ ZEND_METHOD(reflection_property, __construct) if (dynam_prop == 0) { zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name); - ZVAL_STR(&cname, STR_COPY(property_info->ce->name)); + ZVAL_STR(&cname, zend_string_copy(property_info->ce->name)); ZVAL_STRING(&propname, prop_name); } else { - ZVAL_STR(&cname, STR_COPY(ce->name)); + ZVAL_STR(&cname, zend_string_copy(ce->name)); ZVAL_STRINGL(&propname, name_str, name_len); } reflection_update_property(object, "class", &cname); @@ -4917,7 +4917,7 @@ ZEND_METHOD(reflection_property, getModifiers) } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_INT(ref->prop.flags); + RETURN_LONG(ref->prop.flags); } /* }}} */ @@ -5084,7 +5084,7 @@ ZEND_METHOD(reflection_property, getDocComment) } GET_REFLECTION_OBJECT_PTR(ref); if (ref->prop.doc_comment) { - RETURN_STR(STR_COPY(ref->prop.doc_comment)); + RETURN_STR(zend_string_copy(ref->prop.doc_comment)); } RETURN_FALSE; } @@ -5316,7 +5316,7 @@ static int add_extension_class(zval *zv TSRMLS_DC, int num_args, va_list args, z zend_reflection_class_factory(ce, &zclass TSRMLS_CC); zend_hash_update(Z_ARRVAL_P(class_array), ce->name, &zclass); } else { - add_next_index_str(class_array, STR_COPY(ce->name)); + add_next_index_str(class_array, zend_string_copy(ce->name)); } } return ZEND_HASH_APPLY_KEEP; @@ -5411,7 +5411,7 @@ ZEND_METHOD(reflection_extension, getDependencies) len += strlen(dep->version) + 1; } - relation = STR_ALLOC(len, 0); + relation = zend_string_alloc(len, 0); snprintf(relation->val, relation->len + 1, "%s%s%s%s%s", rel_type, dep->rel ? " " : "", @@ -6048,8 +6048,8 @@ static void _reflection_write_property(zval *object, zval *member, zval *value, { if ((Z_TYPE_P(member) == IS_STRING) && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member)) - && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) + || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member)); @@ -6092,7 +6092,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC); zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_INT(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); + REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6106,12 +6106,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); - REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_FINAL", ZEND_ACC_FINAL); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); + REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6119,9 +6119,9 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_class_implements(reflection_class_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); + REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6134,10 +6134,10 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions); _reflection_entry.create_object = reflection_objects_new; diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 6ea33a71aa..45e27a96ab 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -335,7 +335,7 @@ PS_CLOSE_FUNC(files) PS_READ_FUNC(files) { - php_int_t n; + zend_long n; struct stat sbuf; PS_FILES_DATA; @@ -344,7 +344,7 @@ PS_READ_FUNC(files) ps_files_key_exists(data, key? key->val : NULL TSRMLS_CC) == FAILURE) { /* key points to PS(id), but cannot change here. */ if (key) { - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); PS(id) = NULL; } PS(id) = PS(mod)->s_create_sid((void **)&data TSRMLS_CC); @@ -374,7 +374,7 @@ PS_READ_FUNC(files) return SUCCESS; } - *val = STR_ALLOC(sbuf.st_size, 0); + *val = zend_string_alloc(sbuf.st_size, 0); #if defined(HAVE_PREAD) n = pread(data->fd, (*val)->val, (*val)->len, 0); @@ -389,7 +389,7 @@ PS_READ_FUNC(files) } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "read returned less bytes than requested"); } - STR_RELEASE(*val); + zend_string_release(*val); return FAILURE; } @@ -398,7 +398,7 @@ PS_READ_FUNC(files) PS_WRITE_FUNC(files) { - php_int_t n; + zend_long n; PS_FILES_DATA; ps_files_open(data, key->val TSRMLS_CC); @@ -481,7 +481,7 @@ PS_CREATE_SID_FUNC(files) /* Check collision */ if (data && ps_files_key_exists(data, sid? sid->val : NULL TSRMLS_CC) == SUCCESS) { if (sid) { - STR_RELEASE(sid); + zend_string_release(sid); sid = NULL; } if (!(maxfail--)) { diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 40bb88813b..5d69712543 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -26,9 +26,9 @@ ps_module ps_mod_user = { PS_MOD_SID(user) }; -#define SESS_ZVAL_INT(val, a) \ +#define SESS_ZVAL_LONG(val, a) \ { \ - ZVAL_INT(a, val); \ + ZVAL_LONG(a, val); \ } #define SESS_ZVAL_STRING(vl, a) \ @@ -44,7 +44,7 @@ ps_module ps_mod_user = { #define SESS_ZVAL_STR(vl, a) \ { \ - ZVAL_STR(a, STR_COPY(vl)); \ + ZVAL_STR(a, zend_string_copy(vl)); \ } static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRMLS_DC) @@ -73,10 +73,10 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRML ret = SUCCESS; \ } else if (Z_TYPE(retval) == IS_FALSE) { \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == -1)) { \ + } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \ /* BC for clever users - Deprecate me */ \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == 0)) { \ + } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \ /* BC for clever users - Deprecate me */ \ ret = SUCCESS; \ } else { \ @@ -150,7 +150,7 @@ PS_READ_FUNC(user) if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) == IS_STRING) { - *val = STR_COPY(Z_STR(retval)); + *val = zend_string_copy(Z_STR(retval)); ret = SUCCESS; } zval_ptr_dtor(&retval); @@ -189,7 +189,7 @@ PS_GC_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_INT(maxlifetime, &args[0]); + SESS_ZVAL_LONG(maxlifetime, &args[0]); ps_call_handler(&PSF(gc), 1, args, &retval TSRMLS_CC); @@ -207,7 +207,7 @@ PS_CREATE_SID_FUNC(user) if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) == IS_STRING) { - id = STR_COPY(Z_STR(retval)); + id = zend_string_copy(Z_STR(retval)); } zval_ptr_dtor(&retval); } else { diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 326f6f21f1..d6d538cc70 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -125,12 +125,12 @@ PHP_METHOD(SessionHandler, destroy) Wraps the old gc handler */ PHP_METHOD(SessionHandler, gc) { - php_int_t maxlifetime; + zend_long maxlifetime; int nrdels; PS_SANITY_CHECK_IS_OPEN; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &maxlifetime) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &maxlifetime) == FAILURE) { return; } diff --git a/ext/session/php_session.h b/ext/session/php_session.h index e553ca0e1a..790e116528 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -104,8 +104,8 @@ typedef struct _php_session_rfc1867_progress { zval sid; smart_str key; - php_int_t update_step; - php_int_t next_update; + zend_long update_step; + zend_long next_update; double next_update_time; zend_bool cancel_upload; zend_bool apply_trans_sid; @@ -125,8 +125,8 @@ typedef struct _php_ps_globals { char *extern_referer_chk; char *entropy_file; char *cache_limiter; - php_int_t entropy_length; - php_int_t cookie_lifetime; + zend_long entropy_length; + zend_long cookie_lifetime; char *cookie_path; char *cookie_domain; zend_bool cookie_secure; @@ -135,11 +135,11 @@ typedef struct _php_ps_globals { ps_module *default_mod; void *mod_data; php_session_status session_status; - php_int_t gc_probability; - php_int_t gc_divisor; - php_int_t gc_maxlifetime; + zend_long gc_probability; + zend_long gc_divisor; + zend_long gc_maxlifetime; int module_number; - php_int_t cache_expire; + zend_long cache_expire; union { zval names[7]; struct { @@ -162,11 +162,11 @@ typedef struct _php_ps_globals { zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ - php_int_t hash_func; + zend_long hash_func; #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) php_hash_ops *hash_ops; #endif - php_int_t hash_bits_per_character; + zend_long hash_bits_per_character; int send_cookie; int define_sid; zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ @@ -176,7 +176,7 @@ typedef struct _php_ps_globals { zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */ char *rfc1867_prefix; /* session.upload_progress.prefix */ char *rfc1867_name; /* session.upload_progress.name */ - php_int_t rfc1867_freq; /* session.upload_progress.freq */ + zend_long rfc1867_freq; /* session.upload_progress.freq */ double rfc1867_min_freq; /* session.upload_progress.min_freq */ zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */ @@ -254,7 +254,7 @@ PHPAPI void php_session_reset_id(TSRMLS_D); #define PS_ENCODE_VARS \ zend_string *key; \ - php_uint_t num_key; \ + zend_ulong num_key; \ zval *struc; #define PS_ENCODE_LOOP(code) do { \ diff --git a/ext/session/session.c b/ext/session/session.c index d6ffe8b63b..58bfc33d2d 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -115,7 +115,7 @@ static inline void php_rshutdown_session_globals(TSRMLS_D) /* {{{ */ } zend_end_try(); } if (PS(id)) { - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); } } /* }}} */ @@ -181,7 +181,7 @@ PHPAPI zval* php_get_session_var(zend_string *name TSRMLS_DC) /* {{{ */ static void php_session_track_init(TSRMLS_D) /* {{{ */ { zval session_vars; - zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0); + zend_string *var_name = zend_string_init("_SESSION", sizeof("_SESSION") - 1, 0); /* Unconditionally destroy existing array -- possible dirty data */ zend_delete_global_variable(var_name TSRMLS_CC); @@ -193,7 +193,7 @@ static void php_session_track_init(TSRMLS_D) /* {{{ */ ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); - STR_RELEASE(var_name); + zend_string_release(var_name); } /* }}} */ @@ -305,7 +305,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ } /* maximum 15+19+19+10 bytes */ - spprintf(&buf, 0, "%.15s%ld" ZEND_INT_FMT "%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (php_int_t)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); + spprintf(&buf, 0, "%.15s%ld" ZEND_INT_FMT "%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (zend_long)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); switch (PS(hash_func)) { case PS_HASH_FUNC_MD5: @@ -416,7 +416,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now"); } - outid = STR_ALLOC((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0); + outid = zend_string_alloc((digest_len + 2) * ((8.0f / PS(hash_bits_per_character) + 0.5)), 0); outid->len = (int)(bin_to_readable((char *)digest, digest_len, outid->val, (char)PS(hash_bits_per_character)) - (char *)&outid->val); efree(digest); @@ -514,7 +514,7 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */ PHP_MD5Final(PS(session_data_hash), &context); php_session_decode(val->val, val->len TSRMLS_CC); - STR_RELEASE(val); + zend_string_release(val); } else { memset(PS(session_data_hash),'\0', 16); } @@ -551,7 +551,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */ } else { ret = SUCCESS; } - STR_RELEASE(val); + zend_string_release(val); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC() TSRMLS_CC); } @@ -705,7 +705,7 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ { - php_int_t val; + zend_long val; char *endptr = NULL; #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) @@ -846,7 +846,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ const char *endptr = val + vallen; zval session_vars; php_unserialize_data_t var_hash; - zend_string *var_name = STR_INIT("_SESSION", sizeof("_SESSION") - 1, 0); + zend_string *var_name = zend_string_init("_SESSION", sizeof("_SESSION") - 1, 0); ZVAL_NULL(&session_vars); PHP_VAR_UNSERIALIZE_INIT(var_hash); @@ -861,7 +861,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); - STR_RELEASE(var_name); + zend_string_release(var_name); return SUCCESS; } /* }}} */ @@ -918,7 +918,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ has_value = *p & PS_BIN_UNDEF ? 0 : 1; - name = STR_INIT(p + 1, namelen, 0); + name = zend_string_init(p + 1, namelen, 0); p += namelen + 1; @@ -939,7 +939,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ } } PS_ADD_VARL(name); - STR_RELEASE(name); + zend_string_release(name); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); @@ -1010,7 +1010,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ } namelen = q - p; - name = STR_INIT(p, namelen, 0); + name = zend_string_init(p, namelen, 0); q++; if ((tmp = zend_hash_find(&EG(symbol_table).ht, name))) { @@ -1030,7 +1030,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ } PS_ADD_VARL(name); skip: - STR_RELEASE(name); + zend_string_release(name); p = q; } @@ -1272,7 +1272,7 @@ static void php_session_remove_cookie(TSRMLS_D) { e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name))); spprintf(&session_cookie, 0, "Set-Cookie: %s=", e_session_name->val); - STR_FREE(e_session_name); + zend_string_free(e_session_name); session_cookie_len = strlen(session_cookie); current = l->head; @@ -1327,8 +1327,8 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */ smart_str_appendc(&ncookie, '='); smart_str_appendl(&ncookie, e_id->val, e_id->len); - STR_RELEASE(e_session_name); - STR_RELEASE(e_id); + zend_string_release(e_session_name); + zend_string_release(e_id); if (PS(cookie_lifetime) > 0) { struct timeval tv; @@ -1341,10 +1341,10 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */ date_fmt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, t, 0 TSRMLS_CC); smart_str_appends(&ncookie, COOKIE_EXPIRES); smart_str_appendl(&ncookie, date_fmt->val, date_fmt->len); - STR_RELEASE(date_fmt); + zend_string_release(date_fmt); smart_str_appends(&ncookie, COOKIE_MAX_AGE); - smart_str_append_int(&ncookie, PS(cookie_lifetime)); + smart_str_append_long(&ncookie, PS(cookie_lifetime)); } } @@ -1413,7 +1413,7 @@ static void ppid2sid(zval *ppid TSRMLS_DC) { PS(send_cookie) = 1; } else { convert_to_string(ppid); - PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRSIZE_P(ppid), 0); + PS(id) = zend_string_init(Z_STRVAL_P(ppid), Z_STRLEN_P(ppid), 0); PS(send_cookie) = 0; } } @@ -1547,7 +1547,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ p += lensess + 1; if ((q = strpbrk(p, "/?\\"))) { - PS(id) = STR_INIT(p, q - p, 0); + PS(id) = zend_string_init(p, q - p, 0); PS(send_cookie) = 0; } } @@ -1560,10 +1560,10 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) && (data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) && Z_TYPE_P(data) == IS_STRING && - Z_STRSIZE_P(data) != 0 && + Z_STRLEN_P(data) != 0 && strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL ) { - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); PS(id) = NULL; PS(send_cookie) = 1; if (PS(use_trans_sid) && !PS(use_only_cookies)) { @@ -1574,7 +1574,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ /* Finally check session id for dangerous characters * Security note: session id may be embedded in HTML pages.*/ if (PS(id) && strpbrk(PS(id)->val, "\r\n\t <>'\"\\")) { - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); PS(id) = NULL; } @@ -1655,30 +1655,30 @@ static PHP_FUNCTION(session_set_cookie_params) convert_to_string_ex(lifetime); - ini_name = STR_INIT("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRSIZE_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + ini_name = zend_string_init("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRLEN_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_string_release(ini_name); if (path) { - ini_name = STR_INIT("session.cookie_path", sizeof("session.cookie_path") - 1, 0); + ini_name = zend_string_init("session.cookie_path", sizeof("session.cookie_path") - 1, 0); zend_alter_ini_entry(ini_name, path, path_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } if (domain) { - ini_name = STR_INIT("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0); + ini_name = zend_string_init("session.cookie_domain", sizeof("session.cookie_domain") - 1, 0); zend_alter_ini_entry(ini_name, domain, domain_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } if (argc > 3) { - ini_name = STR_INIT("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0); + ini_name = zend_string_init("session.cookie_secure", sizeof("session.cookie_secure") - 1, 0); zend_alter_ini_entry(ini_name, secure ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } if (argc > 4) { - ini_name = STR_INIT("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0); + ini_name = zend_string_init("session.cookie_httponly", sizeof("session.cookie_httponly") - 1, 0); zend_alter_ini_entry(ini_name, httponly ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -1693,7 +1693,7 @@ static PHP_FUNCTION(session_get_cookie_params) array_init(return_value); - add_assoc_int(return_value, "lifetime", PS(cookie_lifetime)); + add_assoc_long(return_value, "lifetime", PS(cookie_lifetime)); add_assoc_string(return_value, "path", PS(cookie_path)); add_assoc_string(return_value, "domain", PS(cookie_domain)); add_assoc_bool(return_value, "secure", PS(cookie_secure)); @@ -1716,9 +1716,9 @@ static PHP_FUNCTION(session_name) RETVAL_STRING(PS(session_name)); if (name) { - ini_name = STR_INIT("session.name", sizeof("session.name") - 1, 0); + ini_name = zend_string_init("session.name", sizeof("session.name") - 1, 0); zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -1754,9 +1754,9 @@ static PHP_FUNCTION(session_module_name) } PS(mod_data) = NULL; - ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0); + ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -1779,7 +1779,7 @@ static PHP_FUNCTION(session_set_save_handler) zend_string *func_name; HashPosition pos; zend_function *default_mptr, *current_mptr; - php_uint_t func_index; + zend_ulong func_index; php_shutdown_function_entry shutdown_function_entry; zend_bool register_shutdown = 1; @@ -1851,9 +1851,9 @@ static PHP_FUNCTION(session_set_save_handler) } if (PS(mod) && PS(session_status) == php_session_none && PS(mod) != &ps_mod_user) { - ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0); + ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); zend_alter_ini_entry(ini_name, "user", sizeof("user") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } RETURN_TRUE; @@ -1874,16 +1874,16 @@ static PHP_FUNCTION(session_set_save_handler) for (i = 0; i < argc; i++) { if (!zend_is_callable(&args[i], 0, &name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1); - STR_RELEASE(name); + zend_string_release(name); RETURN_FALSE; } - STR_RELEASE(name); + zend_string_release(name); } if (PS(mod) && PS(mod) != &ps_mod_user) { - ini_name = STR_INIT("session.save_handler", sizeof("session.save_handler") - 1, 0); + ini_name = zend_string_init("session.save_handler", sizeof("session.save_handler") - 1, 0); zend_alter_ini_entry(ini_name, "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } for (i = 0; i < argc; i++) { @@ -1917,9 +1917,9 @@ static PHP_FUNCTION(session_save_path) zval_dtor(return_value); RETURN_FALSE; } - ini_name = STR_INIT("session.save_path", sizeof("session.save_path") - 1, 0); + ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0); zend_alter_ini_entry(ini_name, name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -1940,9 +1940,9 @@ static PHP_FUNCTION(session_id) * see: ext/session/tests/session_id_error3.phpt */ int len = strlen(PS(id)->val); if (UNEXPECTED(len != PS(id)->len)) { - RETVAL_STR(STR_INIT(PS(id)->val, len, 0)); + RETVAL_STR(zend_string_init(PS(id)->val, len, 0)); } else { - RETVAL_STR(STR_COPY(PS(id))); + RETVAL_STR(zend_string_copy(PS(id))); } } else { RETVAL_EMPTY_STRING(); @@ -1950,9 +1950,9 @@ static PHP_FUNCTION(session_id) if (name) { if (PS(id)) { - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); } - PS(id) = STR_COPY(name); + PS(id) = zend_string_copy(name); } } /* }}} */ @@ -1978,7 +1978,7 @@ static PHP_FUNCTION(session_regenerate_id) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed"); RETURN_FALSE; } - STR_RELEASE(PS(id)); + zend_string_release(PS(id)); memset(PS(session_data_hash),'\0', 16); } @@ -2010,9 +2010,9 @@ static PHP_FUNCTION(session_cache_limiter) RETVAL_STRING(PS(cache_limiter)); if (limiter) { - ini_name = STR_INIT("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0); + ini_name = zend_string_init("session.cache_limiter", sizeof("session.cache_limiter") - 1, 0); zend_alter_ini_entry(ini_name, limiter, limiter_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); } } /* }}} */ @@ -2028,13 +2028,13 @@ static PHP_FUNCTION(session_cache_expire) return; } - RETVAL_INT(PS(cache_expire)); + RETVAL_LONG(PS(cache_expire)); if (expires) { convert_to_string_ex(expires); - ini_name = STR_INIT("session.cache_expire", sizeof("session.cache_expire") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRSIZE_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRLEN_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_string_release(ini_name); } } /* }}} */ @@ -2157,7 +2157,7 @@ static PHP_FUNCTION(session_status) return; } - RETURN_INT(PS(session_status)); + RETURN_LONG(PS(session_status)); } /* }}} */ @@ -2432,7 +2432,7 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ { zend_class_entry ce; - zend_register_auto_global(STR_INIT("_SESSION", sizeof("_SESSION") - 1, 1), 0, NULL TSRMLS_CC); + zend_register_auto_global(zend_string_init("_SESSION", sizeof("_SESSION") - 1, 1), 0, NULL TSRMLS_CC); PS(module_number) = module_number; /* if we really need this var we need to init it in zts mode as well! */ @@ -2460,9 +2460,9 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_iface_entry); zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_id_iface_entry); - REGISTER_INT_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2603,7 +2603,7 @@ static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, int force_update TSRMLS_DC) /* {{{ */ { if (!force_update) { - if (Z_IVAL_P(progress->post_bytes_processed) < progress->next_update) { + if (Z_LVAL_P(progress->post_bytes_processed) < progress->next_update) { return; } #ifdef HAVE_GETTIMEOFDAY @@ -2618,7 +2618,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i progress->next_update_time = dtv + PS(rfc1867_min_freq); } #endif - progress->next_update = Z_IVAL_P(progress->post_bytes_processed) + progress->update_step; + progress->next_update = Z_LVAL_P(progress->post_bytes_processed) + progress->update_step; } php_session_initialize(TSRMLS_C); @@ -2720,16 +2720,16 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo array_init(&progress->data); array_init(&progress->files); - add_assoc_int_ex(&progress->data, "start_time", sizeof("start_time") - 1, (php_int_t)sapi_get_request_time(TSRMLS_C)); - add_assoc_int_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); - add_assoc_int_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); + add_assoc_long_ex(&progress->data, "start_time", sizeof("start_time") - 1, (zend_long)sapi_get_request_time(TSRMLS_C)); + add_assoc_long_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); + add_assoc_long_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 0); add_assoc_zval_ex(&progress->data, "files", sizeof("files") - 1, &progress->files); progress->post_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->data), "bytes_processed", sizeof("bytes_processed") - 1); php_rinit_session(0 TSRMLS_CC); - PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRSIZE(progress->sid), 0); + PS(id) = zend_string_init(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0); PS(apply_trans_sid) = progress->apply_trans_sid; PS(send_cookie) = 0; } @@ -2740,17 +2740,17 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name); add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename); add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1); - add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, 0); + add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 0); - add_assoc_int_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (php_int_t)time(NULL)); - add_assoc_int_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); + add_assoc_long_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (zend_long)time(NULL)); + add_assoc_long_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); add_next_index_zval(&progress->files, &progress->current_file); progress->current_file_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->current_file), "bytes_processed", sizeof("bytes_processed") - 1); - Z_IVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; + Z_LVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; @@ -2761,8 +2761,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo break; } - Z_IVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; - Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; + Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2778,10 +2778,10 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename); } - add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); + add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 1); - Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2794,7 +2794,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo php_session_rfc1867_cleanup(progress TSRMLS_CC); } else { add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 1); - Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 1 TSRMLS_CC); } php_rshutdown_session_globals(TSRMLS_C); diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h index e0e0448709..b9eaba6f07 100644 --- a/ext/shmop/php_shmop.h +++ b/ext/shmop/php_shmop.h @@ -45,7 +45,7 @@ struct php_shmop int shmflg; int shmatflg; char *addr; - php_int_t size; + zend_long size; }; typedef struct { diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 3a66d7343c..87faa0bdf7 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -146,13 +146,13 @@ PHP_MINFO_FUNCTION(shmop) gets and attaches a shared memory segment */ PHP_FUNCTION(shmop_open) { - php_int_t key, mode, size; + zend_long key, mode, size; struct php_shmop *shmop; struct shmid_ds shm; char *flags; int flags_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "isii", &key, &flags, &flags_len, &mode, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) { return; } @@ -216,7 +216,7 @@ PHP_FUNCTION(shmop_open) shmop->size = shm.shm_segsz; ZEND_REGISTER_RESOURCE(return_value, shmop, shm_type); - RETURN_INT(Z_RES_HANDLE_P(return_value)); + RETURN_LONG(Z_RES_HANDLE_P(return_value)); err: efree(shmop); RETURN_FALSE; @@ -227,13 +227,13 @@ err: reads from a shm segment */ PHP_FUNCTION(shmop_read) { - php_int_t shmid, start, count; + zend_long shmid, start, count; struct php_shmop *shmop; char *startaddr; int bytes; zend_string *return_string; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &shmid, &start, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) { return; } @@ -252,7 +252,7 @@ PHP_FUNCTION(shmop_read) startaddr = shmop->addr + start; bytes = count ? count : shmop->size - start; - return_string = STR_INIT(startaddr, bytes, 0); + return_string = zend_string_init(startaddr, bytes, 0); RETURN_STR(return_string); } @@ -262,10 +262,10 @@ PHP_FUNCTION(shmop_read) closes a shared memory segment */ PHP_FUNCTION(shmop_close) { - php_int_t shmid; + zend_long shmid; zval *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { return; } @@ -280,16 +280,16 @@ PHP_FUNCTION(shmop_close) returns the shm size */ PHP_FUNCTION(shmop_size) { - php_int_t shmid; + zend_long shmid; struct php_shmop *shmop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { return; } ZEND_FETCH_RESOURCE(shmop, struct php_shmop *, NULL, shmid, "shmop", shm_type); - RETURN_INT(shmop->size); + RETURN_LONG(shmop->size); } /* }}} */ @@ -299,10 +299,10 @@ PHP_FUNCTION(shmop_write) { struct php_shmop *shmop; int writesize; - php_int_t shmid, offset; + zend_long shmid, offset; zend_string *data; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSi", &shmid, &data, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lSl", &shmid, &data, &offset) == FAILURE) { return; } @@ -321,7 +321,7 @@ PHP_FUNCTION(shmop_write) writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset; memcpy(shmop->addr + offset, data->val, writesize); - RETURN_INT(writesize); + RETURN_LONG(writesize); } /* }}} */ @@ -329,10 +329,10 @@ PHP_FUNCTION(shmop_write) mark segment for deletion */ PHP_FUNCTION(shmop_delete) { - php_int_t shmid; + zend_long shmid; struct php_shmop *shmop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { return; } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 78d8da5694..a65fd30046 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -138,9 +138,9 @@ static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, } /* }}} */ -static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, php_int_t offset, xmlNodePtr node, php_int_t *cnt) /* {{{ */ +static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, zend_long offset, xmlNodePtr node, zend_long *cnt) /* {{{ */ { - php_int_t nodendx = 0; + zend_long nodendx = 0; if (sxe->iter.type == SXE_ITER_NONE) { if (offset == 0) { @@ -255,7 +255,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_INT) { + if (!member || Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -299,11 +299,11 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (node) { if (attribs) { - if (Z_TYPE_P(member) != IS_INT || sxe->iter.type == SXE_ITER_ATTRLIST) { - if (Z_TYPE_P(member) == IS_INT) { - while (attr && nodendx <= Z_IVAL_P(member)) { + if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) { + if (Z_TYPE_P(member) == IS_LONG) { + while (attr && nodendx <= Z_LVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_IVAL_P(member)) { + if (nodendx == Z_LVAL_P(member)) { _node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); break; } @@ -327,27 +327,27 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (!sxe->node) { php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL TSRMLS_CC); } - if (!member || Z_TYPE_P(member) == IS_INT) { - php_int_t cnt = 0; + if (!member || Z_TYPE_P(member) == IS_LONG) { + zend_long cnt = 0; xmlNodePtr mynode = node; if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } if (sxe->iter.type == SXE_ITER_NONE) { - if (member && Z_IVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); + if (member && Z_LVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); } } else if (member) { - node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); + node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); } else { node = NULL; } if (node) { _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); } else if (type == BP_VAR_W || type == BP_VAR_RW) { - if (member && cnt < Z_IVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt); + if (member && cnt < Z_LVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt); } node = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, NULL); _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); @@ -410,7 +410,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC) return; } switch (Z_TYPE_P(value)) { - case IS_INT: + case IS_LONG: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -456,13 +456,13 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool int nodendx = 0; int test = 0; int new_value = 0; - php_int_t cnt = 0; + zend_long cnt = 0; int retval = SUCCESS; zval tmp_zv, trim_zv, zval_copy; sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_INT) { + if (!member || Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -479,12 +479,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool trim_zv = *member; zval_copy_ctor(&trim_zv); convert_to_string(&trim_zv); - php_trim(Z_STRVAL(trim_zv), Z_STRSIZE(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); + php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); zval_dtor(&trim_zv); member = &tmp_zv; } - if (!Z_STRSIZE_P(member)) { + if (!Z_STRLEN_P(member)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element"); if (member == &tmp_zv) { zval_dtor(&tmp_zv); @@ -525,7 +525,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (value) { switch (Z_TYPE_P(value)) { - case IS_INT: + case IS_LONG: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -559,10 +559,10 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_INT) { - while (attr && nodendx <= Z_IVAL_P(member)) { + if (Z_TYPE_P(member) == IS_LONG) { + while (attr && nodendx <= Z_LVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_IVAL_P(member)) { + if (nodendx == Z_LVAL_P(member)) { is_attr = 1; ++counter; break; @@ -585,7 +585,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool } if (elements) { - if (!member || Z_TYPE_P(member) == IS_INT) { + if (!member || Z_TYPE_P(member) == IS_LONG) { if (node->type == XML_ATTRIBUTE_NODE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot create duplicate attribute"); return FAILURE; @@ -594,12 +594,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (sxe->iter.type == SXE_ITER_NONE) { newnode = node; ++counter; - if (member && Z_IVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); + if (member && Z_LVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); retval = FAILURE; } } else if (member) { - newnode = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); + newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); if (newnode) { ++counter; } @@ -636,21 +636,21 @@ next_iter: retval = FAILURE; } else if (elements) { if (!node) { - if (!member || Z_TYPE_P(member) == IS_INT) { + if (!member || Z_TYPE_P(member) == IS_LONG) { newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } else { newnode = xmlNewTextChild(mynode, mynode->ns, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } - } else if (!member || Z_TYPE_P(member) == IS_INT) { - if (member && cnt < Z_IVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt); + } else if (!member || Z_TYPE_P(member) == IS_LONG) { + if (member && cnt < Z_LVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt); retval = FAILURE; } newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } } else if (attribs) { - if (Z_TYPE_P(member) == IS_INT) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_IVAL_P(member), nodendx); + if (Z_TYPE_P(member) == IS_LONG) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_LVAL_P(member), nodendx); retval = FAILURE; } else { newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); @@ -735,7 +735,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend int test = 0; zval tmp_zv; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -746,7 +746,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -770,12 +770,12 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { int nodendx = 0; - while (attr && nodendx <= Z_IVAL_P(member)) { + while (attr && nodendx <= Z_LVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_IVAL_P(member)) { + if (nodendx == Z_LVAL_P(member)) { exists = 1; break; } @@ -801,11 +801,11 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } if (elements) { - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); } else { node = node->children; @@ -865,7 +865,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zval tmp_zv; int test = 0; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -876,7 +876,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -900,12 +900,12 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { int nodendx = 0; - while (attr && nodendx <= Z_IVAL_P(member)) { + while (attr && nodendx <= Z_LVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_IVAL_P(member)) { + if (nodendx == Z_LVAL_P(member)) { xmlUnlinkNode((xmlNodePtr) attr); php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC); break; @@ -928,11 +928,11 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, } if (elements) { - if (Z_TYPE_P(member) == IS_INT) { + if (Z_TYPE_P(member) == IS_LONG) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); if (node) { xmlUnlinkNode(node); php_libxml_node_free_resource(node TSRMLS_CC); @@ -984,7 +984,7 @@ static inline zend_string *sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr li zend_string *res; if (tmp) { - res = STR_INIT((char*)tmp, strlen((char *)tmp), 0); + res = zend_string_init((char*)tmp, strlen((char *)tmp), 0); xmlFree(tmp); } else { res = STR_EMPTY_ALLOC(); @@ -1770,7 +1770,7 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC) case _IS_BOOL: convert_to_boolean(object); break; - case IS_INT: + case IS_LONG: convert_to_int(object); break; case IS_DOUBLE: @@ -1864,7 +1864,7 @@ SXE_METHOD(__toString) } /* }}} */ -static int php_sxe_count_elements_helper(php_sxe_object *sxe, php_int_t *count TSRMLS_DC) /* {{{ */ +static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count TSRMLS_DC) /* {{{ */ { xmlNodePtr node; zval data; @@ -1891,7 +1891,7 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, php_int_t *count T } /* }}} */ -static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ +static int sxe_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */ { php_sxe_object *intern; intern = Z_SXEOBJ_P(object); @@ -1904,7 +1904,7 @@ static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ * } ZVAL_ZVAL(&intern->tmp, &rv, 0, 0); convert_to_int(&intern->tmp); - *count = (php_int_t)Z_IVAL(intern->tmp); + *count = (zend_long)Z_LVAL(intern->tmp); return SUCCESS; } return FAILURE; @@ -1917,7 +1917,7 @@ static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ * Get number of child elements */ SXE_METHOD(count) { - php_int_t count = 0; + zend_long count = 0; php_sxe_object *sxe = Z_SXEOBJ_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -1926,7 +1926,7 @@ SXE_METHOD(count) php_sxe_count_elements_helper(sxe, &count TSRMLS_CC); - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ @@ -2118,11 +2118,11 @@ PHP_FUNCTION(simplexml_load_file) xmlDocPtr docp; char *ns = NULL; int ns_len = 0; - php_int_t options = 0; + zend_long options = 0; zend_class_entry *ce= sxe_class_entry; zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!isb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -2155,11 +2155,11 @@ PHP_FUNCTION(simplexml_load_string) xmlDocPtr docp; char *ns = NULL; int ns_len = 0; - php_int_t options = 0; + zend_long options = 0; zend_class_entry *ce= sxe_class_entry; zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!isb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -2190,12 +2190,12 @@ SXE_METHOD(__construct) char *data, *ns = NULL; int data_len, ns_len = 0; xmlDocPtr docp; - php_int_t options = 0; + zend_long options = 0; zend_bool is_url = 0, isprefix = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ibsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h index bd0b272777..bf73bfcc9b 100644 --- a/ext/skeleton/php_skeleton.h +++ b/ext/skeleton/php_skeleton.h @@ -25,7 +25,7 @@ extern zend_module_entry extname_module_entry; and END macros here: ZEND_BEGIN_MODULE_GLOBALS(extname) - php_int_t global_value; + zend_long global_value; char *global_string; ZEND_END_MODULE_GLOBALS(extname) */ diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index a3293e370f..6e170ffe71 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -132,8 +132,8 @@ ZEND_END_MODULE_GLOBALS(snmp) #define SNMP_G(v) (snmp_globals.v) #endif -#define REGISTER_SNMP_CLASS_CONST_INT(const_name, value) \ - zend_declare_class_constant_int(php_snmp_ce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); +#define REGISTER_SNMP_CLASS_CONST_LONG(const_name, value) \ + zend_declare_class_constant_long(php_snmp_ce, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); #else diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 2d6afc43d4..bfd77d5b29 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -376,8 +376,8 @@ struct objid_query { int count; int offset; int step; - php_int_t non_repeaters; - php_int_t max_repetitions; + zend_long non_repeaters; + zend_long max_repetitions; int valueretrieval; int array_output; int oid_increasing_check; @@ -680,7 +680,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D if (valueretrieval & SNMP_VALUE_OBJECT) { object_init(snmpval); - add_property_int(snmpval, "type", vars->type); + add_property_long(snmpval, "type", vars->type); add_property_zval(snmpval, "value", &val); } else { ZVAL_COPY(snmpval, &val); @@ -1014,8 +1014,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu objid_query->vars[objid_query->count].oid = Z_STRVAL_P(oid); if (st & SNMP_CMD_SET) { if (Z_TYPE_P(type) == IS_STRING && Z_TYPE_P(value) == IS_STRING) { - if (Z_STRSIZE_P(type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRSIZE_P(type)); + if (Z_STRLEN_P(type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRLEN_P(type)); efree(objid_query->vars); return FALSE; } @@ -1054,8 +1054,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu } else if (Z_TYPE_P(type) == IS_ARRAY) { if ((tmp_type = zend_hash_get_current_data_ex(Z_ARRVAL_P(type), &pos_type)) != NULL) { convert_to_string_ex(tmp_type); - if (Z_STRSIZE_P(tmp_type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRSIZE_P(tmp_type)); + if (Z_STRLEN_P(tmp_type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRLEN_P(tmp_type)); efree(objid_query->vars); return FALSE; } @@ -1429,8 +1429,8 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) char *a1, *a2, *a3, *a4, *a5, *a6, *a7; int a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len; zend_bool use_orignames = 0, suffix_keys = 0; - php_int_t timeout = SNMP_DEFAULT_TIMEOUT; - php_int_t retries = SNMP_DEFAULT_RETRIES; + zend_long timeout = SNMP_DEFAULT_TIMEOUT; + zend_long retries = SNMP_DEFAULT_RETRIES; int argc = ZEND_NUM_ARGS(); struct objid_query objid_query; php_snmp_session *session; @@ -1446,7 +1446,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) if (session_less_mode) { if (version == SNMP_VERSION_3) { if (st & SNMP_CMD_SET) { - if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, + if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, &a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { RETURN_FALSE; } @@ -1455,14 +1455,14 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) * SNMP_CMD_GETNEXT * SNMP_CMD_WALK */ - if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, + if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, &a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } } else { if (st & SNMP_CMD_SET) { - if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } else { @@ -1470,7 +1470,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) * SNMP_CMD_GETNEXT * SNMP_CMD_WALK */ - if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } @@ -1481,7 +1481,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) RETURN_FALSE; } } else if (st & SNMP_CMD_WALK) { - if (zend_parse_parameters(argc TSRMLS_CC, "z|bii", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) { RETURN_FALSE; } if (suffix_keys) { @@ -1619,9 +1619,9 @@ PHP_FUNCTION(snmp_get_quick_print) Return all objects including their respective object id withing the specified one */ PHP_FUNCTION(snmp_set_quick_print) { - php_int_t a1; + zend_long a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { RETURN_FALSE; } @@ -1634,9 +1634,9 @@ PHP_FUNCTION(snmp_set_quick_print) Return all values that are enums with their enum value instead of the raw integer */ PHP_FUNCTION(snmp_set_enum_print) { - php_int_t a1; + zend_long a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { RETURN_FALSE; } @@ -1649,9 +1649,9 @@ PHP_FUNCTION(snmp_set_enum_print) Set the OID output format. */ PHP_FUNCTION(snmp_set_oid_output_format) { - php_int_t a1; + zend_long a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { RETURN_FALSE; } @@ -1757,9 +1757,9 @@ PHP_FUNCTION(snmp3_set) Specify the method how the SNMP values will be returned */ PHP_FUNCTION(snmp_set_valueretrieval) { - php_int_t method; + zend_long method; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { RETURN_FALSE; } @@ -1781,7 +1781,7 @@ PHP_FUNCTION(snmp_get_valueretrieval) RETURN_FALSE; } - RETURN_INT(SNMP_G(valueretrieval)); + RETURN_LONG(SNMP_G(valueretrieval)); } /* }}} */ @@ -1813,16 +1813,16 @@ PHP_METHOD(snmp, __construct) zval *object = getThis(); char *a1, *a2; int a1_len, a2_len; - php_int_t timeout = SNMP_DEFAULT_TIMEOUT; - php_int_t retries = SNMP_DEFAULT_RETRIES; - php_int_t version = SNMP_DEFAULT_VERSION; + zend_long timeout = SNMP_DEFAULT_TIMEOUT; + zend_long retries = SNMP_DEFAULT_RETRIES; + zend_long version = SNMP_DEFAULT_VERSION; int argc = ZEND_NUM_ARGS(); zend_error_handling error_handling; snmp_object = Z_SNMP_P(object); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(argc TSRMLS_CC, "iss|ii", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1942,7 +1942,7 @@ PHP_METHOD(snmp, getErrno) snmp_object = Z_SNMP_P(object); - RETVAL_INT(snmp_object->snmp_errno); + RETVAL_LONG(snmp_object->snmp_errno); return; } /* }}} */ @@ -2097,7 +2097,7 @@ static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC) HashTable *props; zval rv; zend_string *key; - php_uint_t num_key; + zend_ulong num_key; obj = Z_SNMP_P(object); props = zend_std_get_properties(object TSRMLS_CC); @@ -2127,13 +2127,13 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ ZVAL_STRINGL(&val, snmp_object->session->peername, strlen(snmp_object->session->peername)); add_assoc_zval(retval, "hostname", &val); - ZVAL_INT(&val, snmp_object->session->remote_port); + ZVAL_LONG(&val, snmp_object->session->remote_port); add_assoc_zval(retval, "port", &val); - ZVAL_INT(&val, snmp_object->session->timeout); + ZVAL_LONG(&val, snmp_object->session->timeout); add_assoc_zval(retval, "timeout", &val); - ZVAL_INT(&val, snmp_object->session->retries); + ZVAL_LONG(&val, snmp_object->session->retries); add_assoc_zval(retval, "retries", &val); return SUCCESS; @@ -2144,7 +2144,7 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) { if (snmp_object->max_oids > 0) { - ZVAL_INT(retval, snmp_object->max_oids); + ZVAL_LONG(retval, snmp_object->max_oids); } else { ZVAL_NULL(retval); } @@ -2163,16 +2163,16 @@ PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(oid_increasing_check) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(quick_print) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(enum_print) -#define PHP_SNMP_INT_PROPERTY_READER_FUNCTION(name) \ +#define PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(name) \ static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) \ { \ - ZVAL_INT(retval, snmp_object->name); \ + ZVAL_LONG(retval, snmp_object->name); \ return SUCCESS; \ } -PHP_SNMP_INT_PROPERTY_READER_FUNCTION(valueretrieval) -PHP_SNMP_INT_PROPERTY_READER_FUNCTION(oid_output_format) -PHP_SNMP_INT_PROPERTY_READER_FUNCTION(exceptions_enabled) +PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(valueretrieval) +PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(oid_output_format) +PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(exceptions_enabled) /* {{{ */ static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval TSRMLS_DC) @@ -2193,17 +2193,17 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval TS return ret; } - if (Z_TYPE_P(newval) != IS_INT) { + if (Z_TYPE_P(newval) != IS_LONG) { ztmp = *newval; zval_copy_ctor(&ztmp); convert_to_int(&ztmp); newval = &ztmp; } - if (Z_IVAL_P(newval) > 0) { - snmp_object->max_oids = Z_IVAL_P(newval); + if (Z_LVAL_P(newval) > 0) { + snmp_object->max_oids = Z_LVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_IVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_LVAL_P(newval)); } if (newval == &ztmp) { @@ -2220,17 +2220,17 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_INT) { + if (Z_TYPE_P(newval) != IS_LONG) { ztmp = *newval; zval_copy_ctor(&ztmp); convert_to_int(&ztmp); newval = &ztmp; } - if (Z_IVAL_P(newval) >= 0 && Z_IVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { - snmp_object->valueretrieval = Z_IVAL_P(newval); + if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { + snmp_object->valueretrieval = Z_LVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_IVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_LVAL_P(newval)); ret = FAILURE; } @@ -2264,23 +2264,23 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval * { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_INT) { + if (Z_TYPE_P(newval) != IS_LONG) { ZVAL_COPY(&ztmp, newval); convert_to_int(&ztmp); newval = &ztmp; } - switch(Z_IVAL_P(newval)) { + switch(Z_LVAL_P(newval)) { case NETSNMP_OID_OUTPUT_SUFFIX: case NETSNMP_OID_OUTPUT_MODULE: case NETSNMP_OID_OUTPUT_FULL: case NETSNMP_OID_OUTPUT_NUMERIC: case NETSNMP_OID_OUTPUT_UCD: case NETSNMP_OID_OUTPUT_NONE: - snmp_object->oid_output_format = Z_IVAL_P(newval); + snmp_object->oid_output_format = Z_LVAL_P(newval); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%pd'", Z_IVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%pd'", Z_LVAL_P(newval)); ret = FAILURE; break; } @@ -2297,13 +2297,13 @@ static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_INT) { + if (Z_TYPE_P(newval) != IS_LONG) { ZVAL_COPY(&ztmp, newval); convert_to_int(&ztmp); newval = &ztmp; } - snmp_object->exceptions_enabled = Z_IVAL_P(newval); + snmp_object->exceptions_enabled = Z_LVAL_P(newval); if (newval == &ztmp) { zval_ptr_dtor(newval); @@ -2391,43 +2391,43 @@ PHP_MINIT_FUNCTION(snmp) zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1); PHP_SNMP_ADD_PROPERTIES(&php_snmp_properties, php_snmp_property_entries); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); - - REGISTER_SNMP_CLASS_CONST_INT("VERSION_1", SNMP_VERSION_1); - REGISTER_SNMP_CLASS_CONST_INT("VERSION_2c", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_INT("VERSION_2C", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_INT("VERSION_3", SNMP_VERSION_3); - - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); - REGISTER_SNMP_CLASS_CONST_INT("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); + + REGISTER_SNMP_CLASS_CONST_LONG("VERSION_1", SNMP_VERSION_1); + REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2c", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2C", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_LONG("VERSION_3", SNMP_VERSION_3); + + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); + REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); /* Register SNMPException class */ INIT_CLASS_ENTRY(cex, "SNMPException", NULL); diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 149d9989a4..7dd6747c25 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -145,7 +145,7 @@ encode defaultEncoding[] = { {{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null}, {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string}, - {{IS_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, + {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{IS_FALSE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, {{IS_TRUE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, @@ -290,7 +290,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { if (Z_TYPE_P(data) == IS_OBJECT) { data = (zval*)Z_OBJ_P(data); } - if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data)) != NULL) { + if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data)) != NULL) { xmlAttrPtr attr = node_ptr->properties; char *id; smart_str prefix = {0}; @@ -317,7 +317,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1)); @@ -334,7 +334,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1); @@ -344,7 +344,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { smart_str_free(&prefix); return 1; } else { - zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data, node); + zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data, node); } } return 0; @@ -355,7 +355,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) zval *data_ptr; if (SOAP_GLOBAL(ref_map)) { - if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (php_uint_t)node)) != NULL) { + if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (zend_ulong)node)) != NULL) { if (!Z_REFCOUNTED_P(data) || !Z_REFCOUNTED_P(data_ptr) || Z_COUNTED_P(data) != Z_COUNTED_P(data_ptr)) { @@ -371,7 +371,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) static void soap_add_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) { if (SOAP_GLOBAL(ref_map)) { - zend_hash_index_update(SOAP_GLOBAL(ref_map), (php_uint_t)node, data); + zend_hash_index_update(SOAP_GLOBAL(ref_map), (zend_ulong)node, data); } } @@ -397,23 +397,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype)); } else { zns = NULL; - enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); + enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); } if (enc == NULL && SOAP_GLOBAL(typemap)) { smart_str nscat = {0}; if (zns != NULL) { - smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRSIZE_P(zns)); + smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRLEN_P(zns)); smart_str_appendc(&nscat, ':'); } - smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); + smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); smart_str_0(&nscat); enc = zend_hash_find_ptr(SOAP_GLOBAL(typemap), nscat.s); smart_str_free(&nscat); } } if (enc == NULL) { - enc = get_conversion(Z_IVAL_P(ztype)); + enc = get_conversion(Z_LVAL_P(ztype)); } if (enc == NULL) { enc = encode; @@ -449,7 +449,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) { if (Z_TYPE_P(tmp) == IS_STRING && - ce->name->len == Z_STRSIZE_P(tmp) && + ce->name->len == Z_STRLEN_P(tmp) && zend_binary_strncasecmp(ce->name->val, ce->name->len, Z_STRVAL_P(tmp), ce->name->len, ce->name->len) == 0 && type_name) { @@ -600,7 +600,7 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par soap_error0(E_ERROR, "Encoding: Error calling to_xml callback"); } if (Z_TYPE(return_value) == IS_STRING) { - xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRSIZE(return_value)); + xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRLEN(return_value)); if (doc && doc->children) { ret = xmlDocCopyNode(doc->children, parent->doc, 1); } @@ -789,7 +789,7 @@ static zval *to_zval_hexbin(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); return ret; } - str = STR_ALLOC(strlen((char*)data->children->content) / 2, 0); + str = zend_string_alloc(strlen((char*)data->children->content) / 2, 0); for (i = j = 0; i < str->len; i++) { c = data->children->content[j++]; if (c >= '0' && c <= '9') { @@ -831,15 +831,15 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); - new_len = Z_STRSIZE_P(data); + str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); + new_len = Z_STRLEN_P(data); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); - new_len = Z_STRSIZE(tmp); + str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + new_len = Z_STRLEN(tmp); zval_dtor(&tmp); } @@ -918,19 +918,19 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRSIZE_P(data)); + str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); - STR_RELEASE(str); + zend_string_release(str); } else { zval tmp; ZVAL_DUP(&tmp, data); convert_to_string(&tmp); - str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRSIZE(tmp)); + str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); - STR_RELEASE(str); + zend_string_release(str); zval_dtor(&tmp); } @@ -958,15 +958,15 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo convert_to_string(&tmp); data = &tmp; } - str = (unsigned char *) safe_emalloc(Z_STRSIZE_P(data) * 2, sizeof(char), 1); + str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); - for (i = j = 0; i < Z_STRSIZE_P(data); i++) { + for (i = j = 0; i < Z_STRLEN_P(data); i++) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4]; str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15]; } str[j] = '\0'; - text = xmlNewTextLen(str, Z_STRSIZE_P(data) * 2 * sizeof(char)); + text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char)); xmlAddChild(ret, text); efree(str); if (data == &tmp) { @@ -986,12 +986,12 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML if (data && data->children) { if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) { - php_int_t lval; + zend_long lval; double dval; whiteSpace_collapse(data->children->content); switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_INT: + case IS_LONG: ZVAL_DOUBLE(ret, lval); break; case IS_DOUBLE: @@ -1024,15 +1024,15 @@ static zval *to_zval_long(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_ if (data && data->children) { if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) { - php_int_t lval; + zend_long lval; double dval; whiteSpace_collapse(data->children->content); errno = 0; switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_INT: - ZVAL_INT(ret, lval); + case IS_LONG: + ZVAL_LONG(ret, lval); break; case IS_DOUBLE: ZVAL_DOUBLE(ret, dval); @@ -1066,11 +1066,11 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode zval tmp = *data; zval_copy_ctor(&tmp); - if (Z_TYPE(tmp) != IS_INT) { + if (Z_TYPE(tmp) != IS_LONG) { convert_to_int(&tmp); } convert_to_string(&tmp); - xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); + xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); zval_dtor(&tmp); } @@ -2347,10 +2347,10 @@ iterator_done: } } - smart_str_append_int(&array_size, dims[0]); + smart_str_append_long(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_int(&array_size, dims[i]); + smart_str_append_long(&array_size, dims[i]); } efree(value); @@ -2375,15 +2375,15 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_int(&array_size, dims[0]); + smart_str_append_long(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_int(&array_size, dims[i]); + smart_str_append_long(&array_size, dims[i]); } } else { dims = emalloc(sizeof(int)); *dims = 0; - smart_str_append_int(&array_size, i); + smart_str_append_long(&array_size, i); } } else if (sdl_type && sdl_type->attributes && @@ -2395,10 +2395,10 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_int(&array_size, dims[0]); + smart_str_append_long(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_int(&array_size, dims[i]); + smart_str_append_long(&array_size, dims[i]); } if (sdl_type && sdl_type->elements && @@ -2422,14 +2422,14 @@ iterator_done: enc = elementType->encode; get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type); - smart_str_append_int(&array_size, i); + smart_str_append_long(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } else { enc = get_array_type(xmlParam, data, &array_type TSRMLS_CC); - smart_str_append_int(&array_size, i); + smart_str_append_long(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } @@ -2689,7 +2689,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP { zval *temp_data; zend_string *key_val; - php_uint_t int_val; + zend_ulong int_val; xmlNodePtr xmlParam; xmlNodePtr xparam, item; xmlNodePtr key; @@ -2712,7 +2712,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP xmlNodeSetContent(key, BAD_CAST(key_val->val)); } else { smart_str tmp = {0}; - smart_str_append_int(&tmp, int_val); + smart_str_append_long(&tmp, int_val); smart_str_0(&tmp); if (style == SOAP_ENCODED) { @@ -2765,8 +2765,8 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_D if (Z_TYPE(key) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(ret), Z_STR(key), &value); - } else if (Z_TYPE(key) == IS_INT) { - zend_hash_index_update(Z_ARRVAL_P(ret), Z_IVAL(key), &value); + } else if (Z_TYPE(key) == IS_LONG) { + zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL(key), &value); } else { soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys"); } @@ -2863,7 +2863,7 @@ static zval *guess_zval_convert(zval *ret, encodeTypePtr type, xmlNodePtr data T xmlNsPtr nsptr; object_init_ex(&soapvar, soap_var_class_entry); - add_property_int(&soapvar, "enc_type", enc->details.type); + add_property_long(&soapvar, "enc_type", enc->details.type); Z_DELREF_P(ret); add_property_zval(&soapvar, "enc_value", ret); parse_namespace(type_name, &cptype, &ns); @@ -2896,12 +2896,12 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlAddChild(parent, xmlParam); FIND_ZVAL_NULL(data, xmlParam, style); - if (Z_TYPE_P(data) == IS_INT) { - timestamp = Z_IVAL_P(data); + if (Z_TYPE_P(data) == IS_LONG) { + timestamp = Z_LVAL_P(data); ta = php_localtime_r(×tamp, &tmbuf); /*ta = php_gmtime_r(×tamp, &tmbuf);*/ if (!ta) { - soap_error1(E_ERROR, "Encoding: Invalid timestamp %pd", Z_IVAL_P(data)); + soap_error1(E_ERROR, "Encoding: Invalid timestamp %pd", Z_LVAL_P(data)); } buf = (char *) emalloc(buf_len); @@ -2935,7 +2935,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlNodeSetContent(xmlParam, BAD_CAST(buf)); efree(buf); } else if (Z_TYPE_P(data) == IS_STRING) { - xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); + xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); } if (style == SOAP_ENCODED) { @@ -3043,7 +3043,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP convert_to_string(&tmp); data = &tmp; } - str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); + str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); whiteSpace_collapse(BAD_CAST(str)); start = str; while (start != NULL && *start != '\0') { @@ -3144,13 +3144,13 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP return ret; } if (Z_TYPE_P(data) == IS_STRING) { - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); zval_dtor(&tmp); } @@ -3251,20 +3251,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo if (type) { if (type->restrictions && Z_TYPE_P(data) == IS_STRING) { if (type->restrictions->enumeration) { - if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRSIZE_P(data)+1)) { + if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) { soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data)); } } if (type->restrictions->minLength && - Z_STRSIZE_P(data) < type->restrictions->minLength->value) { + Z_STRLEN_P(data) < type->restrictions->minLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'"); } if (type->restrictions->maxLength && - Z_STRSIZE_P(data) > type->restrictions->maxLength->value) { + Z_STRLEN_P(data) > type->restrictions->maxLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'"); } if (type->restrictions->length && - Z_STRSIZE_P(data) != type->restrictions->length->value) { + Z_STRLEN_P(data) != type->restrictions->length->value) { soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); } } @@ -3426,7 +3426,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) while (1) { smart_str_appendl(&prefix, "ns", 2); - smart_str_append_int(&prefix, num); + smart_str_append_long(&prefix, num); smart_str_0(&prefix); if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.s->val)) == NULL) { break; @@ -3498,7 +3498,7 @@ encodePtr get_conversion(int encode) static int is_map(zval *array) { - php_uint_t index; + zend_ulong index; zend_string *key; int i = 0; @@ -3536,7 +3536,7 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } - cur_type = Z_IVAL_P(ztype); + cur_type = Z_LVAL_P(ztype); if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) { cur_stype = Z_STRVAL_P(ztype); diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 21c62fa356..4a7edb417f 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -40,17 +40,17 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); smart_str_append_const(soap_headers, "Proxy-Authorization: Basic "); smart_str_appendl(soap_headers, (char*)buf->val, buf->len); smart_str_append_const(soap_headers, "\r\n"); - STR_RELEASE(buf); + zend_string_release(buf); smart_str_free(&auth); return 1; } @@ -67,17 +67,17 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string* buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); smart_str_append_const(soap_headers, "Authorization: Basic "); smart_str_appendl(soap_headers, (char*)buf->val, buf->len); smart_str_append_const(soap_headers, "\r\n"); - STR_RELEASE(buf); + zend_string_release(buf); smart_str_free(&auth); return 1; } @@ -95,7 +95,7 @@ void http_context_headers(php_stream_context* context, if (context && (tmp = php_stream_context_get_option(context, "http", "header")) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp)) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) { char *s = Z_STRVAL_P(tmp); char *p; int name_len; @@ -161,7 +161,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph char *host; char *name; char *protocol; - php_int_t namelen; + zend_long namelen; int port; int old_error_reporting; struct timeval tv; @@ -170,17 +170,17 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_INT) { + Z_TYPE_P(proxy_port) == IS_LONG) { host = Z_STRVAL_P(proxy_host); - port = Z_IVAL_P(proxy_port); + port = Z_LVAL_P(proxy_port); *use_proxy = 1; } else { host = phpurl->host; port = phpurl->port; } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) > 0) { - tv.tv_sec = Z_IVAL_P(tmp); + Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) { + tv.tv_sec = Z_LVAL_P(tmp); tv.tv_usec = 0; timeout = &tv; } @@ -191,9 +191,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph /* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */ if (use_ssl && !*use_proxy) { if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { + Z_TYPE_P(tmp) == IS_LONG) { /* uses constants declared in soap.c to determine ssl uri protocol */ - switch (Z_IVAL_P(tmp)) { + switch (Z_LVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: protocol = "tls"; break; @@ -274,8 +274,8 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph proper encrypyion method based on constants defined in soap.c */ int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - switch (Z_IVAL_P(tmp)) { + Z_TYPE_P(tmp) == IS_LONG) { + switch (Z_LVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; break; @@ -347,7 +347,7 @@ int make_http_soap_request(zval *this_ptr, int http_1_1; int http_status; int content_type_xml = 0; - php_int_t redirect_max = 20; + zend_long redirect_max = 20; char *content_encoding; char *http_msg = NULL; zend_bool old_allow_url_fopen; @@ -363,13 +363,13 @@ int make_http_soap_request(zval *this_ptr, request = buf; request_size = buf_size; /* Compress request */ - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { - int level = Z_IVAL_P(tmp) & 0x0f; - int kind = Z_IVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { + int level = Z_LVAL_P(tmp) & 0x0f; + int kind = Z_LVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; if (level > 9) {level = 9;} - if ((Z_IVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { + if ((Z_LVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n"); } if (level > 0) { @@ -379,7 +379,7 @@ int make_http_soap_request(zval *this_ptr, int n; ZVAL_STRINGL(¶ms[0], buf, buf_size); - ZVAL_INT(¶ms[1], level); + ZVAL_LONG(¶ms[1], level); if (kind == SOAP_COMPRESSION_DEFLATE) { n = 2; ZVAL_STRING(&func, "gzcompress"); @@ -388,7 +388,7 @@ int make_http_soap_request(zval *this_ptr, n = 3; ZVAL_STRING(&func, "gzencode"); smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n"); - ZVAL_INT(¶ms[2], 0x1f); + ZVAL_LONG(¶ms[2], 0x1f); } if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && Z_TYPE(retval) == IS_STRING) { @@ -396,7 +396,7 @@ int make_http_soap_request(zval *this_ptr, zval_ptr_dtor(&func); // TODO: free retval ??? request = Z_STRVAL(retval); - request_size = Z_STRSIZE(retval); + request_size = Z_STRLEN(retval); } else { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); @@ -409,8 +409,8 @@ int make_http_soap_request(zval *this_ptr, if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1)) != NULL) { php_stream_from_zval_no_verify(stream,tmp); - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { - use_proxy = Z_IVAL_P(tmp); + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { + use_proxy = Z_LVAL_P(tmp); } } else { stream = NULL; @@ -427,9 +427,9 @@ int make_http_soap_request(zval *this_ptr, if (context && (tmp = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) { - if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), &redirect_max, NULL, 1)) { - if (Z_TYPE_P(tmp) == IS_INT) - redirect_max = Z_IVAL_P(tmp); + if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &redirect_max, NULL, 1)) { + if (Z_TYPE_P(tmp) == IS_LONG) + redirect_max = Z_LVAL_P(tmp); } } @@ -504,7 +504,7 @@ try_again: if (stream) { php_stream_auto_cleanup(stream); add_property_resource(this_ptr, "httpsocket", stream->res); - add_property_int(this_ptr, "_use_proxy", use_proxy); + add_property_long(this_ptr, "_use_proxy", use_proxy); } else { php_url_free(phpurl); if (request != buf) {efree(request);} @@ -566,7 +566,7 @@ try_again: } if (!http_1_1 || ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL && - Z_IVAL_P(tmp) == 0)) { + Z_LVAL_P(tmp) == 0)) { smart_str_append_const(&soap_headers, "\r\n" "Connection: close\r\n"); } else { @@ -575,17 +575,17 @@ try_again: } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRSIZE_P(tmp) > 0) { + if (Z_STRLEN_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (context && (tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRSIZE_P(tmp) > 0) { + if (Z_STRLEN_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (FG(user_agent)) { @@ -615,7 +615,7 @@ try_again: } } smart_str_append_const(&soap_headers,"Content-Length: "); - smart_str_append_int(&soap_headers, request_size); + smart_str_append_long(&soap_headers, request_size); smart_str_append_const(&soap_headers, "\r\n"); /* HTTP Authentication */ @@ -637,38 +637,38 @@ try_again: make_digest(cnonce, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - Z_IVAL_P(tmp)++; - snprintf(nc, sizeof(nc), "%08ld", Z_IVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_LONG) { + Z_LVAL_P(tmp)++; + snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp)); } else { - add_assoc_int(digest, "nc", 1); + add_assoc_long(digest, "nc", 1); strcpy(nc, "00000001"); } PHP_MD5Init(&md5ctx); - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRSIZE_P(login)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRLEN_P(login)); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRSIZE_P(password)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password)); } PHP_MD5Final(hash, &md5ctx); make_digest(HA1, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING && - Z_STRSIZE_P(tmp) == sizeof("md5-sess")-1 && + Z_STRLEN_P(tmp) == sizeof("md5-sess")-1 && stricmp(Z_STRVAL_P(tmp), "md5-sess") == 0) { PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); @@ -692,7 +692,7 @@ try_again: /* if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING && - Z_STRSIZE_PP(tmp) == sizeof("auth-int")-1 && + Z_STRLEN_PP(tmp) == sizeof("auth-int")-1 && stricmp(Z_STRVAL_PP(tmp), "auth-int") == 0) { PHP_MD5Update(&md5ctx, ":", 1); PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN); @@ -706,7 +706,7 @@ try_again: PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && @@ -724,16 +724,16 @@ try_again: make_digest(response, hash); smart_str_append_const(&soap_headers, "Authorization: Digest username=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRSIZE_P(login)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login)); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", realm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", nonce=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } smart_str_append_const(&soap_headers, "\", uri=\""); if (phpurl->path) { @@ -763,12 +763,12 @@ try_again: if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", opaque=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", algorithm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } smart_str_append_const(&soap_headers, "\"\r\n"); } @@ -776,18 +776,18 @@ try_again: zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); smart_str_append_const(&soap_headers, "Authorization: Basic "); smart_str_appendl(&soap_headers, (char*)buf->val, buf->len); smart_str_append_const(&soap_headers, "\r\n"); - STR_RELEASE(buf); + zend_string_release(buf); smart_str_free(&auth); } } @@ -819,13 +819,13 @@ try_again: Z_TYPE_P(value) == IS_STRING) { zval *tmp; if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL || - strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRSIZE_P(tmp)) == 0) && + strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) && ((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL || in_domain(phpurl->host,Z_STRVAL_P(tmp))) && (use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) { smart_str_appendl(&soap_headers, key->val, key->len); smart_str_appendc(&soap_headers, '='); - smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRSIZE_P(value)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRLEN_P(value)); smart_str_appendc(&soap_headers, ';'); } } @@ -841,7 +841,7 @@ try_again: smart_str_append_const(&soap_headers, "\r\n"); smart_str_0(&soap_headers); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_IVAL_P(trace) > 0) { + Z_LVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len); } smart_str_appendl(&soap_headers, request, request_size); @@ -886,7 +886,7 @@ try_again: } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_IVAL_P(trace) > 0) { + Z_LVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size); } @@ -1283,9 +1283,9 @@ try_again: if (http_status >= 400) { int error = 0; - if (Z_STRSIZE_P(return_value) == 0) { + if (Z_STRLEN_P(return_value) == 0) { error = 1; - } else if (Z_STRSIZE_P(return_value) > 0) { + } else if (Z_STRLEN_P(return_value) > 0) { if (!content_type_xml) { char *s = Z_STRVAL_P(return_value); diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index 348fbc007d..12fc31786f 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -236,10 +236,10 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction } add_soap_fault(this_ptr, faultcode, faultstring ? faultstring->val : NULL, faultactor ? faultactor->val : NULL, &details TSRMLS_CC); if (faultstring) { - STR_RELEASE(faultstring); + zend_string_release(faultstring); } if (faultactor) { - STR_RELEASE(faultactor); + zend_string_release(faultactor); } if (Z_REFCOUNTED(details)) { Z_DELREF(details); diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 9145390ca3..2c4c6c9189 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -460,7 +460,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -558,7 +558,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -1931,7 +1931,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -2169,7 +2169,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT zend_hash_move_forward(tmp->attributes); } else { - php_uint_t index; + zend_ulong index; schema_attributegroup_fixup(ctx, tmp_attr, ht); zend_hash_get_current_key(tmp->attributes, NULL, &index, 0); @@ -2268,7 +2268,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) } if (type->attributes) { zend_string *str_key; - php_uint_t index; + zend_ulong index; ZEND_HASH_FOREACH_KEY_PTR(type->attributes, index, str_key, attr) { if (str_key) { diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 6daa8dbafe..456fe59584 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -292,9 +292,9 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC) zval new_header; rest += 2; - ZVAL_STR(&new_header, STR_ALLOC(Z_STRSIZE_P(header) - (rest - s), 0)); + ZVAL_STR(&new_header, zend_string_alloc(Z_STRLEN_P(header) - (rest - s), 0)); memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header)); - memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRSIZE_P(header) - (rest - Z_STRVAL_P(header)) + 1); + memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1); ZVAL_COPY(&ctx->old_header, header); php_stream_context_set_option(ctx->context, "http", "header", &new_header); zval_dtor(&new_header); @@ -1805,7 +1805,7 @@ static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, sm if (enc) { zval *encoder_num; if ((encoder_num = zend_hash_str_find(tmp_encoders, (char*)&enc, sizeof(enc))) != 0) { - WSDL_CACHE_PUT_INT(Z_IVAL_P(encoder_num), out); + WSDL_CACHE_PUT_INT(Z_LVAL_P(encoder_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1818,7 +1818,7 @@ static void sdl_serialize_type_ref(sdlTypePtr type, HashTable *tmp_types, smart_ if (type) { zval *type_num; if ((type_num = zend_hash_str_find(tmp_types, (char*)&type, sizeof(type))) != NULL) { - WSDL_CACHE_PUT_INT(Z_IVAL_P(type_num), out); + WSDL_CACHE_PUT_INT(Z_LVAL_P(type_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1974,7 +1974,7 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) { sdl_serialize_key(key, out); sdl_serialize_type(tmp, tmp_encoders, tmp_types, out); - ZVAL_INT(&zv, i); + ZVAL_LONG(&zv, i); zend_hash_str_add(tmp_elements, (char*)&tmp, sizeof(tmp), &zv); i--; } ZEND_HASH_FOREACH_END(); @@ -2140,7 +2140,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->groups, tmp) { - ZVAL_INT(&zv, type_num); + ZVAL_LONG(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2157,7 +2157,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->types, tmp) { - ZVAL_INT(&zv, type_num); + ZVAL_LONG(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2174,7 +2174,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->elements, tmp) { - ZVAL_INT(&zv, type_num); + ZVAL_LONG(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2191,7 +2191,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->encoders, tmp) { - ZVAL_INT(&zv, encoder_num); + ZVAL_LONG(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&tmp, sizeof(tmp), &zv); ++encoder_num; } ZEND_HASH_FOREACH_END(); @@ -2200,7 +2200,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s while (enc->details.type != END_KNOWN_TYPES) { zval zv; - ZVAL_INT(&zv, encoder_num); + ZVAL_LONG(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), &zv); enc++; ++encoder_num; @@ -2272,7 +2272,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_1(0,out); } - ZVAL_INT(&zv, binding_num); + ZVAL_LONG(&zv, binding_num); zend_hash_str_add(&tmp_bindings, (char*)&tmp, sizeof(tmp), &zv); binding_num++; } ZEND_HASH_FOREACH_END(); @@ -2296,8 +2296,8 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s if (tmp->binding) { binding_num = zend_hash_str_find(&tmp_bindings,(char*)&tmp->binding, sizeof(tmp->binding)); if (binding_num) { - WSDL_CACHE_PUT_INT(Z_IVAL_P(binding_num), out); - if (Z_IVAL_P(binding_num) >= 0) { + WSDL_CACHE_PUT_INT(Z_LVAL_P(binding_num), out); + if (Z_LVAL_P(binding_num) >= 0) { if (tmp->binding->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) { sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)tmp->bindingAttributes; WSDL_CACHE_PUT_1(binding->style, out); @@ -2338,7 +2338,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_INT(0, out); } - ZVAL_INT(&zv, function_num); + ZVAL_LONG(&zv, function_num); zend_hash_str_add(&tmp_functions, (char*)&tmp, sizeof(tmp), &zv); function_num++; } ZEND_HASH_FOREACH_END(); @@ -2358,7 +2358,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->requests, key, tmp) { function_num = zend_hash_str_find(&tmp_functions, (char*)&tmp, sizeof(tmp)); - WSDL_CACHE_PUT_INT(Z_IVAL_P(function_num), out); + WSDL_CACHE_PUT_INT(Z_LVAL_P(function_num), out); sdl_serialize_key(key, out); } ZEND_HASH_FOREACH_END(); } @@ -3151,7 +3151,7 @@ static void delete_psdl(zval *zv) free(Z_PTR_P(zv)); } -sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) +sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC) { char fn[MAXPATHLEN]; sdlPtr sdl = NULL; @@ -3230,7 +3230,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp) > 0) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) { smart_str_appends(&headers, "User-Agent: "); smart_str_appends(&headers, Z_STRVAL_P(tmp)); smart_str_appends(&headers, "\r\n"); @@ -3239,7 +3239,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_INT) { + Z_TYPE_P(proxy_port) == IS_LONG) { zval str_port, str_proxy; smart_str proxy = {0}; ZVAL_DUP(&str_port, proxy_port); @@ -3250,7 +3250,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) smart_str_appends(&proxy,Z_STRVAL(str_port)); smart_str_0(&proxy); zval_dtor(&str_port); - ZVAL_STR(&str_proxy, STR_COPY(proxy.s)); + ZVAL_STR(&str_proxy, zend_string_copy(proxy.s)); smart_str_free(&proxy); if (!context) { @@ -3289,7 +3289,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) } smart_str_0(&headers); - ZVAL_STR(&str_headers, STR_COPY(headers.s)); + ZVAL_STR(&str_headers, zend_string_copy(headers.s)); php_stream_context_set_option(context, "http", "header", &str_headers); smart_str_free(&headers); zval_ptr_dtor(&str_headers); diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h index 56877b5b85..a29e2e9a1a 100644 --- a/ext/soap/php_sdl.h +++ b/ext/soap/php_sdl.h @@ -254,7 +254,7 @@ struct _sdlAttribute { }; -sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC); +sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC); encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const xmlChar *type); encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type); diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h index d311214a20..efa0ac0baf 100644 --- a/ext/soap/php_soap.h +++ b/ext/soap/php_soap.h @@ -171,8 +171,8 @@ ZEND_BEGIN_MODULE_GLOBALS(soap) char cache_mode; char cache_enabled; char* cache_dir; - php_int_t cache_ttl; - php_int_t cache_limit; + zend_long cache_ttl; + zend_long cache_limit; HashTable *mem_cache; xmlCharEncodingHandlerPtr encoding; HashTable *class_map; diff --git a/ext/soap/soap.c b/ext/soap/soap.c index f0bb2f1019..58c0f1e5d1 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -687,103 +687,103 @@ PHP_MINIT_FUNCTION(soap) le_service = zend_register_list_destructors_ex(delete_service_res, NULL, "SOAP service", module_number); le_typemap = zend_register_list_destructors_ex(delete_hashtable_res, NULL, "SOAP table", module_number); - REGISTER_INT_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); /* New SOAP SSL Method Constants */ - REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); old_error_handler = zend_error_cb; zend_error_cb = soap_error_handler; @@ -855,13 +855,13 @@ PHP_METHOD(SoapHeader, SoapHeader) } add_property_bool(this_ptr, "mustUnderstand", must_understand); if (actor == NULL) { - } else if (Z_TYPE_P(actor) == IS_INT && - (Z_IVAL_P(actor) == SOAP_ACTOR_NEXT || - Z_IVAL_P(actor) == SOAP_ACTOR_NONE || - Z_IVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { - add_property_int(this_ptr, "actor", Z_IVAL_P(actor)); - } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRSIZE_P(actor) > 0) { - add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRSIZE_P(actor)); + } else if (Z_TYPE_P(actor) == IS_LONG && + (Z_LVAL_P(actor) == SOAP_ACTOR_NEXT || + Z_LVAL_P(actor) == SOAP_ACTOR_NONE || + Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { + add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); + } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) { + add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor"); } @@ -886,7 +886,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(code) == IS_NULL) { } else if (Z_TYPE_P(code) == IS_STRING) { fault_code = Z_STRVAL_P(code); - fault_code_len = Z_STRSIZE_P(code); + fault_code_len = Z_STRLEN_P(code); } else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) { zval *t_ns, *t_code; @@ -897,7 +897,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { fault_code_ns = Z_STRVAL_P(t_ns); fault_code = Z_STRVAL_P(t_code); - fault_code_len = Z_STRSIZE_P(t_code); + fault_code_len = Z_STRLEN_P(t_code); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code"); return; @@ -957,8 +957,8 @@ PHP_METHOD(SoapFault, __toString) zval_ptr_dtor(&fci.function_name); str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%pd\nStack trace:\n%s", - Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_IVAL_P(line), - Z_STRSIZE(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); + Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line), + Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); zval_ptr_dtor(&trace); @@ -980,10 +980,10 @@ PHP_METHOD(SoapVar, SoapVar) this_ptr = getThis(); if (Z_TYPE_P(type) == IS_NULL) { - add_property_int(this_ptr, "enc_type", UNKNOWN_TYPE); + add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE); } else { - if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_IVAL_P(type))) { - add_property_int(this_ptr, "enc_type", Z_IVAL_P(type)); + if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) { + add_property_long(this_ptr, "enc_type", Z_LVAL_P(type)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type ID"); return; @@ -1121,7 +1121,7 @@ PHP_METHOD(SoapServer, SoapServer) zval *wsdl = NULL, *options = NULL; zend_resource *res; int version = SOAP_1_1; - php_int_t cache_wsdl; + zend_long cache_wsdl; HashTable *typemap_ht = NULL; SOAP_SERVER_BEGIN_CODE(); @@ -1145,9 +1145,9 @@ PHP_METHOD(SoapServer, SoapServer) zval *tmp; if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_INT && - (Z_IVAL_P(tmp) == SOAP_1_1 || Z_IVAL_P(tmp) == SOAP_1_2)) { - version = Z_IVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_LONG && + (Z_LVAL_P(tmp) == SOAP_1_1 || Z_LVAL_P(tmp) == SOAP_1_2)) { + version = Z_LVAL_P(tmp); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'soap_version' option must be SOAP_1_1 or SOAP_1_2"); } @@ -1155,14 +1155,14 @@ PHP_METHOD(SoapServer, SoapServer) if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode"); } if ((tmp = zend_hash_str_find(ht, "actor", sizeof("actor")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && @@ -1190,13 +1190,13 @@ PHP_METHOD(SoapServer, SoapServer) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - service->features = Z_IVAL_P(tmp); + Z_TYPE_P(tmp) == IS_LONG) { + service->features = Z_LVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - cache_wsdl = Z_IVAL_P(tmp); + Z_TYPE_P(tmp) == IS_LONG) { + cache_wsdl = Z_LVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "send_errors", sizeof("send_errors")-1)) != NULL) { @@ -1204,8 +1204,8 @@ PHP_METHOD(SoapServer, SoapServer) service->send_errors = 0; } else if (Z_TYPE_P(tmp) == IS_TRUE) { service->send_errors = 1; - } else if (Z_TYPE_P(tmp) == IS_INT) { - service->send_errors = Z_IVAL_P(tmp); + } else if (Z_TYPE_P(tmp) == IS_LONG) { + service->send_errors = Z_LVAL_P(tmp); } } @@ -1248,13 +1248,13 @@ PHP_METHOD(SoapServer, SoapServer) PHP_METHOD(SoapServer, setPersistence) { soapServicePtr service; - php_int_t value; + zend_long value; SOAP_SERVER_BEGIN_CODE(); FETCH_THIS_SERVICE(service); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) != FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE) { if (service->type == SOAP_CLASS) { if (value == SOAP_PERSISTENCE_SESSION || value == SOAP_PERSISTENCE_REQUEST) { @@ -1367,7 +1367,7 @@ PHP_METHOD(SoapServer, getFunctions) zval *name; ZEND_HASH_FOREACH_VAL(service->soap_functions.ft, name) { - add_next_index_str(return_value, STR_COPY(Z_STR_P(name))); + add_next_index_str(return_value, zend_string_copy(Z_STR_P(name))); } ZEND_HASH_FOREACH_END(); } if (ft != NULL) { @@ -1375,7 +1375,7 @@ PHP_METHOD(SoapServer, getFunctions) ZEND_HASH_FOREACH_PTR(ft, f) { if ((service->type != SOAP_OBJECT && service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) { - add_next_index_str(return_value, STR_COPY(f->common.function_name)); + add_next_index_str(return_value, zend_string_copy(f->common.function_name)); } } ZEND_HASH_FOREACH_END(); } @@ -1421,26 +1421,26 @@ PHP_METHOD(SoapServer, addFunction) return; } - key = STR_ALLOC(Z_STRSIZE_P(tmp_function), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRSIZE_P(tmp_function)); + key = zend_string_alloc(Z_STRLEN_P(tmp_function), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function)); return; } - ZVAL_STR(&function_copy, STR_COPY(f->common.function_name)); + ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name)); zend_hash_update(service->soap_functions.ft, key, &function_copy); - STR_RELEASE(key); + zend_string_release(key); } ZEND_HASH_FOREACH_END(); } } else if (Z_TYPE_P(function_name) == IS_STRING) { zend_string *key; zend_function *f; - key = STR_ALLOC(Z_STRSIZE_P(function_name), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); + key = zend_string_alloc(Z_STRLEN_P(function_name), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); @@ -1452,11 +1452,11 @@ PHP_METHOD(SoapServer, addFunction) zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0); } - ZVAL_STR(&function_copy, STR_COPY(f->common.function_name)); + ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name)); zend_hash_update(service->soap_functions.ft, key, &function_copy); - STR_RELEASE(key); - } else if (Z_TYPE_P(function_name) == IS_INT) { - if (Z_IVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { + zend_string_release(key); + } else if (Z_TYPE_P(function_name) == IS_LONG) { + if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { if (service->soap_functions.ft != NULL) { zend_hash_destroy(service->soap_functions.ft); efree(service->soap_functions.ft); @@ -1558,7 +1558,7 @@ PHP_METHOD(SoapServer, handle) if (SG(request_info).request_body && 0 == php_stream_rewind(SG(request_info).request_body)) { zval *server_vars, *encoding; php_stream_filter *zf = NULL; - zend_string *server = STR_INIT("_SERVER", sizeof("_SERVER")-1, 0); + zend_string *server = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0); zend_is_auto_global(server TSRMLS_CC); if ((server_vars = zend_hash_find(&EG(symbol_table).ht, server)) != NULL && @@ -1573,7 +1573,7 @@ PHP_METHOD(SoapServer, handle) zval filter_params; array_init_size(&filter_params, 1); - add_assoc_int_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ + add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC); zval_dtor(&filter_params); @@ -1582,16 +1582,16 @@ PHP_METHOD(SoapServer, handle) php_stream_filter_append(&SG(request_info).request_body->readfilters, zf); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request"); - STR_RELEASE(server); + zend_string_release(server); return; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_P(encoding)); - STR_RELEASE(server); + zend_string_release(server); return; } } - STR_RELEASE(server); + zend_string_release(server); doc_request = soap_xmlParseFile("php://input" TSRMLS_CC); @@ -1713,7 +1713,7 @@ PHP_METHOD(SoapServer, handle) if (zend_hash_str_exists(&Z_OBJCE(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len)) { zval c_ret, constructor; - ZVAL_STR(&constructor, STR_COPY(service->soap_class.ce->name)); + ZVAL_STR(&constructor, zend_string_copy(service->soap_class.ce->name)); if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor"); } @@ -1786,8 +1786,8 @@ PHP_METHOD(SoapServer, handle) } } #endif - fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRSIZE(h->function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(h->function_name)), Z_STRSIZE(h->function_name)) || + fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1839,8 +1839,8 @@ PHP_METHOD(SoapServer, handle) } } - fn_name = estrndup(Z_STRVAL(function_name),Z_STRSIZE(function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(function_name)), Z_STRSIZE(function_name)) || + fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1897,9 +1897,9 @@ PHP_METHOD(SoapServer, handle) if (function && function->responseName) { response_name = estrdup(function->responseName); } else { - response_name = emalloc(Z_STRSIZE(function_name) + sizeof("Response")); - memcpy(response_name,Z_STRVAL(function_name),Z_STRSIZE(function_name)); - memcpy(response_name+Z_STRSIZE(function_name),"Response",sizeof("Response")); + response_name = emalloc(Z_STRLEN(function_name) + sizeof("Response")); + memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name)); + memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response")); } doc_return = serialize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC); efree(response_name); @@ -1947,7 +1947,7 @@ PHP_METHOD(SoapServer, handle) xmlFreeDoc(doc_return); - if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2079,7 +2079,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade xmlDocDumpMemory(doc_return, &buf, &size); - server = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0); + server = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0); zend_is_auto_global(server TSRMLS_CC); if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF && (agent_name = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) != NULL && @@ -2088,7 +2088,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade use_http_error_status = 0; } } - STR_RELEASE(server); + zend_string_release(server); /* Want to return HTTP 500 but apache wants to over write our fault code with their own handling... Figure this out later @@ -2096,7 +2096,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade if (use_http_error_status) { sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1); } - if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2265,7 +2265,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const } /* Get output buffer and send as fault detials */ - if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_IVAL(outbuflen) != 0) { + if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) { php_output_get_contents(&outbuf TSRMLS_CC); } php_output_discard(TSRMLS_C); @@ -2330,7 +2330,7 @@ PHP_METHOD(SoapClient, SoapClient) zval *wsdl, *options = NULL; int soap_version = SOAP_1_1; php_stream_context *context = NULL; - php_int_t cache_wsdl; + zend_long cache_wsdl; sdlPtr sdl = NULL; HashTable *typemap_ht = NULL; zval *this_ptr = getThis(); @@ -2355,21 +2355,21 @@ PHP_METHOD(SoapClient, SoapClient) /* Fetching non-WSDL mode options */ if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "uri", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "uri", zend_string_copy(Z_STR_P(tmp))); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode"); } if ((tmp = zend_hash_str_find(ht, "style", sizeof("style")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT && - (Z_IVAL_P(tmp) == SOAP_RPC || Z_IVAL_P(tmp) == SOAP_DOCUMENT)) { - add_property_int(this_ptr, "style", Z_IVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_LONG && + (Z_LVAL_P(tmp) == SOAP_RPC || Z_LVAL_P(tmp) == SOAP_DOCUMENT)) { + add_property_long(this_ptr, "style", Z_LVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "use", sizeof("use")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT && - (Z_IVAL_P(tmp) == SOAP_LITERAL || Z_IVAL_P(tmp) == SOAP_ENCODED)) { - add_property_int(this_ptr, "use", Z_IVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_LONG && + (Z_LVAL_P(tmp) == SOAP_LITERAL || Z_LVAL_P(tmp) == SOAP_ENCODED)) { + add_property_long(this_ptr, "use", Z_LVAL_P(tmp)); } } @@ -2381,46 +2381,46 @@ PHP_METHOD(SoapClient, SoapClient) if ((tmp = zend_hash_str_find(ht, "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "location", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "location", zend_string_copy(Z_STR_P(tmp))); } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is required in nonWSDL mode"); } if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_INT || - (Z_IVAL_P(tmp) == SOAP_1_1 && Z_IVAL_P(tmp) == SOAP_1_2)) { - soap_version = Z_IVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_LONG || + (Z_LVAL_P(tmp) == SOAP_1_1 && Z_LVAL_P(tmp) == SOAP_1_2)) { + soap_version = Z_LVAL_P(tmp); } } if ((tmp = zend_hash_str_find(ht, "login", sizeof("login")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_login", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_login", zend_string_copy(Z_STR_P(tmp))); if ((tmp = zend_hash_str_find(ht, "password", sizeof("password")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_password", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_password", zend_string_copy(Z_STR_P(tmp))); } if ((tmp = zend_hash_str_find(ht, "authentication", sizeof("authentication")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT && - Z_IVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { + Z_TYPE_P(tmp) == IS_LONG && + Z_LVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { add_property_null(this_ptr, "_digest"); } } if ((tmp = zend_hash_str_find(ht, "proxy_host", sizeof("proxy_host")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_proxy_host", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_proxy_host", zend_string_copy(Z_STR_P(tmp))); if ((tmp = zend_hash_str_find(ht, "proxy_port", sizeof("proxy_port")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { - ZVAL_INT(&tmp2, zval_get_int(tmp)); + if (Z_TYPE_P(tmp) != IS_LONG) { + ZVAL_LONG(&tmp2, zval_get_long(tmp)); tmp = &tmp2; } - add_property_int(this_ptr, "_proxy_port", Z_IVAL_P(tmp)); + add_property_long(this_ptr, "_proxy_port", Z_LVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "proxy_login", sizeof("proxy_login")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_proxy_login", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_proxy_login", zend_string_copy(Z_STR_P(tmp))); if ((tmp = zend_hash_str_find(ht, "proxy_password", sizeof("proxy_password")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_proxy_password", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_proxy_password", zend_string_copy(Z_STR_P(tmp))); } } } @@ -2437,24 +2437,24 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL && (Z_TYPE_P(tmp) == IS_TRUE || - (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 1))) { - add_property_int(this_ptr, "trace", 1); + (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) { + add_property_long(this_ptr, "trace", 1); } if ((tmp = zend_hash_str_find(ht, "exceptions", sizeof("exceptions")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { + (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { add_property_bool(this_ptr, "_exceptions", 0); } if ((tmp = zend_hash_str_find(ht, "compression", sizeof("compression")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT && + Z_TYPE_P(tmp) == IS_LONG && zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1) && zend_hash_str_exists(EG(function_table), "gzdeflate", sizeof("gzdeflate")-1) && zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1) && zend_hash_str_exists(EG(function_table), "gzcompress", sizeof("gzcompress")-1) && zend_hash_str_exists(EG(function_table), "gzencode", sizeof("gzencode")-1)) { - add_property_int(this_ptr, "compression", Z_IVAL_P(tmp)); + add_property_long(this_ptr, "compression", Z_LVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2465,7 +2465,7 @@ PHP_METHOD(SoapClient, SoapClient) php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_P(tmp)); } else { xmlCharEncCloseFunc(encoding); - add_property_str(this_ptr, "_encoding", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_encoding", zend_string_copy(Z_STR_P(tmp))); } } if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL && @@ -2486,17 +2486,17 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - add_property_int(this_ptr, "_features", Z_IVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_LONG) { + add_property_long(this_ptr, "_features", Z_LVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "connection_timeout", sizeof("connection_timeout")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_INT) { - ZVAL_INT(&tmp2, zval_get_int(tmp)); + if (Z_TYPE_P(tmp) != IS_LONG) { + ZVAL_LONG(&tmp2, zval_get_long(tmp)); tmp = &tmp2; } - if (Z_IVAL_P(tmp) > 0) { - add_property_int(this_ptr, "_connection_timeout", Z_IVAL_P(tmp)); + if (Z_LVAL_P(tmp) > 0) { + add_property_long(this_ptr, "_connection_timeout", Z_LVAL_P(tmp)); } } @@ -2505,30 +2505,30 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - cache_wsdl = Z_IVAL_P(tmp); + Z_TYPE_P(tmp) == IS_LONG) { + cache_wsdl = Z_LVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "user_agent", sizeof("user_agent")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - add_property_str(this_ptr, "_user_agent", STR_COPY(Z_STR_P(tmp))); + add_property_str(this_ptr, "_user_agent", zend_string_copy(Z_STR_P(tmp))); } if ((tmp = zend_hash_str_find(ht, "keep_alive", sizeof("keep_alive")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { - add_property_int(this_ptr, "_keep_alive", 0); + (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { + add_property_long(this_ptr, "_keep_alive", 0); } if ((tmp = zend_hash_str_find(ht, "ssl_method", sizeof("ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - add_property_int(this_ptr, "_ssl_method", Z_IVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_LONG) { + add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp)); } } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode"); } - add_property_int(this_ptr, "_soap_version", soap_version); + add_property_long(this_ptr, "_soap_version", soap_version); if (Z_TYPE_P(wsdl) != IS_NULL) { int old_soap_version; @@ -2577,7 +2577,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_IVAL_P(trace) > 0) { + Z_LVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request", buf, buf_size); } @@ -2593,8 +2593,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } else { ZVAL_STRING(¶ms[2], action); } - ZVAL_INT(¶ms[3], version); - ZVAL_INT(¶ms[4], one_way); + ZVAL_LONG(¶ms[3], version); + ZVAL_LONG(¶ms[4], one_way); if (call_user_function(NULL, this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) { add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC); @@ -2605,8 +2605,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } ret = FALSE; } else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_IVAL_P(trace) > 0) { - add_property_str(this_ptr, "__last_response", STR_COPY(Z_STR_P(response))); + Z_LVAL_P(trace) > 0) { + add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response))); } zval_ptr_dtor(&func); zval_ptr_dtor(¶ms[4]); @@ -2651,12 +2651,12 @@ static void do_soap_call(zval* this_ptr, SOAP_CLIENT_BEGIN_CODE(); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL - && Z_IVAL_P(trace) > 0) { + && Z_LVAL_P(trace) > 0) { zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1); } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL - && Z_IVAL_P(tmp) == SOAP_1_2) { + && Z_LVAL_P(tmp) == SOAP_1_2) { soap_version = SOAP_1_2; } else { soap_version = SOAP_1_1; @@ -2699,8 +2699,8 @@ static void do_soap_call(zval* this_ptr, SOAP_GLOBAL(typemap) = typemap; old_features = SOAP_GLOBAL(features); if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_INT) { - SOAP_GLOBAL(features) = Z_IVAL_P(tmp); + Z_TYPE_P(tmp) == IS_LONG) { + SOAP_GLOBAL(features) = Z_LVAL_P(tmp); } else { SOAP_GLOBAL(features) = 0; } @@ -2734,7 +2734,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -2779,7 +2779,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -3015,7 +3015,7 @@ PHP_METHOD(SoapClient, __getLastRequest) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL) { - RETURN_STR(STR_COPY(Z_STR_P(tmp))); + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@ -3033,7 +3033,7 @@ PHP_METHOD(SoapClient, __getLastResponse) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL) { - RETURN_STR(STR_COPY(Z_STR_P(tmp))); + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@ -3051,7 +3051,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL) { - RETURN_STR(STR_COPY(Z_STR_P(tmp))); + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@ -3069,7 +3069,7 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL) { - RETURN_STR(STR_COPY(Z_STR_P(tmp))); + RETURN_STR(zend_string_copy(Z_STR_P(tmp))); } RETURN_NULL(); } @@ -3082,11 +3082,11 @@ PHP_METHOD(SoapClient, __doRequest) { char *buf, *location, *action; int buf_size, location_size, action_size; - php_int_t version; - php_int_t one_way = 0; + zend_long version; + zend_long one_way = 0; zval *this_ptr = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|l", &buf, &buf_size, &location, &location_size, &action, &action_size, @@ -3223,7 +3223,7 @@ PHP_METHOD(SoapClient, __setLocation) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - RETVAL_STR(STR_COPY(Z_STR_P(tmp))); + RETVAL_STR(zend_string_copy(Z_STR_P(tmp))); } else { RETVAL_NULL(); } @@ -3643,7 +3643,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c smart_str_appends(&key, (char*)hdr_func->ns->href); smart_str_appendc(&key, ':'); } - smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRSIZE(h->function_name)); + smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRLEN(h->function_name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(fnb->input.headers, key.s)) != NULL) { h->hdr = hdr; @@ -3711,17 +3711,17 @@ static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version) } else { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_P(tmp))); } - } else if (Z_TYPE_P(tmp) == IS_INT) { + } else if (Z_TYPE_P(tmp) == IS_LONG) { if (version == SOAP_1_1) { - if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT)); } } else { - if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT)); - } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_NONE) { + } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_NONE) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE)); - } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { + } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); } } @@ -3801,7 +3801,7 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch int i = 0; zend_string *param_name; //??? - php_uint_t param_index = i; + zend_ulong param_index = i; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(ret), param_index, param_name, data) { parameter = get_param(function, param_name->val, param_index, TRUE); @@ -3885,13 +3885,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -3978,7 +3978,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if (version == SOAP_1_1) { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode")); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); xmlAddChild(param, node); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -3988,7 +3988,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len); } - STR_RELEASE(str); + zend_string_release(str); } if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) { xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), tmp, SOAP_LITERAL, param TSRMLS_CC); @@ -4002,7 +4002,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -4012,7 +4012,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { xmlNodeSetContentLen(node, BAD_CAST(str->val), (int)str->len); } - STR_RELEASE(str); + zend_string_release(str); } if ((tmp = zend_hash_str_find(prop, "faultstring", sizeof("faultstring")-1)) != NULL) { xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Reason"), NULL); @@ -4101,13 +4101,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function ht = Z_OBJPROP(h->retval); if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -4239,7 +4239,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } } else { if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) { - style = Z_IVAL_P(zstyle); + style = Z_LVAL_P(zstyle); } else { style = SOAP_RPC; } @@ -4261,7 +4261,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL && - Z_IVAL_P(zuse) == SOAP_LITERAL) { + Z_LVAL_P(zuse) == SOAP_LITERAL) { use = SOAP_LITERAL; } else { use = SOAP_ENCODED; @@ -4330,9 +4330,9 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function smart_str key = {0}; sdlSoapBindingFunctionHeaderPtr hdr; - smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); + smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRLEN_P(ns)); smart_str_appendc(&key, ':'); - smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRLEN_P(name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) { hdr_use = hdr->use; diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 35cc544e1a..69ea21f9df 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -303,21 +303,21 @@ static void to_zval_read_aggregation(const char *structure, } /* CONVERSIONS for integers */ -static php_int_t from_zval_integer_common(const zval *arr_value, ser_context *ctx) +static zend_long from_zval_integer_common(const zval *arr_value, ser_context *ctx) { - php_int_t ret = 0; + zend_long ret = 0; zval lzval; ZVAL_NULL(&lzval); - if (Z_TYPE_P(arr_value) != IS_INT) { + if (Z_TYPE_P(arr_value) != IS_LONG) { ZVAL_COPY(&lzval, arr_value); arr_value = &lzval; } switch (Z_TYPE_P(arr_value)) { - case IS_INT: + case IS_LONG: long_case: - ret = Z_IVAL_P(arr_value); + ret = Z_LVAL_P(arr_value); break; /* if not long we're operating on lzval */ @@ -328,20 +328,20 @@ double_case: case IS_OBJECT: case IS_STRING: { - php_int_t lval; + zend_long lval; double dval; convert_to_string(&lzval); - switch (is_numeric_string(Z_STRVAL(lzval), Z_STRSIZE(lzval), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL(lzval), Z_STRLEN(lzval), &lval, &dval, 0)) { case IS_DOUBLE: zval_dtor(&lzval); ZVAL_DOUBLE(&lzval, dval); goto double_case; - case IS_INT: + case IS_LONG: zval_dtor(&lzval); - ZVAL_INT(&lzval, lval); + ZVAL_LONG(&lzval, lval); goto long_case; } @@ -363,7 +363,7 @@ double_case: } void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; int ival; lval = from_zval_integer_common(arr_value, ctx); @@ -382,7 +382,7 @@ void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) } static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; uint32_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -401,7 +401,7 @@ static void from_zval_write_uint32(const zval *arr_value, char *field, ser_conte } static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; uint16_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -420,7 +420,7 @@ static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_c } static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; sa_family_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -439,7 +439,7 @@ static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_co } static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; pid_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -458,7 +458,7 @@ static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_contex } static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx) { - php_int_t lval; + zend_long lval; uid_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -490,49 +490,49 @@ void to_zval_read_int(const char *data, zval *zv, res_context *ctx) int ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) { unsigned ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) { uint16_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ntohs(ival)); + ZVAL_LONG(zv, (long)ntohs(ival)); } static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) { uint32_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) { sa_family_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) { pid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) { uid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_INT(zv, (long)ival); + ZVAL_LONG(zv, (long)ival); } /* CONVERSIONS for sockaddr */ @@ -565,7 +565,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) { const struct in_addr *addr = (const struct in_addr *)data; socklen_t size = INET_ADDRSTRLEN; - zend_string *str = STR_ALLOC(size - 1, 0); + zend_string *str = zend_string_alloc(size - 1, 0); memset(str->val, '\0', size); ZVAL_STR(zv, str); @@ -576,7 +576,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in, sin_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -623,7 +623,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) { const struct in6_addr *addr = (const struct in6_addr *)data; socklen_t size = INET6_ADDRSTRLEN; - zend_string *str = STR_ALLOC(size - 1, 0); + zend_string *str = zend_string_alloc(size - 1, 0); memset(str->val, '\0', size); @@ -635,7 +635,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in6[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in6, sin6_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -669,18 +669,18 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ /* code in this file relies on the path being nul terminated, even though * this is not required, at least on linux for abstract paths. It also * assumes that the path is not empty */ - if (Z_STRSIZE_P(path) == 0) { + if (Z_STRLEN_P(path) == 0) { do_from_zval_err(ctx, "%s", "the path is cannot be empty"); return; } - if (Z_STRSIZE_P(path) >= sizeof(saddr->sun_path)) { + if (Z_STRLEN_P(path) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " "length is %ld", sizeof(saddr->sun_path) - 1); return; } - memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRSIZE_P(path)); - saddr->sun_path[Z_STRSIZE_P(path)] = '\0'; + memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRLEN_P(path)); + saddr->sun_path[Z_STRLEN_P(path)] = '\0'; zval_dtor(&lzval); } @@ -985,7 +985,7 @@ static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context if (CMSG_LEN(entry->size) > cmsg->cmsg_len) { do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " "expected a length of at least %pd, but got %pd", - (php_int_t)CMSG_LEN(entry->size), (php_int_t)cmsg->cmsg_len); + (zend_long)CMSG_LEN(entry->size), (zend_long)cmsg->cmsg_len); return; } @@ -1072,7 +1072,7 @@ static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx } static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, ser_context *ctx) { - php_int_t lval; + zend_long lval; struct msghdr *msghdr = (struct msghdr *)msghdr_c; lval = from_zval_integer_common(elem, ctx); @@ -1082,7 +1082,7 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, if (lval < 0 || lval > MAX_USER_BUFF_SIZE) { do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; " - "given %pd", (php_int_t)MAX_USER_BUFF_SIZE, lval); + "given %pd", (zend_long)MAX_USER_BUFF_SIZE, lval); return; } @@ -1101,7 +1101,7 @@ static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, s } convert_to_string_ex(elem); - len = Z_STRSIZE_P(elem); + len = Z_STRLEN_P(elem); msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx); msg->msg_iov[i - 1].iov_len = len; memcpy(msg->msg_iov[i - 1].iov_base, Z_STRVAL_P(elem), len); @@ -1224,7 +1224,7 @@ static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx) for (i = 0; bytes_left > 0 && i < (uint)iovlen; i++) { zval elem; size_t len = MIN(msghdr->msg_iov[i].iov_len, (size_t)bytes_left); - zend_string *buf = STR_ALLOC(len, 0); + zend_string *buf = zend_string_alloc(len, 0); memcpy(buf->val, msghdr->msg_iov[i].iov_base, buf->len); buf->val[buf->len] = '\0'; @@ -1257,12 +1257,12 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context ZVAL_NULL(&lzval); - if (Z_TYPE_P(zv) == IS_INT) { - if (Z_IVAL_P(zv) < 0 || Z_IVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ + if (Z_TYPE_P(zv) == IS_LONG) { + if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ do_from_zval_err(ctx, "the interface index cannot be negative or " - "larger than %u; given %pd", UINT_MAX, Z_IVAL_P(zv)); + "larger than %u; given %pd", UINT_MAX, Z_LVAL_P(zv)); } else { - ret = (unsigned)Z_IVAL_P(zv); + ret = (unsigned)Z_LVAL_P(zv); } } else { if (Z_TYPE_P(zv) != IS_STRING) { @@ -1431,7 +1431,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) if (*cmsg_len < data_offset) { do_to_zval_err(ctx, "length of cmsg is smaller than its data member " - "offset (%pd vs %pd)", (php_int_t)*cmsg_len, (php_int_t)data_offset); + "offset (%pd vs %pd)", (zend_long)*cmsg_len, (zend_long)data_offset); return; } num_elems = (*cmsg_len - data_offset) / sizeof(int); diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 9188825e53..4834bb39e0 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -89,14 +89,14 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC) { int ret; - if (Z_TYPE_P(val) == IS_INT) { - if (Z_IVAL_P(val) < 0 || Z_IVAL_P(val) > UINT_MAX) { + if (Z_TYPE_P(val) == IS_LONG) { + if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "the interface index cannot be negative or larger than %u;" - " given %pd", UINT_MAX, Z_IVAL_P(val)); + " given %pd", UINT_MAX, Z_LVAL_P(val)); ret = FAILURE; } else { - *out = Z_IVAL_P(val); + *out = Z_LVAL_P(val); ret = SUCCESS; } } else { @@ -289,12 +289,12 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock, case IP_MULTICAST_TTL: convert_to_int_ex(arg4); - if (Z_IVAL_P(arg4) < 0L || Z_IVAL_P(arg4) > 255L) { + if (Z_LVAL_P(arg4) < 0L || Z_LVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between 0 and 255"); return FAILURE; } - ipv4_mcast_ttl_lback = (unsigned char) Z_IVAL_P(arg4); + ipv4_mcast_ttl_lback = (unsigned char) Z_LVAL_P(arg4); ipv4_loop_ttl: opt_ptr = &ipv4_mcast_ttl_lback; optlen = sizeof(ipv4_mcast_ttl_lback); @@ -354,12 +354,12 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock, goto ipv6_loop_hops; case IPV6_MULTICAST_HOPS: convert_to_int_ex(arg4); - if (Z_IVAL_P(arg4) < -1L || Z_IVAL_P(arg4) > 255L) { + if (Z_LVAL_P(arg4) < -1L || Z_LVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between -1 and 255"); return FAILURE; } - ov = (int) Z_IVAL_P(arg4); + ov = (int) Z_LVAL_P(arg4); ipv6_loop_hops: opt_ptr = &ov; optlen = sizeof(ov); diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index dc45cb7842..24e636b0ef 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -167,7 +167,7 @@ PHP_FUNCTION(socket_sendmsg) { zval *zsocket, *zmsg; - php_int_t flags = 0; + zend_long flags = 0; php_socket *php_sock; struct msghdr *msghdr; zend_llist *allocations; @@ -175,7 +175,7 @@ PHP_FUNCTION(socket_sendmsg) ssize_t res; /* zmsg should be passed by ref */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|i", &zsocket, &zmsg, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|l", &zsocket, &zmsg, &flags) == FAILURE) { return; } @@ -198,7 +198,7 @@ PHP_FUNCTION(socket_sendmsg) zend_llist_destroy(allocations); efree(allocations); - RETURN_INT((long)res); + RETURN_LONG((long)res); } else { PHP_SOCKET_ERROR(php_sock, "error in sendmsg", errno); RETURN_FALSE; @@ -209,7 +209,7 @@ PHP_FUNCTION(socket_recvmsg) { zval *zsocket, *zmsg; - php_int_t flags = 0; + zend_long flags = 0; php_socket *php_sock; ssize_t res; struct msghdr *msghdr; @@ -217,7 +217,7 @@ PHP_FUNCTION(socket_recvmsg) struct err_s err = {0}; //ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|l", &zsocket, &zmsg, &flags) == FAILURE) { return; } @@ -268,17 +268,17 @@ PHP_FUNCTION(socket_recvmsg) RETURN_FALSE; } - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } PHP_FUNCTION(socket_cmsg_space) { - php_int_t level, + zend_long level, type, n = 0; ancillary_reg_entry *entry; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|l", &level, &type, &n) == FAILURE) { return; } @@ -300,15 +300,15 @@ PHP_FUNCTION(socket_cmsg_space) return; } - if (entry->var_el_size > 0 && n > (PHP_INT_MAX - (php_int_t)entry->size - - (php_int_t)CMSG_SPACE(0) - 15L) / entry->var_el_size) { + if (entry->var_el_size > 0 && n > (PHP_INT_MAX - (zend_long)entry->size - + (zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) { /* the -15 is to account for any padding CMSG_SPACE may add after the data */ php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value for the " "third argument (%pd) is too large", n); return; } - RETURN_INT((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); + RETURN_LONG((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); } #if HAVE_IPV6 @@ -409,35 +409,35 @@ void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS) { /* IPv6 ancillary data */ #if defined(IPV6_RECVPKTINFO) && HAVE_IPV6 - REGISTER_INT_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); #endif #if defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6 - REGISTER_INT_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); #endif /* would require some effort: - REGISTER_INT_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); */ #if defined(IPV6_RECVTCLASS) && HAVE_IPV6 - REGISTER_INT_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); #endif /* - REGISTER_INT_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); */ #ifdef SCM_RIGHTS - REGISTER_INT_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); #endif #ifdef SO_PASSCRED - REGISTER_INT_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ZTS diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index f563941396..f9de9f1361 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -61,11 +61,11 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ } if (scope++) { - php_int_t lval = 0; + zend_long lval = 0; double dval = 0; unsigned scope_id = 0; - if (IS_INT == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { + if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { if (lval > 0 && lval <= UINT_MAX) { scope_id = lval; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 5ea62bbd10..e8e03ae0e3 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -611,100 +611,100 @@ static PHP_MINIT_FUNCTION(sockets) { le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number); - REGISTER_INT_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_INT_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_INT_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); #ifdef MSG_EOR - REGISTER_INT_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_EOF - REGISTER_INT_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CONFIRM - REGISTER_INT_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_ERRQUEUE - REGISTER_INT_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_NOSIGNAL - REGISTER_INT_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_DONTWAIT - REGISTER_INT_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_MORE - REGISTER_INT_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_WAITFORONE - REGISTER_INT_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CMSG_CLOEXEC - REGISTER_INT_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); #ifdef SO_REUSEPORT - REGISTER_INT_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_INT_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); #ifdef SO_FAMILY - REGISTER_INT_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); #ifdef SO_BINDTODEVICE - REGISTER_INT_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); #ifdef TCP_NODELAY - REGISTER_INT_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); #ifdef HAS_MCAST_EXT - REGISTER_INT_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_INT_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #endif #ifndef WIN32 @@ -713,16 +713,16 @@ static PHP_MINIT_FUNCTION(sockets) # include "win32_socket_constants.h" #endif - REGISTER_INT_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_INT_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_INT_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); #endif php_socket_sendrecvmsg_init(INIT_FUNC_ARGS_PASSTHRU); @@ -793,7 +793,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) / php_socket *php_sock; zval new_hash; int num = 0; - php_uint_t num_key; + zend_ulong num_key; zend_string *key; if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; @@ -836,9 +836,9 @@ PHP_FUNCTION(socket_select) fd_set rfds, wfds, efds; PHP_SOCKET max_fd = 0; int retval, sets = 0; - php_int_t usec = 0; + zend_long usec = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) { return; } @@ -861,7 +861,7 @@ PHP_FUNCTION(socket_select) if (sec != NULL) { zval tmp; - if (Z_TYPE_P(sec) != IS_INT) { + if (Z_TYPE_P(sec) != IS_LONG) { tmp = *sec; zval_copy_ctor(&tmp); convert_to_int(&tmp); @@ -870,10 +870,10 @@ PHP_FUNCTION(socket_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_IVAL_P(sec); + tv.tv_sec = Z_LVAL_P(sec); tv.tv_usec = usec; } @@ -896,7 +896,7 @@ PHP_FUNCTION(socket_select) if (w_array != NULL) php_sock_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) php_sock_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -905,9 +905,9 @@ PHP_FUNCTION(socket_select) PHP_FUNCTION(socket_create_listen) { php_socket *php_sock; - php_int_t port, backlog = 128; + zend_long port, backlog = 128; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &port, &backlog) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port, &backlog) == FAILURE) { return; } @@ -1027,9 +1027,9 @@ PHP_FUNCTION(socket_listen) { zval *arg1; php_socket *php_sock; - php_int_t backlog = 0; + zend_long backlog = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &backlog) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &backlog) == FAILURE) { return; } @@ -1076,10 +1076,10 @@ PHP_FUNCTION(socket_write) zval *arg1; php_socket *php_sock; int retval, str_len; - php_int_t length = 0; + zend_long length = 0; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE) { return; } @@ -1100,7 +1100,7 @@ PHP_FUNCTION(socket_write) RETURN_FALSE; } - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -1112,9 +1112,9 @@ PHP_FUNCTION(socket_read) php_socket *php_sock; zend_string *tmpbuf; int retval; - php_int_t length, type = PHP_BINARY_READ; + zend_long length, type = PHP_BINARY_READ; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &length, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE) { return; } @@ -1123,7 +1123,7 @@ PHP_FUNCTION(socket_read) RETURN_FALSE; } - tmpbuf = STR_ALLOC(length, 0); + tmpbuf = zend_string_alloc(length, 0); ZEND_FETCH_RESOURCE(php_sock, php_socket *, arg1, -1, le_socket_name, le_socket); @@ -1147,14 +1147,14 @@ PHP_FUNCTION(socket_read) PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno); } - STR_FREE(tmpbuf); + zend_string_free(tmpbuf); RETURN_FALSE; } else if (!retval) { - STR_FREE(tmpbuf); + zend_string_free(tmpbuf); RETURN_EMPTY_STRING(); } - tmpbuf = STR_REALLOC(tmpbuf, retval, 0); + tmpbuf = zend_string_realloc(tmpbuf, retval, 0); tmpbuf->len = retval; tmpbuf->val[tmpbuf->len] = '\0' ; @@ -1206,7 +1206,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_INT(port, htons(sin6->sin6_port)); + ZVAL_LONG(port, htons(sin6->sin6_port)); } RETURN_TRUE; break; @@ -1223,7 +1223,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_INT(port, htons(sin->sin_port)); + ZVAL_LONG(port, htons(sin->sin_port)); } RETURN_TRUE; break; @@ -1283,7 +1283,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_INT(arg3, htons(sin6->sin6_port)); + ZVAL_LONG(arg3, htons(sin6->sin6_port)); } RETURN_TRUE; @@ -1301,7 +1301,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_INT(arg3, htons(sin->sin_port)); + ZVAL_LONG(arg3, htons(sin->sin_port)); } RETURN_TRUE; @@ -1326,10 +1326,10 @@ PHP_FUNCTION(socket_getpeername) Creates an endpoint for communication in the domain specified by domain, of type specified by type */ PHP_FUNCTION(socket_create) { - php_int_t arg1, arg2, arg3; + zend_long arg1, arg2, arg3; php_socket *php_sock = php_create_socket(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &arg1, &arg2, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) { efree(php_sock); return; } @@ -1373,10 +1373,10 @@ PHP_FUNCTION(socket_connect) php_socket *php_sock; char *addr; int retval, addr_len; - php_int_t port = 0; + zend_long port = 0; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1457,9 +1457,9 @@ PHP_FUNCTION(socket_connect) Returns a string describing an error */ PHP_FUNCTION(socket_strerror) { - php_int_t arg1; + zend_long arg1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) == FAILURE) { return; } @@ -1477,10 +1477,10 @@ PHP_FUNCTION(socket_bind) php_socket *php_sock; char *addr; int addr_len; - php_int_t port = 0; - php_int_t retval = 0; + zend_long port = 0; + zend_long retval = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1558,9 +1558,9 @@ PHP_FUNCTION(socket_recv) zend_string *recv_buf; php_socket *php_sock; int retval; - php_int_t len, flags; + zend_long len, flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ii", &php_sock_res, &buf, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ll", &php_sock_res, &buf, &len, &flags) == FAILURE) { return; } @@ -1571,7 +1571,7 @@ PHP_FUNCTION(socket_recv) RETURN_FALSE; } - recv_buf = STR_ALLOC(len, 0); + recv_buf = zend_string_alloc(len, 0); if ((retval = recv(php_sock->bsd_socket, recv_buf->val, len, flags)) < 1) { efree(recv_buf); @@ -1592,7 +1592,7 @@ PHP_FUNCTION(socket_recv) RETURN_FALSE; } - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -1603,10 +1603,10 @@ PHP_FUNCTION(socket_send) zval *arg1; php_socket *php_sock; int buf_len, retval; - php_int_t len, flags; + zend_long len, flags; char *buf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsii", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) { return; } @@ -1619,7 +1619,7 @@ PHP_FUNCTION(socket_send) RETURN_FALSE; } - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -1637,11 +1637,11 @@ PHP_FUNCTION(socket_recvfrom) #endif socklen_t slen; int retval; - php_int_t arg3, arg4; + zend_long arg3, arg4; char *address; zend_string *recv_buf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/iiz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/llz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { return; } @@ -1652,7 +1652,7 @@ PHP_FUNCTION(socket_recvfrom) RETURN_FALSE; } - recv_buf = STR_ALLOC(arg3 + 1, 0); + recv_buf = zend_string_alloc(arg3 + 1, 0); switch (php_sock->type) { case AF_UNIX: @@ -1662,7 +1662,7 @@ PHP_FUNCTION(socket_recvfrom) if (retval < 0) { PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno); - STR_FREE(recv_buf); + zend_string_free(recv_buf); RETURN_FALSE; } recv_buf->len = retval; @@ -1681,7 +1681,7 @@ PHP_FUNCTION(socket_recvfrom) sin.sin_family = AF_INET; if (arg6 == NULL) { - STR_FREE(recv_buf); + zend_string_free(recv_buf); WRONG_PARAM_COUNT; } @@ -1689,7 +1689,7 @@ PHP_FUNCTION(socket_recvfrom) if (retval < 0) { PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno); - STR_FREE(recv_buf); + zend_string_free(recv_buf); RETURN_FALSE; } recv_buf->len = retval; @@ -1703,7 +1703,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, address ? address : "0.0.0.0"); - ZVAL_INT(arg6, ntohs(sin.sin_port)); + ZVAL_LONG(arg6, ntohs(sin.sin_port)); break; #if HAVE_IPV6 case AF_INET6: @@ -1720,7 +1720,7 @@ PHP_FUNCTION(socket_recvfrom) if (retval < 0) { PHP_SOCKET_ERROR(php_sock, "unable to recvfrom", errno); - STR_FREE(recv_buf); + zend_string_free(recv_buf); RETURN_FALSE; } recv_buf->len = retval; @@ -1735,7 +1735,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, addr6[0] ? addr6 : "::"); - ZVAL_INT(arg6, ntohs(sin6.sin6_port)); + ZVAL_LONG(arg6, ntohs(sin6.sin6_port)); break; #endif default: @@ -1743,7 +1743,7 @@ PHP_FUNCTION(socket_recvfrom) RETURN_FALSE; } - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -1759,11 +1759,11 @@ PHP_FUNCTION(socket_sendto) struct sockaddr_in6 sin6; #endif int retval, buf_len, addr_len; - php_int_t len, flags, port = 0; + zend_long len, flags, port = 0; char *buf, *addr; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsiis|i", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1820,7 +1820,7 @@ PHP_FUNCTION(socket_sendto) RETURN_FALSE; } - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -1837,9 +1837,9 @@ PHP_FUNCTION(socket_get_option) socklen_t optlen; php_socket *php_sock; int other_val; - php_int_t level, optname; + zend_long level, optname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &arg1, &level, &optname) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1, &level, &optname) == FAILURE) { return; } @@ -1856,7 +1856,7 @@ PHP_FUNCTION(socket_get_option) RETURN_FALSE; } if (php_add4_to_if_index(&if_addr, php_sock, &if_index TSRMLS_CC) == SUCCESS) { - RETURN_INT((long) if_index); + RETURN_LONG((long) if_index); } else { RETURN_FALSE; } @@ -1885,8 +1885,8 @@ PHP_FUNCTION(socket_get_option) } array_init(return_value); - add_assoc_int(return_value, "l_onoff", linger_val.l_onoff); - add_assoc_int(return_value, "l_linger", linger_val.l_linger); + add_assoc_long(return_value, "l_onoff", linger_val.l_onoff); + add_assoc_long(return_value, "l_linger", linger_val.l_linger); break; case SO_RCVTIMEO: @@ -1912,8 +1912,8 @@ PHP_FUNCTION(socket_get_option) array_init(return_value); - add_assoc_int(return_value, "sec", tv.tv_sec); - add_assoc_int(return_value, "usec", tv.tv_usec); + add_assoc_long(return_value, "sec", tv.tv_sec); + add_assoc_long(return_value, "usec", tv.tv_usec); break; default: @@ -1926,7 +1926,7 @@ PHP_FUNCTION(socket_get_option) if (optlen == 1) other_val = *((unsigned char *)&other_val); - RETURN_INT(other_val); + RETURN_LONG(other_val); break; } } @@ -1945,14 +1945,14 @@ PHP_FUNCTION(socket_set_option) #else struct timeval tv; #endif - php_int_t level, optname; + zend_long level, optname; void *opt_ptr; HashTable *opt_ht; zval *l_onoff, *l_linger; zval *sec, *usec; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiz", &arg1, &level, &optname, &arg4) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllz", &arg1, &level, &optname, &arg4) == FAILURE) { return; } @@ -2003,8 +2003,8 @@ PHP_FUNCTION(socket_set_option) convert_to_int_ex(l_onoff); convert_to_int_ex(l_linger); - lv.l_onoff = (unsigned short)Z_IVAL_P(l_onoff); - lv.l_linger = (unsigned short)Z_IVAL_P(l_linger); + lv.l_onoff = (unsigned short)Z_LVAL_P(l_onoff); + lv.l_linger = (unsigned short)Z_LVAL_P(l_linger); optlen = sizeof(lv); opt_ptr = &lv; @@ -2031,12 +2031,12 @@ PHP_FUNCTION(socket_set_option) convert_to_int_ex(sec); convert_to_int_ex(usec); #ifndef PHP_WIN32 - tv.tv_sec = Z_IVAL_P(sec); - tv.tv_usec = Z_IVAL_P(usec); + tv.tv_sec = Z_LVAL_P(sec); + tv.tv_usec = Z_LVAL_P(usec); optlen = sizeof(tv); opt_ptr = &tv; #else - timeout = Z_IVAL_P(sec) * 1000 + Z_IVAL_P(usec) / 1000; + timeout = Z_LVAL_P(sec) * 1000 + Z_LVAL_P(usec) / 1000; optlen = sizeof(int); opt_ptr = &timeout; #endif @@ -2046,7 +2046,7 @@ PHP_FUNCTION(socket_set_option) case SO_BINDTODEVICE: { if (Z_TYPE_P(arg4) == IS_STRING) { opt_ptr = Z_STRVAL_P(arg4); - optlen = Z_STRSIZE_P(arg4); + optlen = Z_STRLEN_P(arg4); } else { opt_ptr = ""; optlen = 0; @@ -2058,7 +2058,7 @@ PHP_FUNCTION(socket_set_option) default: default_case: convert_to_int_ex(arg4); - ov = Z_IVAL_P(arg4); + ov = Z_LVAL_P(arg4); optlen = sizeof(ov); opt_ptr = &ov; @@ -2083,9 +2083,9 @@ PHP_FUNCTION(socket_create_pair) zval retval[2], *fds_array_zval; php_socket *php_sock[2]; PHP_SOCKET fds_array[2]; - php_int_t domain, type, protocol; + zend_long domain, type, protocol; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiiz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) { return; } @@ -2143,10 +2143,10 @@ PHP_FUNCTION(socket_create_pair) PHP_FUNCTION(socket_shutdown) { zval *arg1; - php_int_t how_shutdown = 2; + zend_long how_shutdown = 2; php_socket *php_sock; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &how_shutdown) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &how_shutdown) == FAILURE) { return; } @@ -2175,9 +2175,9 @@ PHP_FUNCTION(socket_last_error) if (arg1) { ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, le_socket_name, le_socket); - RETVAL_INT(php_sock->error); + RETVAL_LONG(php_sock->error); } else { - RETVAL_INT(SOCKETS_G(last_error)); + RETVAL_LONG(SOCKETS_G(last_error)); } } /* }}} */ diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h index 645b018cbf..485b2534d2 100644 --- a/ext/sockets/unix_socket_constants.h +++ b/ext/sockets/unix_socket_constants.h @@ -22,405 +22,405 @@ #ifdef EPERM /* Operation not permitted */ - REGISTER_INT_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOENT /* No such file or directory */ - REGISTER_INT_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINTR /* Interrupted system call */ - REGISTER_INT_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIO /* I/O error */ - REGISTER_INT_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENXIO /* No such device or address */ - REGISTER_INT_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef E2BIG /* Arg list too long */ - REGISTER_INT_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADF /* Bad file number */ - REGISTER_INT_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAGAIN /* Try again */ - REGISTER_INT_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEM /* Out of memory */ - REGISTER_INT_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EACCES /* Permission denied */ - REGISTER_INT_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); #endif #ifdef EFAULT /* Bad address */ - REGISTER_INT_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTBLK /* Block device required */ - REGISTER_INT_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBUSY /* Device or resource busy */ - REGISTER_INT_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EEXIST /* File exists */ - REGISTER_INT_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXDEV /* Cross-device link */ - REGISTER_INT_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODEV /* No such device */ - REGISTER_INT_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTDIR /* Not a directory */ - REGISTER_INT_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISDIR /* Is a directory */ - REGISTER_INT_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINVAL /* Invalid argument */ - REGISTER_INT_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENFILE /* File table overflow */ - REGISTER_INT_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMFILE /* Too many open files */ - REGISTER_INT_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTTY /* Not a typewriter */ - REGISTER_INT_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSPC /* No space left on device */ - REGISTER_INT_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESPIPE /* Illegal seek */ - REGISTER_INT_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EROFS /* Read-only file system */ - REGISTER_INT_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMLINK /* Too many links */ - REGISTER_INT_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPIPE /* Broken pipe */ - REGISTER_INT_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENAMETOOLONG /* File name too long */ - REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLCK /* No record locks available */ - REGISTER_INT_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSYS /* Function not implemented */ - REGISTER_INT_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTEMPTY /* Directory not empty */ - REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELOOP /* Too many symbolic links encountered */ - REGISTER_INT_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EWOULDBLOCK /* Operation would block */ - REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMSG /* No message of desired type */ - REGISTER_INT_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIDRM /* Identifier removed */ - REGISTER_INT_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECHRNG /* Channel number out of range */ - REGISTER_INT_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2NSYNC /* Level 2 not synchronized */ - REGISTER_INT_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3HLT /* Level 3 halted */ - REGISTER_INT_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3RST /* Level 3 reset */ - REGISTER_INT_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELNRNG /* Link number out of range */ - REGISTER_INT_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUNATCH /* Protocol driver not attached */ - REGISTER_INT_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOCSI /* No CSI structure available */ - REGISTER_INT_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2HLT /* Level 2 halted */ - REGISTER_INT_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADE /* Invalid exchange */ - REGISTER_INT_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADR /* Invalid request descriptor */ - REGISTER_INT_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXFULL /* Exchange full */ - REGISTER_INT_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOANO /* No anode */ - REGISTER_INT_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADRQC /* Invalid request code */ - REGISTER_INT_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADSLT /* Invalid slot */ - REGISTER_INT_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSTR /* Device not a stream */ - REGISTER_INT_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODATA /* No data available */ - REGISTER_INT_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIME /* Timer expired */ - REGISTER_INT_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSR /* Out of streams resources */ - REGISTER_INT_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENONET /* Machine is not on the network */ - REGISTER_INT_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTE /* Object is remote */ - REGISTER_INT_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLINK /* Link has been severed */ - REGISTER_INT_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADV /* Advertise error */ - REGISTER_INT_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESRMNT /* Srmount error */ - REGISTER_INT_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECOMM /* Communication error on send */ - REGISTER_INT_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTO /* Protocol error */ - REGISTER_INT_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMULTIHOP /* Multihop attempted */ - REGISTER_INT_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADMSG /* Not a data message */ - REGISTER_INT_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTUNIQ /* Name not unique on network */ - REGISTER_INT_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADFD /* File descriptor in bad state */ - REGISTER_INT_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMCHG /* Remote address changed */ - REGISTER_INT_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ERESTART /* Interrupted system call should be restarted */ - REGISTER_INT_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESTRPIPE /* Streams pipe error */ - REGISTER_INT_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUSERS /* Too many users */ - REGISTER_INT_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTSOCK /* Socket operation on non-socket */ - REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDESTADDRREQ /* Destination address required */ - REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMSGSIZE /* Message too long */ - REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTOTYPE /* Protocol wrong type for socket */ - REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOPROTOOPT /* Protocol not available */ - REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTONOSUPPORT /* Protocol not supported */ - REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESOCKTNOSUPPORT /* Socket type not supported */ - REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EOPNOTSUPP /* Operation not supported on transport endpoint */ - REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPFNOSUPPORT /* Protocol family not supported */ - REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAFNOSUPPORT /* Address family not supported by protocol */ - REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRINUSE /* Address already in use */ - REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRNOTAVAIL /* Cannot assign requested address */ - REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETDOWN /* Network is down */ - REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETUNREACH /* Network is unreachable */ - REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETRESET /* Network dropped connection because of reset */ - REGISTER_INT_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNABORTED /* Software caused connection abort */ - REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNRESET /* Connection reset by peer */ - REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOBUFS /* No buffer space available */ - REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISCONN /* Transport endpoint is already connected */ - REGISTER_INT_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTCONN /* Transport endpoint is not connected */ - REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESHUTDOWN /* Cannot send after transport endpoint shutdown */ - REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETOOMANYREFS /* Too many references: cannot splice */ - REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIMEDOUT /* Connection timed out */ - REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNREFUSED /* Connection refused */ - REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTDOWN /* Host is down */ - REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTUNREACH /* No route to host */ - REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef EALREADY /* Operation already in progress */ - REGISTER_INT_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINPROGRESS /* Operation now in progress */ - REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISNAM /* Is a named type file */ - REGISTER_INT_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTEIO /* Remote I/O error */ - REGISTER_INT_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDQUOT /* Quota exceeded */ - REGISTER_INT_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEDIUM /* No medium found */ - REGISTER_INT_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMEDIUMTYPE /* Wrong medium type */ - REGISTER_INT_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h index 2d633efdb7..848e14fb51 100644 --- a/ext/sockets/win32_socket_constants.h +++ b/ext/sockets/win32_socket_constants.h @@ -20,55 +20,55 @@ /* This file is to be included by sockets.c */ -REGISTER_INT_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); -REGISTER_INT_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); +REGISTER_LONG_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 5ca26d3f19..5d5f010f02 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -66,11 +66,11 @@ static zend_class_entry * spl_find_ce_by_name(zend_string *name, zend_bool autol zend_class_entry *ce; if (!autoload) { - zend_string *lc_name = STR_ALLOC(name->len, 0); + zend_string *lc_name = zend_string_alloc(name->len, 0); zend_str_tolower_copy(lc_name->val, name->val, name->len); ce = zend_hash_find_ptr(EG(class_table), lc_name); - STR_FREE(lc_name); + zend_string_free(lc_name); } else { ce = zend_lookup_class(name TSRMLS_CC); } @@ -275,7 +275,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha if (!file_handle.opened_path) { file_handle.opened_path = estrndup(class_file, class_file_len); } - opened_path = STR_INIT(file_handle.opened_path, strlen(file_handle.opened_path), 0); + opened_path = zend_string_init(file_handle.opened_path, strlen(file_handle.opened_path), 0); ZVAL_NULL(&dummy); if (zend_hash_add(&EG(included_files), opened_path, &dummy)) { new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); @@ -284,7 +284,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha new_op_array = NULL; zend_file_handle_dtor(&file_handle TSRMLS_CC); } - STR_RELEASE(opened_path); + zend_string_release(opened_path); if (new_op_array) { ZVAL_UNDEF(&result); zend_execute(new_op_array, &result TSRMLS_CC); @@ -323,7 +323,7 @@ PHP_FUNCTION(spl_autoload) pos_len = file_exts->len; } - 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); while (pos && *pos && !EG(exception)) { pos1 = strchr(pos, ','); @@ -339,7 +339,7 @@ PHP_FUNCTION(spl_autoload) pos = pos1 ? pos1 + 1 : NULL; pos_len = pos1? pos_len - pos1_len - 1 : 0; } - STR_FREE(lc_name); + zend_string_free(lc_name); if (!found && !SPL_G(autoload_running)) { /* For internal errors, we generate E_ERROR, for direct calls an exception is thrown. @@ -370,15 +370,15 @@ PHP_FUNCTION(spl_autoload_extensions) } if (file_exts) { if (SPL_G(autoload_extensions)) { - STR_RELEASE(SPL_G(autoload_extensions)); + zend_string_release(SPL_G(autoload_extensions)); } - SPL_G(autoload_extensions) = STR_COPY(file_exts); + SPL_G(autoload_extensions) = zend_string_copy(file_exts); } if (SPL_G(autoload_extensions) == NULL) { RETURN_STRINGL(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1); } else { - STR_ADDREF(SPL_G(autoload_extensions)); + zend_string_addref(SPL_G(autoload_extensions)); RETURN_STR(SPL_G(autoload_extensions)); } } /* }}} */ @@ -417,8 +417,8 @@ PHP_FUNCTION(spl_autoload_call) if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - lc_name = STR_ALLOC(Z_STRSIZE_P(class_name), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); + lc_name = zend_string_alloc(Z_STRLEN_P(class_name), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), func_name, alfi) { zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, func_name->val, func_name->len, retval, 1, class_name, NULL TSRMLS_CC); zend_exception_save(TSRMLS_C); @@ -431,7 +431,7 @@ PHP_FUNCTION(spl_autoload_call) } } ZEND_HASH_FOREACH_END(); zend_exception_restore(TSRMLS_C); - STR_FREE(lc_name); + zend_string_free(lc_name); SPL_G(autoload_running) = l_autoload_running; } else { /* do not use or overwrite &EG(autoload_func) here */ @@ -480,7 +480,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } else if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error); @@ -488,7 +488,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } else if (Z_TYPE_P(zcallable) == IS_STRING) { if (do_throw) { @@ -497,7 +497,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } else { if (do_throw) { @@ -506,7 +506,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } } else if (fcc.function_handler->type == ZEND_INTERNAL_FUNCTION && @@ -517,7 +517,7 @@ PHP_FUNCTION(spl_autoload_register) if (error) { efree(error); } - STR_RELEASE(func_name); + zend_string_release(func_name); RETURN_FALSE; } alfi.ce = fcc.calling_scope; @@ -530,16 +530,16 @@ PHP_FUNCTION(spl_autoload_register) if (Z_TYPE_P(zcallable) == IS_OBJECT) { ZVAL_COPY(&alfi.closure, zcallable); - lc_name = STR_ALLOC(func_name->len + sizeof(zend_uint), 0); + lc_name = zend_string_alloc(func_name->len + sizeof(zend_uint), 0); zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len); memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(zend_uint)); lc_name->val[lc_name->len] = '\0'; } else { ZVAL_UNDEF(&alfi.closure); - lc_name = STR_ALLOC(func_name->len, 0); + lc_name = zend_string_alloc(func_name->len, 0); zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len); } - STR_RELEASE(func_name); + zend_string_release(func_name); if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), lc_name)) { if (!Z_ISUNDEF(alfi.closure)) { @@ -550,7 +550,7 @@ PHP_FUNCTION(spl_autoload_register) if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) { /* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */ - lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0); + lc_name = zend_string_realloc(lc_name, lc_name->len + sizeof(zend_uint), 0); memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint)); lc_name->val[lc_name->len] = '\0'; ZVAL_OBJ(&alfi.obj, obj_ptr); @@ -594,7 +594,7 @@ PHP_FUNCTION(spl_autoload_register) HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions)); } skip: - STR_RELEASE(lc_name); + zend_string_release(lc_name); } if (SPL_G(autoload_functions)) { @@ -629,7 +629,7 @@ PHP_FUNCTION(spl_autoload_unregister) efree(error); } if (func_name) { - STR_RELEASE(func_name); + zend_string_release(func_name); } RETURN_FALSE; } @@ -639,15 +639,15 @@ PHP_FUNCTION(spl_autoload_unregister) } if (Z_TYPE_P(zcallable) == IS_OBJECT) { - lc_name = STR_ALLOC(func_name->len + sizeof(zend_uint), 0); + lc_name = zend_string_alloc(func_name->len + sizeof(zend_uint), 0); zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len); memcpy(lc_name->val + func_name->len, &Z_OBJ_HANDLE_P(zcallable), sizeof(zend_uint)); lc_name->val[lc_name->len] = '\0'; } else { - lc_name = STR_ALLOC(func_name->len, 0); + lc_name = zend_string_alloc(func_name->len, 0); zend_str_tolower_copy(lc_name->val, func_name->val, func_name->len); } - STR_RELEASE(func_name); + zend_string_release(func_name); if (SPL_G(autoload_functions)) { if (lc_name->len == sizeof("spl_autoload_call") - 1 && !strcmp(lc_name->val, "spl_autoload_call")) { @@ -661,7 +661,7 @@ PHP_FUNCTION(spl_autoload_unregister) /* remove specific */ success = zend_hash_del(SPL_G(autoload_functions), lc_name); if (success != SUCCESS && obj_ptr) { - lc_name = STR_REALLOC(lc_name, lc_name->len + sizeof(zend_uint), 0); + lc_name = zend_string_realloc(lc_name, lc_name->len + sizeof(zend_uint), 0); memcpy(lc_name->val + lc_name->len - sizeof(zend_uint), &obj_ptr->handle, sizeof(zend_uint)); lc_name->val[lc_name->len] = '\0'; success = zend_hash_del(SPL_G(autoload_functions), lc_name); @@ -677,7 +677,7 @@ PHP_FUNCTION(spl_autoload_unregister) } } - STR_RELEASE(lc_name); + zend_string_release(lc_name); RETURN_BOOL(success == SUCCESS); } /* }}} */ @@ -718,15 +718,15 @@ PHP_FUNCTION(spl_autoload_functions) Z_ADDREF(alfi->obj); add_next_index_zval(&tmp, &alfi->obj); } else { - add_next_index_str(&tmp, STR_COPY(alfi->ce->name)); + add_next_index_str(&tmp, zend_string_copy(alfi->ce->name)); } - add_next_index_str(&tmp, STR_COPY(alfi->func_ptr->common.function_name)); + add_next_index_str(&tmp, zend_string_copy(alfi->func_ptr->common.function_name)); add_next_index_zval(return_value, &tmp); } else { if (strncmp(alfi->func_ptr->common.function_name->val, "__lambda_func", sizeof("__lambda_func") - 1)) { - add_next_index_str(return_value, STR_COPY(alfi->func_ptr->common.function_name)); + add_next_index_str(return_value, zend_string_copy(alfi->func_ptr->common.function_name)); } else { - add_next_index_str(return_value, STR_COPY(key)); + add_next_index_str(return_value, zend_string_copy(key)); } } } ZEND_HASH_FOREACH_END(); @@ -734,7 +734,7 @@ PHP_FUNCTION(spl_autoload_functions) } array_init(return_value); - add_next_index_str(return_value, STR_COPY(EG(autoload_func)->common.function_name)); + add_next_index_str(return_value, zend_string_copy(EG(autoload_func)->common.function_name)); } /* }}} */ /* {{{ proto string spl_object_hash(object obj) @@ -927,7 +927,7 @@ PHP_RINIT_FUNCTION(spl) /* {{{ */ PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */ { if (SPL_G(autoload_extensions)) { - STR_RELEASE(SPL_G(autoload_extensions)); + zend_string_release(SPL_G(autoload_extensions)); SPL_G(autoload_extensions) = NULL; } if (SPL_G(autoload_functions)) { diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 23ee137064..4b3a6eef15 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -66,7 +66,7 @@ typedef struct _spl_array_object { zval array; zval retval; HashPosition pos; - php_uint_t pos_h; + zend_ulong pos_h; int ar_flags; int is_self; zend_function *fptr_offset_get; @@ -300,7 +300,7 @@ static zend_object *spl_array_object_clone(zval *zobject TSRMLS_DC) static zval *spl_array_get_dimension_ptr(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ { zval *retval; - php_int_t index; + zend_long index; zend_string *offset_key; spl_array_object *intern = Z_SPLARRAY_P(object); HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -364,7 +364,7 @@ fetch_dim_string: index = Z_RES_P(offset)->handle; goto num_index; case IS_DOUBLE: - index = (php_int_t)Z_DVAL_P(offset); + index = (zend_long)Z_DVAL_P(offset); goto num_index; case IS_FALSE: index = 0; @@ -372,8 +372,8 @@ fetch_dim_string: case IS_TRUE: index = 1; goto num_index; - case IS_INT: - index = Z_IVAL_P(offset); + case IS_LONG: + index = Z_LVAL_P(offset); num_index: if ((retval = zend_hash_index_find(ht, index)) == NULL) { switch (type) { @@ -450,7 +450,7 @@ static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); - php_int_t index; + zend_long index; HashTable *ht; if (check_inherited && intern->fptr_offset_set) { @@ -493,7 +493,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval zend_symtable_update_ind(ht, Z_STR_P(offset), value); return; case IS_DOUBLE: - index = (php_int_t)Z_DVAL_P(offset); + index = (zend_long)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -504,8 +504,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_INT: - index = Z_IVAL_P(offset); + case IS_LONG: + index = Z_LVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -535,7 +535,7 @@ static void spl_array_write_dimension(zval *object, zval *offset, zval *value TS static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */ { - php_int_t index; + zend_long index; HashTable *ht; spl_array_object *intern = Z_SPLARRAY_P(object); @@ -585,7 +585,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval } break; case IS_DOUBLE: - index = (php_int_t)Z_DVAL_P(offset); + index = (zend_long)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -596,8 +596,8 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_INT: - index = Z_IVAL_P(offset); + case IS_LONG: + index = Z_LVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -623,7 +623,7 @@ static void spl_array_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* { static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); - php_int_t index; + zend_long index; zval rv, *value = NULL, *tmp; if (check_inherited && intern->fptr_offset_has) { @@ -664,7 +664,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o break; case IS_DOUBLE: - index = (php_int_t)Z_DVAL_P(offset); + index = (zend_long)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -675,8 +675,8 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_TRUE: index = 1; goto num_index; - case IS_INT: - index = Z_IVAL_P(offset); + case IS_LONG: + index = Z_LVAL_P(offset); num_index: if ((tmp = zend_hash_index_find(ht, index)) != NULL) { if (check_empty == 2) { @@ -874,7 +874,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* base = (Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator) ? spl_ce_ArrayIterator : spl_ce_ArrayObject; zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1 TSRMLS_CC); zend_symtable_update(intern->debug_info, zname, storage); - STR_RELEASE(zname); + zend_string_release(zname); } return intern->debug_info; @@ -957,7 +957,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ ht2 = spl_array_get_hash_table(intern2, 0 TSRMLS_CC); zend_compare_symbol_tables(&temp_zv, ht1, ht2 TSRMLS_CC); - result = (int)Z_IVAL(temp_zv); + result = (int)Z_LVAL(temp_zv); /* if we just compared std.properties, don't do it again */ if (result == 0 && !(ht1 == intern1->std.properties && ht2 == intern2->std.properties)) { @@ -969,7 +969,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; zval *data; if (Z_TYPE(intern->array) == IS_OBJECT) { @@ -1141,7 +1141,7 @@ static void spl_array_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */ /* }}} */ /* {{{ spl_array_set_array */ -static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, php_int_t ar_flags, int just_array TSRMLS_DC) { +static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, zend_long ar_flags, int just_array TSRMLS_DC) { if (Z_TYPE_P(array) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array); @@ -1223,7 +1223,7 @@ SPL_METHOD(Array, __construct) zval *object = getThis(); spl_array_object *intern; zval *array; - php_int_t ar_flags = 0; + zend_long ar_flags = 0; zend_class_entry *ce_get_iterator = spl_ce_Iterator; zend_error_handling error_handling; @@ -1235,7 +1235,7 @@ SPL_METHOD(Array, __construct) intern = Z_SPLARRAY_P(object); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|iC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1286,7 +1286,7 @@ SPL_METHOD(Array, getIteratorClass) return; } - STR_ADDREF(intern->ce_get_iterator->name); + zend_string_addref(intern->ce_get_iterator->name); RETURN_STR(intern->ce_get_iterator->name); } /* }}} */ @@ -1302,7 +1302,7 @@ SPL_METHOD(Array, getFlags) return; } - RETURN_INT(intern->ar_flags & ~SPL_ARRAY_INT_MASK); + RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK); } /* }}} */ @@ -1312,9 +1312,9 @@ SPL_METHOD(Array, setFlags) { zval *object = getThis(); spl_array_object *intern = Z_SPLARRAY_P(object); - php_int_t ar_flags = 0; + zend_long ar_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ar_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ar_flags) == FAILURE) { return; } @@ -1381,13 +1381,13 @@ SPL_METHOD(Array, rewind) Seek to position. */ SPL_METHOD(Array, seek) { - php_int_t opos, position; + zend_long opos, position; zval *object = getThis(); spl_array_object *intern = Z_SPLARRAY_P(object); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) { return; } @@ -1411,7 +1411,7 @@ SPL_METHOD(Array, seek) zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %pd is out of range", opos); } /* }}} */ -int static spl_array_object_count_elements_helper(spl_array_object *intern, php_int_t *count TSRMLS_DC) /* {{{ */ +int static spl_array_object_count_elements_helper(spl_array_object *intern, zend_long *count TSRMLS_DC) /* {{{ */ { HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); HashPosition pos; @@ -1439,7 +1439,7 @@ int static spl_array_object_count_elements_helper(spl_array_object *intern, php_ } } /* }}} */ -int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ +int spl_array_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); @@ -1450,7 +1450,7 @@ int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_int(&intern->retval); - *count = (php_int_t)Z_IVAL(intern->retval); + *count = (zend_long)Z_LVAL(intern->retval); return SUCCESS; } *count = 0; @@ -1464,7 +1464,7 @@ int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* Return the number of elements in the Iterator. */ SPL_METHOD(Array, count) { - php_int_t count; + zend_long count; spl_array_object *intern = Z_SPLARRAY_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -1473,7 +1473,7 @@ SPL_METHOD(Array, count) spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ @@ -1706,7 +1706,7 @@ SPL_METHOD(Array, getChildren) } } - ZVAL_INT(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); + ZVAL_LONG(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, entry, &flags TSRMLS_CC); } /* }}} */ @@ -1733,7 +1733,7 @@ SPL_METHOD(Array, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); - ZVAL_INT(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); + ZVAL_LONG(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); /* storage */ smart_str_appendl(&buf, "x:", 2); @@ -1781,7 +1781,7 @@ SPL_METHOD(Array, unserialize) php_unserialize_data_t var_hash; zval members, zflags; HashTable *aht; - php_int_t flags; + zend_long flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; @@ -1806,12 +1806,12 @@ SPL_METHOD(Array, unserialize) } ++p; - if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_INT) { + if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_LONG) { goto outexcept; } --p; /* for ';' */ - flags = Z_IVAL(zflags); + flags = Z_LVAL(zflags); /* flags needs to be verified and we also need to verify whether the next * thing we get is ';'. After that we require an 'm' or somethign else * where 'm' stands for members and anything else should be an array. If @@ -1861,7 +1861,7 @@ SPL_METHOD(Array, unserialize) outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len); return; } /* }}} */ @@ -2018,13 +2018,13 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_INT(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); return SUCCESS; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index c4b31ecd00..28a5532721 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -596,7 +596,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC); ZVAL_STRINGL(&tmp, path, path_len); zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); if (intern->file_name) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "fileName", sizeof("fileName")-1 TSRMLS_CC); @@ -608,7 +608,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_STRINGL(&tmp, intern->file_name, intern->file_name_len); } zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); } if (intern->type == SPL_FS_DIR) { #ifdef HAVE_GLOB @@ -619,7 +619,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_BOOL(&tmp, 0); } zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); #endif pnstr = spl_gen_private_prop_name(spl_ce_RecursiveDirectoryIterator, "subPathName", sizeof("subPathName")-1 TSRMLS_CC); if (intern->u.dir.sub_path) { @@ -628,24 +628,24 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem ZVAL_EMPTY_STRING(&tmp); } zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); } if (intern->type == SPL_FS_FILE) { pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "openMode", sizeof("openMode")-1 TSRMLS_CC); ZVAL_STRINGL(&tmp, intern->u.file.open_mode, intern->u.file.open_mode_len); zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); stmp[1] = '\0'; stmp[0] = intern->u.file.delimiter; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "delimiter", sizeof("delimiter")-1 TSRMLS_CC); ZVAL_STRINGL(&tmp, stmp, 1); zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); stmp[0] = intern->u.file.enclosure; pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, "enclosure", sizeof("enclosure")-1 TSRMLS_CC); ZVAL_STRINGL(&tmp, stmp, 1); zend_symtable_update(rv, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); } return rv; @@ -658,9 +658,9 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend if (fsobj->u.dir.entry.d_name[0] == '\0' && fsobj->orig_path == NULL) { zend_function *func; - zend_string *tmp = STR_INIT("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0); + zend_string *tmp = zend_string_init("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0); func = zend_get_std_object_handlers()->get_method(object, tmp, NULL TSRMLS_CC); - STR_RELEASE(tmp); + zend_string_release(tmp); return func; } @@ -671,19 +671,19 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend #define DIT_CTOR_FLAGS 0x00000001 #define DIT_CTOR_GLOB 0x00000002 -void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, php_int_t ctor_flags) /* {{{ */ +void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long ctor_flags) /* {{{ */ { spl_filesystem_object *intern; char *path; int parsed, len; - php_int_t flags; + zend_long flags; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &len, &flags); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags); } else { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len); @@ -767,7 +767,7 @@ SPL_METHOD(DirectoryIterator, key) } if (intern->u.dir.dirp) { - RETURN_INT(intern->u.dir.index); + RETURN_LONG(intern->u.dir.index); } else { RETURN_FALSE; } @@ -813,9 +813,9 @@ SPL_METHOD(DirectoryIterator, seek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); zval retval; - php_int_t pos; + zend_long pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) { return; } @@ -935,10 +935,10 @@ SPL_METHOD(SplFileInfo, getExtension) if (p) { idx = p - ret->val; RETVAL_STRINGL(ret->val + idx + 1, ret->len - idx - 1); - STR_RELEASE(ret); + zend_string_release(ret); return; } else { - STR_RELEASE(ret); + zend_string_release(ret); RETURN_EMPTY_STRING(); } } @@ -963,9 +963,9 @@ SPL_METHOD(DirectoryIterator, getExtension) if (p) { idx = p - fname->val; RETVAL_STRINGL(fname->val + idx + 1, fname->len - idx - 1); - STR_RELEASE(fname); + zend_string_release(fname); } else { - STR_RELEASE(fname); + zend_string_release(fname); RETURN_EMPTY_STRING(); } } @@ -1445,7 +1445,7 @@ SPL_METHOD(FilesystemIterator, getFlags) return; } - RETURN_INT(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); + RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ /* {{{ proto void FilesystemIterator::setFlags(long $flags) @@ -1453,9 +1453,9 @@ SPL_METHOD(FilesystemIterator, getFlags) SPL_METHOD(FilesystemIterator, setFlags) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t flags; + zend_long flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) { return; } @@ -1506,7 +1506,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { RETURN_STRINGL(intern->file_name, intern->file_name_len); } else { - ZVAL_INT(&zflags, intern->flags); + ZVAL_LONG(&zflags, intern->flags); ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC); zval_ptr_dtor(&zpath); @@ -1597,7 +1597,7 @@ SPL_METHOD(GlobIterator, count) } if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { - RETURN_INT(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); + RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); } else { /* should not happen */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "GlobIterator lost glob state"); @@ -1686,7 +1686,7 @@ static void spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zval * { spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter TSRMLS_CC); - ZVAL_INT(key, object->u.dir.index); + ZVAL_LONG(key, object->u.dir.index); } /* }}} */ @@ -2025,7 +2025,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS { char *buf; size_t line_len = 0; - php_int_t line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0; + zend_long line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0; spl_filesystem_file_free_line(intern TSRMLS_CC); @@ -2177,8 +2177,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje } spl_filesystem_file_free_line(intern TSRMLS_CC); if (Z_TYPE(retval) == IS_STRING) { - intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); - intern->u.file.current_line_len = Z_STRSIZE(retval); + intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); + intern->u.file.current_line_len = Z_STRLEN(retval); } else { ZVAL_ZVAL(&intern->u.file.current_zval, &retval, 1, 0); } @@ -2199,7 +2199,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML } else if (!Z_ISUNDEF(intern->u.file.current_zval)) { switch(Z_TYPE(intern->u.file.current_zval)) { case IS_STRING: - return Z_STRSIZE(intern->u.file.current_zval) == 0; + return Z_STRLEN(intern->u.file.current_zval) == 0; case IS_ARRAY: if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) && zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 1) { @@ -2210,7 +2210,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML idx++; } first = &Z_ARRVAL(intern->u.file.current_zval)->arData[idx].val; - return Z_TYPE_P(first) == IS_STRING && Z_STRSIZE_P(first) == 0; + return Z_TYPE_P(first) == IS_STRING && Z_STRLEN_P(first) == 0; } return zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 0; case IS_NULL: @@ -2319,14 +2319,14 @@ SPL_METHOD(SplFileObject, __construct) Construct a new temp file object */ SPL_METHOD(SplTempFileObject, __construct) { - php_int_t max_memory = PHP_STREAM_MAX_MEM; + zend_long max_memory = PHP_STREAM_MAX_MEM; char tmp_fname[48]; spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_memory) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -2463,7 +2463,7 @@ SPL_METHOD(SplFileObject, key) if (!intern->current_line) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } */ - RETURN_INT(intern->u.file.current_line_num); + RETURN_LONG(intern->u.file.current_line_num); } /* }}} */ /* {{{ proto void SplFileObject::next() @@ -2489,7 +2489,7 @@ SPL_METHOD(SplFileObject, setFlags) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) { return; } } /* }}} */ @@ -2504,18 +2504,18 @@ SPL_METHOD(SplFileObject, getFlags) return; } - RETURN_INT(intern->flags & SPL_FILE_OBJECT_MASK); + RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK); } /* }}} */ /* {{{ proto void SplFileObject::setMaxLineLen(int max_len) Set maximum line length */ SPL_METHOD(SplFileObject, setMaxLineLen) { - php_int_t max_len; + zend_long max_len; spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &max_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &max_len) == FAILURE) { return; } @@ -2537,7 +2537,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen) return; } - RETURN_INT((php_int_t)intern->u.file.max_line_len); + RETURN_LONG((zend_long)intern->u.file.max_line_len); } /* }}} */ /* {{{ proto bool SplFileObject::hasChildren() @@ -2649,7 +2649,7 @@ SPL_METHOD(SplFileObject, fputcsv) break; } ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC); - RETURN_INT(ret); + RETURN_LONG(ret); } } /* }}} */ @@ -2740,7 +2740,7 @@ SPL_METHOD(SplFileObject, fflush) SPL_METHOD(SplFileObject, ftell) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t ret; + zend_long ret; if(!intern->u.file.stream) { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); @@ -2752,7 +2752,7 @@ SPL_METHOD(SplFileObject, ftell) if (ret == -1) { RETURN_FALSE; } else { - RETURN_INT(ret); + RETURN_LONG(ret); } } /* }}} */ @@ -2761,9 +2761,9 @@ SPL_METHOD(SplFileObject, ftell) SPL_METHOD(SplFileObject, fseek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t pos, whence = SEEK_SET; + zend_long pos, whence = SEEK_SET; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &pos, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &pos, &whence) == FAILURE) { return; } @@ -2773,7 +2773,7 @@ SPL_METHOD(SplFileObject, fseek) } spl_filesystem_file_free_line(intern TSRMLS_CC); - RETURN_INT(php_stream_seek(intern->u.file.stream, pos, whence)); + RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence)); } /* }}} */ /* {{{ proto int SplFileObject::fgetc() @@ -2819,9 +2819,9 @@ SPL_METHOD(SplFileObject, fgetss) } if (intern->u.file.max_line_len > 0) { - ZVAL_INT(&arg2, intern->u.file.max_line_len); + ZVAL_LONG(&arg2, intern->u.file.max_line_len); } else { - ZVAL_INT(&arg2, 1024); + ZVAL_LONG(&arg2, 1024); } spl_filesystem_file_free_line(intern TSRMLS_CC); @@ -2841,7 +2841,7 @@ SPL_METHOD(SplFileObject, fpassthru) return; } - RETURN_INT(php_stream_passthru(intern->u.file.stream)); + RETURN_LONG(php_stream_passthru(intern->u.file.stream)); } /* }}} */ /* {{{ proto bool SplFileObject::fscanf(string format [, string ...]) @@ -2869,9 +2869,9 @@ SPL_METHOD(SplFileObject, fwrite) spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *str; int str_len; - php_int_t length = 0; + zend_long length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) { return; } @@ -2884,18 +2884,18 @@ SPL_METHOD(SplFileObject, fwrite) str_len = MAX(0, MIN(length, str_len)); } if (!str_len) { - RETURN_INT(0); + RETURN_LONG(0); } - RETURN_INT(php_stream_write(intern->u.file.stream, str, str_len)); + RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len)); } /* }}} */ SPL_METHOD(SplFileObject, fread) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t length = 0; + zend_long length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) { return; } @@ -2909,11 +2909,11 @@ SPL_METHOD(SplFileObject, fread) RETURN_FALSE; } - ZVAL_STR(return_value, STR_ALLOC(length, 0)); - Z_STRSIZE_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); + ZVAL_STR(return_value, zend_string_alloc(length, 0)); + Z_STRLEN_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; } /* {{{ proto bool SplFileObject::fstat() @@ -2926,9 +2926,9 @@ FileFunction(fstat) SPL_METHOD(SplFileObject, ftruncate) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t size; + zend_long size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { return; } @@ -2950,9 +2950,9 @@ SPL_METHOD(SplFileObject, ftruncate) SPL_METHOD(SplFileObject, seek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - php_int_t line_pos; + zend_long line_pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &line_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) { return; } if(!intern->u.file.stream) { @@ -3110,18 +3110,18 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_SUB_CLASS_EX(FilesystemIterator, DirectoryIterator, spl_filesystem_object_new, spl_FilesystemIterator_functions); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); - REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); + REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator; @@ -3140,10 +3140,10 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator); REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator); - REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); - REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); - REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); - REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); + REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); + REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); + REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); + REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); REGISTER_SPL_SUB_CLASS_EX(SplTempFileObject, SplFileObject, spl_filesystem_object_new_check, spl_SplTempFileObject_functions); return SUCCESS; diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index a958e30874..dd747e5863 100644 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -68,7 +68,7 @@ struct _spl_filesystem_object { char *file_name; int file_name_len; SPL_FS_OBJ_TYPE type; - php_int_t flags; + zend_long flags; zend_class_entry *file_class; zend_class_entry *info_class; union { @@ -93,7 +93,7 @@ struct _spl_filesystem_object { char *current_line; size_t current_line_len; size_t max_line_len; - php_int_t current_line_num; + zend_long current_line_num; zval zresource; zend_function *func_getCurr; char delimiter; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index c2eb5c0486..825951e5f2 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -143,9 +143,9 @@ static spl_ptr_llist *spl_ptr_llist_init(spl_ptr_llist_ctor_func ctor, spl_ptr_l } /* }}} */ -static php_int_t spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ +static zend_long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ { - return (php_int_t)llist->count; + return (zend_long)llist->count; } /* }}} */ @@ -167,7 +167,7 @@ static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */ } /* }}} */ -static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, php_int_t offset, int backward) /* {{{ */ +static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, zend_long offset, int backward) /* {{{ */ { spl_ptr_llist_element *current; @@ -474,7 +474,7 @@ static zend_object *spl_dllist_object_clone(zval *zobject TSRMLS_DC) /* {{{ */ } /* }}} */ -static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ +static int spl_dllist_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(object); @@ -485,7 +485,7 @@ static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRML zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_int(&intern->retval); - *count = (php_int_t) Z_IVAL(intern->retval); + *count = (zend_long) Z_LVAL(intern->retval); return SUCCESS; } *count = 0; @@ -520,9 +520,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_INT(&tmp, intern->flags); + ZVAL_LONG(&tmp, intern->flags); zend_hash_add(intern->debug_info, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); array_init(&dllist_array); @@ -540,7 +540,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1 TSRMLS_CC); zend_hash_add(intern->debug_info, pnstr, &dllist_array); - STR_RELEASE(pnstr); + zend_string_release(pnstr); } return intern->debug_info; @@ -673,7 +673,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom) Return the number of elements in the datastructure. */ SPL_METHOD(SplDoublyLinkedList, count) { - php_int_t count; + zend_long count; spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -681,7 +681,7 @@ SPL_METHOD(SplDoublyLinkedList, count) } count = spl_ptr_llist_count(intern->llist); - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ @@ -689,7 +689,7 @@ SPL_METHOD(SplDoublyLinkedList, count) Return true if the SplDoublyLinkedList is empty. */ SPL_METHOD(SplDoublyLinkedList, isEmpty) { - php_int_t count; + zend_long count; if (zend_parse_parameters_none() == FAILURE) { return; @@ -704,10 +704,10 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty) Set the mode of iteration */ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) { - php_int_t value; + zend_long value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) { return; } @@ -721,7 +721,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) intern->flags = value & SPL_DLLIST_IT_MASK; - RETURN_INT(intern->flags); + RETURN_LONG(intern->flags); } /* }}} */ @@ -737,7 +737,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) intern = Z_SPLDLLIST_P(getThis()); - RETURN_INT(intern->flags); + RETURN_LONG(intern->flags); } /* }}} */ @@ -747,7 +747,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) { zval *zindex; spl_dllist_object *intern; - php_int_t index; + zend_long index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zindex) == FAILURE) { return; @@ -764,7 +764,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) SPL_METHOD(SplDoublyLinkedList, offsetGet) { zval *zindex; - php_int_t index; + zend_long index; spl_dllist_object *intern; spl_ptr_llist_element *element; @@ -808,7 +808,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) spl_ptr_llist_push(intern->llist, value TSRMLS_CC); } else { /* $obj[$foo] = ... */ - php_int_t index; + zend_long index; spl_ptr_llist_element *element; index = spl_offset_convert_to_int(zindex TSRMLS_CC); @@ -849,7 +849,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) SPL_METHOD(SplDoublyLinkedList, offsetUnset) { zval *zindex; - php_int_t index; + zend_long index; spl_dllist_object *intern; spl_ptr_llist_element *element; spl_ptr_llist *llist; @@ -1006,7 +1006,7 @@ static void spl_dllist_it_get_current_key(zend_object_iterator *iter, zval *key { spl_dllist_it *iterator = (spl_dllist_it *)iter; - ZVAL_INT(key, iterator->traverse_position); + ZVAL_LONG(key, iterator->traverse_position); } /* }}} */ @@ -1031,7 +1031,7 @@ SPL_METHOD(SplDoublyLinkedList, key) return; } - RETURN_INT(intern->traverse_position); + RETURN_LONG(intern->traverse_position); } /* }}} */ @@ -1127,7 +1127,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); /* flags */ - ZVAL_INT(&flags, intern->flags); + ZVAL_LONG(&flags, intern->flags); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -1181,12 +1181,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) goto error; } - if (Z_TYPE(flags) != IS_INT) { + if (Z_TYPE(flags) != IS_LONG) { zval_ptr_dtor(&flags); goto error; } - intern->flags = Z_IVAL(flags); + intern->flags = Z_LVAL(flags); zval_ptr_dtor(&flags); /* elements */ @@ -1209,7 +1209,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) error: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len); return; } /* }}} */ @@ -1221,7 +1221,7 @@ SPL_METHOD(SplDoublyLinkedList, add) zval *zindex, *value; spl_dllist_object *intern; spl_ptr_llist_element *element; - php_int_t index; + zend_long index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zindex, &value) == FAILURE) { return; @@ -1385,10 +1385,10 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ spl_handler_SplDoublyLinkedList.dtor_obj = zend_objects_destroy_object; spl_handler_SplDoublyLinkedList.free_obj = spl_dllist_object_free_storage; - REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); - REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_FIFO", 0); - REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); - REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_KEEP", 0); + REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); + REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_FIFO", 0); + REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); + REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_KEEP", 0); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Iterator); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Countable); diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 1cae08e652..cb069efcb1 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -40,9 +40,9 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) } /* }}} */ -PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */ +PHPAPI zend_long spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */ { - php_uint_t idx; + zend_ulong idx; switch (Z_TYPE_P(offset)) { case IS_STRING: @@ -51,9 +51,9 @@ PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */ } break; case IS_DOUBLE: - return (php_int_t)Z_DVAL_P(offset); - case IS_INT: - return Z_IVAL_P(offset); + return (zend_long)Z_DVAL_P(offset); + case IS_LONG: + return Z_LVAL_P(offset); case IS_FALSE: return 0; case IS_TRUE: diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index f5a58e835e..aed8967bd4 100644 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -27,7 +27,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC); +PHPAPI zend_long spl_offset_convert_to_int(zval *offset TSRMLS_DC); /* {{{ spl_instantiate_arg_ex1 */ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1 TSRMLS_DC) diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 990805bd4a..acdd9dd137 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -43,7 +43,7 @@ ZEND_GET_MODULE(spl_fixedarray) #endif typedef struct _spl_fixedarray { /* {{{ */ - php_int_t size; + zend_long size; zval *elements; } spl_fixedarray; /* }}} */ @@ -81,7 +81,7 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj) #define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv))) -static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_init(spl_fixedarray *array, zend_long size TSRMLS_DC) /* {{{ */ { if (size > 0) { array->size = 0; /* reset size in case ecalloc() fails */ @@ -94,7 +94,7 @@ static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) } /* }}} */ -static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_resize(spl_fixedarray *array, zend_long size TSRMLS_DC) /* {{{ */ { if (size == array->size) { /* nothing to do */ @@ -109,7 +109,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_D /* clearing the array */ if (size == 0) { - php_int_t i; + zend_long i; for (i = 0; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -123,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_D array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0); memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size)); } else { /* size < array->size */ - php_int_t i; + zend_long i; for (i = size; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -194,7 +194,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* { static void spl_fixedarray_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern = spl_fixed_array_from_obj(object); - php_int_t i; + zend_long i; if (intern->array) { for (i = 0; i < intern->array->size; i++) { @@ -328,7 +328,7 @@ static zend_object *spl_fixedarray_object_clone(zval *zobject TSRMLS_DC) /* {{{ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - php_int_t index; + zend_long index; /* we have to return NULL on error here to avoid memleak because of * ZE duplicating uninitialized_zval_ptr */ @@ -337,10 +337,10 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o return NULL; } - if (Z_TYPE_P(offset) != IS_INT) { + if (Z_TYPE_P(offset) != IS_LONG) { index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_IVAL_P(offset); + index = Z_LVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -384,7 +384,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { - php_int_t index; + zend_long index; if (!offset) { /* '$array[] = value' syntax is not supported */ @@ -392,10 +392,10 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o return; } - if (Z_TYPE_P(offset) != IS_INT) { + if (Z_TYPE_P(offset) != IS_LONG) { index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_IVAL_P(offset); + index = Z_LVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -438,12 +438,12 @@ static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zv static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - php_int_t index; + zend_long index; - if (Z_TYPE_P(offset) != IS_INT) { + if (Z_TYPE_P(offset) != IS_LONG) { index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_IVAL_P(offset); + index = Z_LVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -476,13 +476,13 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset TSR static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_object *intern, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { - php_int_t index; + zend_long index; int retval; - if (Z_TYPE_P(offset) != IS_INT) { + if (Z_TYPE_P(offset) != IS_LONG) { index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_IVAL_P(offset); + index = Z_LVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -528,7 +528,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c } /* }}} */ -static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ +static int spl_fixedarray_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern; @@ -540,7 +540,7 @@ static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count T zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_int(&intern->retval); - *count = (php_int_t) Z_IVAL(intern->retval); + *count = (zend_long) Z_LVAL(intern->retval); return SUCCESS; } } else if (intern->array) { @@ -559,9 +559,9 @@ SPL_METHOD(SplFixedArray, __construct) { zval *object = getThis(); spl_fixedarray_object *intern; - php_int_t size = 0; + zend_long size = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) { return; } @@ -629,9 +629,9 @@ SPL_METHOD(SplFixedArray, count) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_INT(intern->array->size); + RETURN_LONG(intern->array->size); } - RETURN_INT(0); + RETURN_LONG(0); } /* }}} */ @@ -684,11 +684,11 @@ SPL_METHOD(SplFixedArray, fromArray) if (num > 0 && save_indexes) { zval *element; zend_string *str_index; - php_uint_t num_index, max_index = 0; - php_int_t tmp; + zend_ulong num_index, max_index = 0; + zend_long tmp; ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) { - if (str_index != NULL || (php_int_t)num_index < 0) { + if (str_index != NULL || (zend_long)num_index < 0) { efree(array); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "array must contain only positive integer keys"); return; @@ -714,7 +714,7 @@ SPL_METHOD(SplFixedArray, fromArray) } else if (num > 0 && !save_indexes) { zval *element; - php_int_t i = 0; + zend_long i = 0; spl_fixedarray_init(array, num TSRMLS_CC); @@ -747,9 +747,9 @@ SPL_METHOD(SplFixedArray, getSize) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_INT(intern->array->size); + RETURN_LONG(intern->array->size); } - RETURN_INT(0); + RETURN_LONG(0); } /* }}} */ @@ -759,9 +759,9 @@ SPL_METHOD(SplFixedArray, setSize) { zval *object = getThis(); spl_fixedarray_object *intern; - php_int_t size; + zend_long size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { return; } @@ -895,7 +895,7 @@ static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRML } else { zval *data; - ZVAL_INT(&zindex, object->current); + ZVAL_LONG(&zindex, object->current); data = spl_fixedarray_object_read_dimension_helper(object, &zindex TSRMLS_CC); zval_ptr_dtor(&zindex); @@ -915,7 +915,7 @@ static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval * if (object->flags & SPL_FIXEDARRAY_OVERLOADED_KEY) { zend_user_it_get_current_key(iter, key TSRMLS_CC); } else { - ZVAL_INT(key, object->current); + ZVAL_LONG(key, object->current); } } /* }}} */ @@ -943,7 +943,7 @@ SPL_METHOD(SplFixedArray, key) return; } - RETURN_INT(intern->current); + RETURN_LONG(intern->current); } /* }}} */ @@ -1000,7 +1000,7 @@ SPL_METHOD(SplFixedArray, current) return; } - ZVAL_INT(&zindex, intern->current); + ZVAL_LONG(&zindex, intern->current); value = spl_fixedarray_object_read_dimension_helper(intern, &zindex TSRMLS_CC); diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 97a9509caa..541cceb739 100644 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -84,7 +84,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) { zval t; - STR_ADDREF(pce->name); + zend_string_addref(pce->name); ZVAL_STR(&t, pce->name); zend_hash_add(Z_ARRVAL_P(list), pce->name, &t); } diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index f3d8f26a07..88ae478a02 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -46,8 +46,8 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type TSRMLS #define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \ spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC); -#define REGISTER_SPL_CLASS_CONST_INT(class_name, const_name, value) \ - zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); +#define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \ + zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 916ed919f8..0910686c4f 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -105,7 +105,7 @@ static void spl_ptr_heap_zval_ctor(zval *elem TSRMLS_DC) { /* {{{ */ } /* }}} */ -static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, php_int_t *result TSRMLS_DC) { /* {{{ */ +static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result TSRMLS_DC) { /* {{{ */ zval zresult; zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b); @@ -115,7 +115,7 @@ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object } convert_to_int(&zresult); - *result = Z_IVAL(zresult); + *result = Z_LVAL(zresult); zval_ptr_dtor(&zresult); @@ -155,7 +155,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - php_int_t lval = 0; + zend_long lval = 0; if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -165,7 +165,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, a, b TSRMLS_CC); - return Z_IVAL(result); + return Z_LVAL(result); } /* }}} */ @@ -179,7 +179,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - php_int_t lval = 0; + zend_long lval = 0; if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -189,7 +189,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, b, a TSRMLS_CC); - return Z_IVAL(result); + return Z_LVAL(result); } /* }}} */ @@ -210,7 +210,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - php_int_t lval = 0; + zend_long lval = 0; if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, a_priority_p, b_priority_p, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -220,7 +220,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / } compare_function(&result, a_priority_p, b_priority_p TSRMLS_CC); - return Z_IVAL(result); + return Z_LVAL(result); } /* }}} */ @@ -483,7 +483,7 @@ static zend_object *spl_heap_object_clone(zval *zobject TSRMLS_DC) /* {{{ */ } /* }}} */ -static int spl_heap_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ +static int spl_heap_object_count_elements(zval *object, zend_long *count TSRMLS_DC) /* {{{ */ { spl_heap_object *intern = Z_SPLHEAP_P(object); @@ -494,7 +494,7 @@ static int spl_heap_object_count_elements(zval *object, php_int_t *count TSRMLS_ zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); convert_to_int(&intern->retval); - *count = (php_int_t) Z_IVAL(intern->retval); + *count = (zend_long) Z_LVAL(intern->retval); return SUCCESS; } *count = 0; @@ -529,14 +529,14 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_INT(&tmp, intern->flags); + ZVAL_LONG(&tmp, intern->flags); zend_hash_update(intern->debug_info, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); pnstr = spl_gen_private_prop_name(ce, "isCorrupted", sizeof("isCorrupted")-1 TSRMLS_CC); ZVAL_BOOL(&tmp, intern->heap->flags&SPL_HEAP_CORRUPTED); zend_hash_update(intern->debug_info, pnstr, &tmp); - STR_RELEASE(pnstr); + zend_string_release(pnstr); array_init(&heap_array); @@ -549,7 +549,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv pnstr = spl_gen_private_prop_name(ce, "heap", sizeof("heap")-1 TSRMLS_CC); zend_hash_update(intern->debug_info, pnstr, &heap_array); - STR_RELEASE(pnstr); + zend_string_release(pnstr); } return intern->debug_info; @@ -572,7 +572,7 @@ static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp TSRML Return the number of elements in the heap. */ SPL_METHOD(SplHeap, count) { - php_int_t count; + zend_long count; spl_heap_object *intern = Z_SPLHEAP_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -580,7 +580,7 @@ SPL_METHOD(SplHeap, count) } count = spl_ptr_heap_count(intern->heap); - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ @@ -765,10 +765,10 @@ SPL_METHOD(SplPriorityQueue, top) Set the flags of extraction*/ SPL_METHOD(SplPriorityQueue, setExtractFlags) { - php_int_t value; + zend_long value; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) { return; } @@ -776,7 +776,7 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags) intern->flags = value & SPL_PQUEUE_EXTR_MASK; - RETURN_INT(intern->flags); + RETURN_LONG(intern->flags); } /* }}} */ @@ -808,7 +808,7 @@ SPL_METHOD(SplPriorityQueue, compare) return; } - RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -851,7 +851,7 @@ SPL_METHOD(SplMinHeap, compare) return; } - RETURN_INT(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); + RETURN_LONG(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -865,7 +865,7 @@ SPL_METHOD(SplMaxHeap, compare) return; } - RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -934,7 +934,7 @@ static void spl_heap_it_get_current_key(zend_object_iterator *iter, zval *key TS { spl_heap_object *object = Z_SPLHEAP_P(&iter->data); - ZVAL_INT(key, object->heap->count - 1); + ZVAL_LONG(key, object->heap->count - 1); } /* }}} */ @@ -966,7 +966,7 @@ SPL_METHOD(SplHeap, key) return; } - RETURN_INT(intern->heap->count - 1); + RETURN_LONG(intern->heap->count - 1); } /* }}} */ @@ -1226,9 +1226,9 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; - REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); - REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); - REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); + REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); + REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); + REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); return SUCCESS; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 87cdb70007..b8eb7ef662 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -228,7 +228,7 @@ static void spl_recursive_it_get_current_key(zend_object_iterator *iter, zval *k if (sub_iter->funcs->get_current_key) { sub_iter->funcs->get_current_key(sub_iter, key TSRMLS_CC); } else { - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } } @@ -473,7 +473,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla spl_recursive_it_object *intern; zval *iterator; zend_class_entry *ce_iterator; - php_int_t mode, flags; + zend_long mode, flags; int inc_refcount = 1; zend_error_handling error_handling; @@ -486,7 +486,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla mode = RIT_SELF_FIRST; flags = RTIT_BYPASS_KEY; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|izi", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { zval *aggregate = iterator; zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator); @@ -496,7 +496,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (user_caching_it_flags) { ZVAL_ZVAL(&caching_it_flags, user_caching_it_flags, 1, 0); } else { - ZVAL_INT(&caching_it_flags, CIT_CATCH_GET_CHILD); + ZVAL_LONG(&caching_it_flags, CIT_CATCH_GET_CHILD); } spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, iterator, &caching_it_flags TSRMLS_CC); zval_ptr_dtor(&caching_it_flags); @@ -515,7 +515,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla mode = RIT_LEAVES_ONLY; flags = 0; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ii", &iterator, &mode, &flags) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { zval *aggregate = iterator; zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator); @@ -695,7 +695,7 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) return; } - RETURN_INT(object->level); + RETURN_LONG(object->level); } /* }}} */ /* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level]) @@ -703,9 +703,9 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) SPL_METHOD(RecursiveIteratorIterator, getSubIterator) { spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - php_int_t level = object->level; + zend_long level = object->level; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &level) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) { return; } if (level < 0 || level > object->level) { @@ -846,9 +846,9 @@ SPL_METHOD(RecursiveIteratorIterator, nextElement) SPL_METHOD(RecursiveIteratorIterator, setMaxDepth) { spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - php_int_t max_depth = -1; + zend_long max_depth = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_depth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) { return; } if (max_depth < -1) { @@ -871,7 +871,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) if (object->max_depth == -1) { RETURN_FALSE; } else { - RETURN_INT(object->max_depth); + RETURN_LONG(object->max_depth); } } /* }}} */ @@ -879,7 +879,7 @@ static union _zend_function *spl_recursive_it_get_method(zend_object **zobject, { union _zend_function *function_handler; spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject); - php_int_t level = object->level; + zend_long level = object->level; zval *zobj; if (!object->iterators) { @@ -1088,12 +1088,12 @@ SPL_METHOD(RecursiveTreeIterator, __construct) Sets prefix parts as used in getPrefix() */ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) { - php_int_t part; + zend_long part; char* prefix; int prefix_len; spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &part, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) { return; } @@ -1222,15 +1222,15 @@ SPL_METHOD(RecursiveTreeIterator, current) } spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix), 0); + str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); - ptr += Z_STRSIZE(prefix); - memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry)); - ptr += Z_STRSIZE(entry); - memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); - ptr += Z_STRSIZE(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); + ptr += Z_STRLEN(prefix); + memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry)); + ptr += Z_STRLEN(entry); + memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); + ptr += Z_STRLEN(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1278,15 +1278,15 @@ SPL_METHOD(RecursiveTreeIterator, key) spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix), 0); + str = zend_string_alloc(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); - ptr += Z_STRSIZE(prefix); - memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key)); - ptr += Z_STRSIZE(key); - memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); - ptr += Z_STRSIZE(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); + ptr += Z_STRLEN(prefix); + memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key)); + ptr += Z_STRLEN(key); + memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); + ptr += Z_STRLEN(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1387,7 +1387,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) } p = EG(argument_stack).top_element-2; - arg_count = (php_uint_t) *p; + arg_count = (zend_ulong) *p; func_params = safe_emalloc(sizeof(zval **), arg_count, 0); @@ -1457,7 +1457,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_LimitIterator: { intern->u.limit.offset = 0; /* start at beginning */ intern->u.limit.count = -1; /* get all */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1475,8 +1475,8 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z } case DIT_CachingIterator: case DIT_RecursiveCachingIterator: { - php_int_t flags = CIT_CALL_TOSTRING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &zobject, ce_inner, &flags) == FAILURE) { + zend_long flags = CIT_CALL_TOSTRING; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1539,12 +1539,12 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_RegexIterator: case DIT_RecursiveRegexIterator: { zend_string *regex; - php_int_t mode = REGIT_MODE_MATCH; + zend_long mode = REGIT_MODE_MATCH; intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5; intern->u.regex.flags = 0; intern->u.regex.preg_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|iii", &zobject, ce_inner, ®ex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, ®ex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1554,7 +1554,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z return NULL; } intern->u.regex.mode = mode; - intern->u.regex.regex = STR_COPY(regex); + intern->u.regex.regex = zend_string_copy(regex); intern->u.regex.pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC); if (intern->u.regex.pce == NULL) { /* pcre_get_compiled_regex_cache has already sent error */ @@ -1709,7 +1709,7 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T ZVAL_UNDEF(&intern->current.key); } } else { - ZVAL_INT(&intern->current.key, intern->current.pos); + ZVAL_LONG(&intern->current.key, intern->current.pos); } return EG(exception) ? FAILURE : SUCCESS; } @@ -2049,10 +2049,10 @@ SPL_METHOD(RegexIterator, accept) use_copy = zend_make_printable_zval(subject_ptr, &subject_copy TSRMLS_CC); if (use_copy) { subject = Z_STRVAL(subject_copy); - subject_len = Z_STRSIZE(subject_copy); + subject_len = Z_STRLEN(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRSIZE_P(subject_ptr); + subject_len = Z_STRLEN_P(subject_ptr); } use_copy = 0; @@ -2136,7 +2136,7 @@ SPL_METHOD(RegexIterator, getRegex) return; } - RETURN_STR(STR_COPY(intern->u.regex.regex)); + RETURN_STR(zend_string_copy(intern->u.regex.regex)); } /* }}} */ /* {{{ proto bool RegexIterator::getMode() @@ -2151,7 +2151,7 @@ SPL_METHOD(RegexIterator, getMode) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_INT(intern->u.regex.mode); + RETURN_LONG(intern->u.regex.mode); } /* }}} */ /* {{{ proto bool RegexIterator::setMode(int new_mode) @@ -2159,9 +2159,9 @@ SPL_METHOD(RegexIterator, getMode) SPL_METHOD(RegexIterator, setMode) { spl_dual_it_object *intern; - php_int_t mode; + zend_long mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) { return; } @@ -2187,7 +2187,7 @@ SPL_METHOD(RegexIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_INT(intern->u.regex.flags); + RETURN_LONG(intern->u.regex.flags); } /* }}} */ /* {{{ proto bool RegexIterator::setFlags(int new_flags) @@ -2195,9 +2195,9 @@ SPL_METHOD(RegexIterator, getFlags) SPL_METHOD(RegexIterator, setFlags) { spl_dual_it_object *intern; - php_int_t flags; + zend_long flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) { return; } @@ -2219,7 +2219,7 @@ SPL_METHOD(RegexIterator, getPregFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); if (intern->u.regex.use_flags) { - RETURN_INT(intern->u.regex.preg_flags); + RETURN_LONG(intern->u.regex.preg_flags); } else { return; } @@ -2230,9 +2230,9 @@ SPL_METHOD(RegexIterator, getPregFlags) SPL_METHOD(RegexIterator, setPregFlags) { spl_dual_it_object *intern; - php_int_t preg_flags; + zend_long preg_flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preg_flags) == FAILURE) { return; } @@ -2264,7 +2264,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren) zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval); if (!EG(exception)) { - ZVAL_STR(®ex, STR_COPY(intern->u.regex.regex)); + ZVAL_STR(®ex, zend_string_copy(intern->u.regex.regex)); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &retval, ®ex TSRMLS_CC); zval_ptr_dtor(®ex); } @@ -2319,7 +2319,7 @@ static void spl_dual_it_free_storage(zend_object *_object TSRMLS_DC) object->u.regex.pce->refcount--; } if (object->u.regex.regex) { - STR_RELEASE(object->u.regex.regex); + zend_string_release(object->u.regex.regex); } } #endif @@ -2472,7 +2472,7 @@ static inline int spl_limit_it_valid(spl_dual_it_object *intern TSRMLS_DC) } } -static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos TSRMLS_DC) +static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos TSRMLS_DC) { zval zpos; @@ -2486,7 +2486,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos T return; } if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { - ZVAL_INT(&zpos, pos); + ZVAL_LONG(&zpos, pos); spl_dual_it_free(intern TSRMLS_CC); zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos); zval_ptr_dtor(&zpos); @@ -2560,15 +2560,15 @@ SPL_METHOD(LimitIterator, next) SPL_METHOD(LimitIterator, seek) { spl_dual_it_object *intern; - php_int_t pos; + zend_long pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) { return; } SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); spl_limit_it_seek(intern, pos TSRMLS_CC); - RETURN_INT(intern->current.pos); + RETURN_LONG(intern->current.pos); } /* }}} */ /* {{{ proto int LimitIterator::getPosition() @@ -2577,7 +2577,7 @@ SPL_METHOD(LimitIterator, getPosition) { spl_dual_it_object *intern; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_INT(intern->current.pos); + RETURN_LONG(intern->current.pos); } /* }}} */ ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0) @@ -2660,7 +2660,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) return; } } else { - ZVAL_INT(&zflags, intern->u.caching.flags & CIT_PUBLIC); + ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, &zchildren, &zflags TSRMLS_CC); zval_ptr_dtor(&zchildren); } @@ -2792,7 +2792,7 @@ SPL_METHOD(CachingIterator, __toString) return; } if (Z_TYPE(intern->u.caching.zstr) == IS_STRING) { - RETURN_STR(STR_COPY(Z_STR_P(&intern->u.caching.zstr))); + RETURN_STR(zend_string_copy(Z_STR_P(&intern->u.caching.zstr))); } else { RETURN_NULL(); } @@ -2929,7 +2929,7 @@ SPL_METHOD(CachingIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_INT(intern->u.caching.flags); + RETURN_LONG(intern->u.caching.flags); } /* }}} */ @@ -2938,11 +2938,11 @@ SPL_METHOD(CachingIterator, getFlags) SPL_METHOD(CachingIterator, setFlags) { spl_dual_it_object *intern; - php_int_t flags; + zend_long flags; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) { return; } @@ -2983,7 +2983,7 @@ SPL_METHOD(CachingIterator, count) return; } - RETURN_INT(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); + RETURN_LONG(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); } /* }}} */ @@ -3574,7 +3574,7 @@ PHP_FUNCTION(iterator_to_array) static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */ { - (*(php_int_t*)puser)++; + (*(zend_long*)puser)++; return ZEND_HASH_APPLY_KEEP; } /* }}} */ @@ -3584,14 +3584,14 @@ static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRM PHP_FUNCTION(iterator_count) { zval *obj; - php_int_t count = 0; + zend_long count = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { RETURN_FALSE; } if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) { - RETURN_INT(count); + RETURN_LONG(count); } } /* }}} */ @@ -3599,7 +3599,7 @@ PHP_FUNCTION(iterator_count) typedef struct { zval *obj; zval *args; - php_int_t count; + zend_long count; zend_fcall_info fci; zend_fcall_info_cache fcc; } spl_iterator_apply_info; @@ -3636,7 +3636,7 @@ PHP_FUNCTION(iterator_apply) apply_info.count = 0; zend_fcall_info_args(&apply_info.fci, apply_info.args TSRMLS_CC); if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info TSRMLS_CC) == SUCCESS) { - RETVAL_INT(apply_info.count); + RETVAL_LONG(apply_info.count); } else { RETVAL_FALSE; } @@ -3682,10 +3682,10 @@ PHP_MINIT_FUNCTION(spl_iterators) spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator; spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs; - REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); - REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); - REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); - REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); REGISTER_SPL_INTERFACE(OuterIterator); REGISTER_SPL_ITERATOR(OuterIterator); @@ -3718,12 +3718,12 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); - REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); + REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator); REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator); @@ -3737,13 +3737,13 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator); #if HAVE_PCRE || HAVE_BUNDLED_PCRE REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "USE_KEY", REGIT_USE_KEY); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "MATCH", REGIT_MODE_MATCH); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); - REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); + REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0); REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator); REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator); @@ -3756,14 +3756,14 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_ITERATOR(EmptyIterator); REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_LEFT", 0); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_LAST", 4); - REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_RIGHT", 5); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT", 0); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_LAST", 4); + REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_RIGHT", 5); return SUCCESS; } diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 851436350b..7435ce7f27 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -139,11 +139,11 @@ typedef struct _spl_dual_it_object { dual_it_type dit_type; union { struct { - php_int_t offset; - php_int_t count; + zend_long offset; + zend_long count; } limit; struct { - php_int_t flags; /* CIT_* */ + zend_long flags; /* CIT_* */ zval zstr; zval zchildren; zval zcache; @@ -155,9 +155,9 @@ typedef struct _spl_dual_it_object { #if HAVE_PCRE || HAVE_BUNDLED_PCRE struct { int use_flags; - php_int_t flags; + zend_long flags; regex_mode mode; - php_int_t preg_flags; + zend_long preg_flags; pcre_cache_entry *pce; zend_string *regex; } regex; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 26f6f5a651..afc184f71b 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -81,9 +81,9 @@ PHPAPI zend_object_handlers spl_handler_SplObjectStorage; typedef struct _spl_SplObjectStorage { /* {{{ */ HashTable storage; - php_int_t index; + zend_long index; HashPosition pos; - php_int_t flags; + zend_long flags; zend_function *fptr_get_hash; HashTable *debug_info; zend_object std; @@ -133,7 +133,7 @@ static zend_string *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zv return NULL; } } else { - zend_string *hash = STR_ALLOC(sizeof(zend_object*), 0); + zend_string *hash = zend_string_alloc(sizeof(zend_object*), 0); memcpy(hash->val, (void*)&Z_OBJ_P(obj), sizeof(zend_object*)); hash->val[hash->len] = '\0'; return hash; @@ -170,7 +170,7 @@ static zend_string *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zv } static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, zend_string *hash) { - STR_RELEASE(hash); + zend_string_release(hash); /* if (intern->fptr_get_hash) { } else { @@ -338,12 +338,12 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D add_assoc_zval_ex(&tmp, "obj", sizeof("obj") - 1, &element->obj); add_assoc_zval_ex(&tmp, "inf", sizeof("inf") - 1, &element->inf); zend_hash_update(Z_ARRVAL(storage), md5str, &tmp); - STR_RELEASE(md5str); + zend_string_release(md5str); } ZEND_HASH_FOREACH_END(); zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", sizeof("storage")-1 TSRMLS_CC); zend_symtable_update(intern->debug_info, zname, &storage); - STR_RELEASE(zname); + zend_string_release(zname); } return intern->debug_info; @@ -398,7 +398,7 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2 TSRMLS_DC) /* {{{ return 1; } - return Z_IVAL(result); + return Z_LVAL(result); } /* }}} */ @@ -523,7 +523,7 @@ SPL_METHOD(SplObjectStorage, addAll) spl_object_storage_addall(intern, getThis(), other TSRMLS_CC); - RETURN_INT(zend_hash_num_elements(&intern->storage)); + RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) @@ -551,7 +551,7 @@ SPL_METHOD(SplObjectStorage, removeAll) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_INT(zend_hash_num_elements(&intern->storage)); + RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAllExcept(SplObjectStorage $os) @@ -578,7 +578,7 @@ SPL_METHOD(SplObjectStorage, removeAllExcept) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_INT(zend_hash_num_elements(&intern->storage)); + RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ @@ -600,25 +600,25 @@ SPL_METHOD(SplObjectStorage, contains) SPL_METHOD(SplObjectStorage, count) { spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); - php_int_t mode = COUNT_NORMAL; + zend_long mode = COUNT_NORMAL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { return; } if (mode == COUNT_RECURSIVE) { - php_int_t ret = zend_hash_num_elements(&intern->storage); + zend_long ret = zend_hash_num_elements(&intern->storage); zval *element; ZEND_HASH_FOREACH_VAL(&intern->storage, element) { ret += php_count_recursive(element, mode TSRMLS_CC); } ZEND_HASH_FOREACH_END(); - RETURN_INT(ret); + RETURN_LONG(ret); return; } - RETURN_INT(zend_hash_num_elements(&intern->storage)); + RETURN_LONG(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto void SplObjectStorage::rewind() @@ -658,7 +658,7 @@ SPL_METHOD(SplObjectStorage, key) return; } - RETURN_INT(intern->index); + RETURN_LONG(intern->index); } /* }}} */ /* {{{ proto mixed SplObjectStorage::current() @@ -748,7 +748,7 @@ SPL_METHOD(SplObjectStorage, serialize) /* storage */ smart_str_appendl(&buf, "x:", 2); - ZVAL_INT(&flags, zend_hash_num_elements(&intern->storage)); + ZVAL_LONG(&flags, zend_hash_num_elements(&intern->storage)); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -797,7 +797,7 @@ SPL_METHOD(SplObjectStorage, unserialize) php_unserialize_data_t var_hash; zval entry, pmembers, pcount, inf; spl_SplObjectStorageElement *element; - php_int_t count; + zend_long count; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; @@ -819,13 +819,13 @@ SPL_METHOD(SplObjectStorage, unserialize) if (!php_var_unserialize(&pcount, &p, s + buf_len, &var_hash TSRMLS_CC)) { goto outexcept; } - if (Z_TYPE(pcount) != IS_INT) { + if (Z_TYPE(pcount) != IS_LONG) { zval_ptr_dtor(&pcount); goto outexcept; } --p; /* for ';' */ - count = Z_IVAL(pcount); + count = Z_LVAL(pcount); while (count-- > 0) { spl_SplObjectStorageElement *pelement; @@ -906,7 +906,7 @@ SPL_METHOD(SplObjectStorage, unserialize) outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len); return; } /* }}} */ @@ -983,12 +983,12 @@ typedef enum { SPL_METHOD(MultipleIterator, __construct) { spl_SplObjectStorage *intern; - php_int_t flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC; + zend_long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1008,7 +1008,7 @@ SPL_METHOD(MultipleIterator, getFlags) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_INT(intern->flags); + RETURN_LONG(intern->flags); } /* }}} */ @@ -1019,7 +1019,7 @@ SPL_METHOD(MultipleIterator, setFlags) spl_SplObjectStorage *intern; intern = Z_SPLOBJSTORAGE_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) { return; } } @@ -1042,7 +1042,7 @@ SPL_METHOD(MultipleIterator, attachIterator) spl_SplObjectStorageElement *element; zval compare_result; - if (Z_TYPE_P(info) != IS_INT && Z_TYPE_P(info) != IS_STRING) { + if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) { zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0 TSRMLS_CC); return; } @@ -1115,7 +1115,7 @@ SPL_METHOD(MultipleIterator, valid) spl_SplObjectStorage *intern; spl_SplObjectStorageElement *element; zval *it, retval; - php_int_t expect, valid; + zend_long expect, valid; intern = Z_SPLOBJSTORAGE_P(getThis()); @@ -1200,8 +1200,8 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ if (intern->flags & MIT_KEYS_ASSOC) { switch (Z_TYPE(element->inf)) { - case IS_INT: - add_index_zval(return_value, Z_IVAL(element->inf), &retval); + case IS_LONG: + add_index_zval(return_value, Z_LVAL(element->inf), &retval); break; case IS_STRING: zend_hash_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval); @@ -1309,10 +1309,10 @@ PHP_MINIT_FUNCTION(spl_observer) REGISTER_SPL_STD_CLASS_EX(MultipleIterator, spl_SplObjectStorage_new, spl_funcs_MultipleIterator); REGISTER_SPL_ITERATOR(MultipleIterator); - REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); - REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); - REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); - REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); + REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); + REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); + REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); + REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); return SUCCESS; } diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h index a75b340e2c..5a291a9a50 100644 --- a/ext/sqlite3/php_sqlite3_structs.h +++ b/ext/sqlite3/php_sqlite3_structs.h @@ -38,9 +38,9 @@ /* Structure for SQLite Statement Parameter. */ struct php_sqlite3_bound_param { - php_int_t param_number; + zend_long param_number; zend_string *name; - php_int_t type; + zend_long type; zval parameter; }; @@ -91,7 +91,7 @@ static inline php_sqlite3_db_object *php_sqlite3_db_from_obj(zend_object *obj) { /* Structure for SQLite Database object. */ typedef struct _php_sqlite3_agg_context { zval zval_context; - php_int_t row_count; + zend_long row_count; } php_sqlite3_agg_context; typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt; diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 6643506c1a..1bafae2d06 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -103,13 +103,13 @@ PHP_METHOD(sqlite3, open) zval *object = getThis(); char *filename, *encryption_key, *fullpath; int filename_len, encryption_key_len = 0; - php_int_t flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; + zend_long flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; zend_error_handling error_handling; db_obj = Z_SQLITE3_DB_P(object); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|is", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -249,7 +249,7 @@ PHP_METHOD(sqlite3, version) array_init(return_value); add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion()); - add_assoc_int(return_value, "versionNumber", sqlite3_libversion_number()); + add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number()); return; } @@ -269,7 +269,7 @@ PHP_METHOD(sqlite3, lastInsertRowID) return; } - RETURN_INT(sqlite3_last_insert_rowid(db_obj->db)); + RETURN_LONG(sqlite3_last_insert_rowid(db_obj->db)); } /* }}} */ @@ -287,7 +287,7 @@ PHP_METHOD(sqlite3, lastErrorCode) return; } - RETURN_INT(sqlite3_errcode(db_obj->db)); + RETURN_LONG(sqlite3_errcode(db_obj->db)); } /* }}} */ @@ -315,13 +315,13 @@ PHP_METHOD(sqlite3, busyTimeout) { php_sqlite3_db_object *db_obj; zval *object = getThis(); - php_int_t ms; + zend_long ms; int return_code; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ms)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ms)) { return; } @@ -424,7 +424,7 @@ PHP_METHOD(sqlite3, changes) return; } - RETURN_INT(sqlite3_changes(db_obj->db)); + RETURN_LONG(sqlite3_changes(db_obj->db)); } /* }}} */ @@ -580,7 +580,7 @@ static void sqlite_value_to_zval(sqlite3_stmt *stmt, int column, zval *data) /* if ((sqlite3_column_int64(stmt, column)) >= INT_MAX || sqlite3_column_int64(stmt, column) <= INT_MIN) { ZVAL_STRINGL(data, (char *)sqlite3_column_text(stmt, column), sqlite3_column_bytes(stmt, column)); } else { - ZVAL_INT(data, sqlite3_column_int64(stmt, column)); + ZVAL_LONG(data, sqlite3_column_int64(stmt, column)); } break; @@ -713,16 +713,16 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s ZVAL_NULL(&agg_context->zval_context); } ZVAL_COPY_VALUE(&zargs[0], &agg_context->zval_context); - ZVAL_INT(&zargs[1], agg_context->row_count); + ZVAL_LONG(&zargs[1], agg_context->row_count); } for (i = 0; i < argc; i++) { switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: #if PHP_INT_MAX > 2147483647 - ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); + ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); #else - ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); #endif break; @@ -764,11 +764,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_INT: + case IS_LONG: #if PHP_INT_MAX > 2147483647 - sqlite3_result_int64(context, Z_IVAL(retval)); + sqlite3_result_int64(context, Z_LVAL(retval)); #else - sqlite3_result_int(context, Z_IVAL(retval)); + sqlite3_result_int(context, Z_LVAL(retval)); #endif break; @@ -782,7 +782,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); break; } } else { @@ -873,13 +873,13 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in zval_ptr_dtor(&zargs[1]); efree(zargs); - //retval ought to contain a ZVAL_INT by now + //retval ought to contain a ZVAL_LONG by now // (the result of a comparison, i.e. most likely -1, 0, or 1) //I suppose we could accept any scalar return type, though. - if (Z_TYPE(retval) != IS_INT){ + if (Z_TYPE(retval) != IS_LONG){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the compare callback (invalid return type). Collation behaviour is undefined."); }else{ - ret = Z_IVAL(retval); + ret = Z_LVAL(retval); } zval_ptr_dtor(&retval); @@ -899,12 +899,12 @@ PHP_METHOD(sqlite3, createFunction) int sql_func_len; zval *callback_func; zend_string *callback_name; - php_int_t sql_func_num_args = -1; + zend_long sql_func_num_args = -1; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) { return; } @@ -914,10 +914,10 @@ PHP_METHOD(sqlite3, createFunction) if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) { php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); RETURN_FALSE; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); func = (php_sqlite3_func *)ecalloc(1, sizeof(*func)); @@ -949,12 +949,12 @@ PHP_METHOD(sqlite3, createAggregate) zend_string *callback_name; int sql_func_len; zval *step_callback, *fini_callback; - php_int_t sql_func_num_args = -1; + zend_long sql_func_num_args = -1; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) { return; } @@ -964,17 +964,17 @@ PHP_METHOD(sqlite3, createAggregate) if (!zend_is_callable(step_callback, 0, &callback_name TSRMLS_CC)) { php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); RETURN_FALSE; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); if (!zend_is_callable(fini_callback, 0, &callback_name TSRMLS_CC)) { php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); RETURN_FALSE; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); func = (php_sqlite3_func *)ecalloc(1, sizeof(*func)); @@ -1021,10 +1021,10 @@ PHP_METHOD(sqlite3, createCollation) if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) { php_sqlite3_error(db_obj, "Not a valid callback function %s", callback_name->val); - STR_RELEASE(callback_name); + zend_string_release(callback_name); RETURN_FALSE; } - STR_RELEASE(callback_name); + zend_string_release(callback_name); collation = (php_sqlite3_collation *)ecalloc(1, sizeof(*collation)); if (sqlite3_create_collation(db_obj->db, collation_name, SQLITE_UTF8, collation, php_sqlite3_callback_compare) == SQLITE_OK) { @@ -1187,7 +1187,7 @@ PHP_METHOD(sqlite3, openBlob) zval *object = getThis(); char *table, *column, *dbname = "main"; int table_len, column_len, dbname_len; - php_int_t rowid, flags = 0; + zend_long rowid, flags = 0; sqlite3_blob *blob = NULL; php_stream_sqlite3_data *sqlite3_stream; php_stream *stream; @@ -1196,7 +1196,7 @@ PHP_METHOD(sqlite3, openBlob) SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) { return; } @@ -1254,7 +1254,7 @@ PHP_METHOD(sqlite3stmt, paramCount) SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); - RETURN_INT(sqlite3_bind_parameter_count(stmt_obj->stmt)); + RETURN_LONG(sqlite3_bind_parameter_count(stmt_obj->stmt)); } /* }}} */ @@ -1361,19 +1361,19 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa if (param->name) { if (param->name->val[0] != ':') { /* pre-increment for character + 1 for null */ - zend_string *temp = STR_ALLOC(param->name->len + 1, 0); + zend_string *temp = zend_string_alloc(param->name->len + 1, 0); temp->val[0] = ':'; memmove(temp->val + 1, param->name->val, param->name->len + 1); param->name = temp; } else { - param->name = STR_INIT(param->name->val, param->name->len, 0); + param->name = zend_string_init(param->name->val, param->name->len, 0); } /* do lookup*/ param->param_number = sqlite3_bind_parameter_index(stmt->stmt, param->name->val); } if (param->param_number < 1) { - STR_RELEASE(param->name); + zend_string_release(param->name); return 0; } @@ -1404,7 +1404,7 @@ PHP_METHOD(sqlite3stmt, bindParam) param.param_number = -1; param.type = SQLITE3_TEXT; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz|i", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", ¶m.name, ¶meter, ¶m.type) == FAILURE) { return; } @@ -1438,8 +1438,8 @@ PHP_METHOD(sqlite3stmt, bindValue) param.param_number = -1; param.type = SQLITE3_TEXT; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", ¶m.name, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", ¶m.name, ¶meter, ¶m.type) == FAILURE) { return; } } @@ -1497,9 +1497,9 @@ PHP_METHOD(sqlite3stmt, execute) case SQLITE_INTEGER: convert_to_int(parameter); #if PHP_INT_MAX > 2147483647 - sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); + sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); #else - sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); + sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); #endif break; @@ -1527,14 +1527,14 @@ PHP_METHOD(sqlite3stmt, execute) sqlite3_bind_blob(stmt_obj->stmt, param->param_number, buffer->val, buffer->len, SQLITE_TRANSIENT); if (stream) { - STR_RELEASE(buffer); + zend_string_release(buffer); } break; } case SQLITE3_TEXT: convert_to_string(parameter); - sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRSIZE_P(parameter), SQLITE_STATIC); + sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRLEN_P(parameter), SQLITE_STATIC); break; case SQLITE_NULL: @@ -1643,7 +1643,7 @@ PHP_METHOD(sqlite3result, numColumns) return; } - RETURN_INT(sqlite3_column_count(result_obj->stmt_obj->stmt)); + RETURN_LONG(sqlite3_column_count(result_obj->stmt_obj->stmt)); } /* }}} */ @@ -1653,13 +1653,13 @@ PHP_METHOD(sqlite3result, columnName) { php_sqlite3_result *result_obj; zval *object = getThis(); - php_int_t column = 0; + zend_long column = 0; char *column_name; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { return; } column_name = (char*) sqlite3_column_name(result_obj->stmt_obj->stmt, column); @@ -1678,12 +1678,12 @@ PHP_METHOD(sqlite3result, columnType) { php_sqlite3_result *result_obj; zval *object = getThis(); - php_int_t column = 0; + zend_long column = 0; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { return; } @@ -1691,7 +1691,7 @@ PHP_METHOD(sqlite3result, columnType) RETURN_FALSE; } - RETURN_INT(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); + RETURN_LONG(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); } /* }}} */ @@ -1702,12 +1702,12 @@ PHP_METHOD(sqlite3result, fetchArray) php_sqlite3_result *result_obj; zval *object = getThis(); int i, ret; - php_int_t mode = PHP_SQLITE3_BOTH; + zend_long mode = PHP_SQLITE3_BOTH; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { return; } @@ -2170,7 +2170,7 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */ struct php_sqlite3_bound_param *param = (struct php_sqlite3_bound_param*)Z_PTR_P(data); if (param->name) { - STR_RELEASE(param->name); + zend_string_release(param->name); } if (!Z_ISNULL(param->parameter)) { @@ -2225,19 +2225,19 @@ PHP_MINIT_FUNCTION(sqlite3) REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } diff --git a/ext/standard/array.c b/ext/standard/array.c index 22a26941ed..3ddb1c6218 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -99,33 +99,33 @@ PHP_MINIT_FUNCTION(array) /* {{{ */ { ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); - REGISTER_INT_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -141,7 +141,7 @@ PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */ } /* }}} */ -static void php_set_compare_func(php_int_t sort_type TSRMLS_DC) /* {{{ */ +static void php_set_compare_func(zend_long sort_type TSRMLS_DC) /* {{{ */ { switch (sort_type & ~PHP_SORT_FLAG_CASE) { case PHP_SORT_NUMERIC: @@ -182,13 +182,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ s = (Bucket *) b; if (f->key == NULL) { - ZVAL_INT(&first, f->h); + ZVAL_LONG(&first, f->h); } else { ZVAL_STR(&first, f->key); } if (s->key == 0) { - ZVAL_INT(&second, s->h); + ZVAL_LONG(&second, s->h); } else { ZVAL_STR(&second, s->key); } @@ -197,13 +197,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_INT)) { - return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_LONG)) { + return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - return ZEND_NORMALIZE_BOOL(zval_get_int(&result)); + return ZEND_NORMALIZE_BOOL(zval_get_long(&result)); } /* }}} */ @@ -218,9 +218,9 @@ static int php_array_reverse_key_compare(const void *a, const void *b TSRMLS_DC) PHP_FUNCTION(krsort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -238,9 +238,9 @@ PHP_FUNCTION(krsort) PHP_FUNCTION(ksort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -253,9 +253,9 @@ PHP_FUNCTION(ksort) } /* }}} */ -PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC) /* {{{ */ +PHPAPI zend_long php_count_recursive(zval *array, zend_long mode TSRMLS_DC) /* {{{ */ { - php_int_t cnt = 0; + zend_long cnt = 0; zval *element; if (Z_TYPE_P(array) == IS_ARRAY) { @@ -288,25 +288,25 @@ PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC) /* { PHP_FUNCTION(count) { zval *array; - php_int_t mode = COUNT_NORMAL; - php_int_t cnt; + zend_long mode = COUNT_NORMAL; + zend_long cnt; zval *element; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &array, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(array) Z_PARAM_OPTIONAL - Z_PARAM_INT(mode) + Z_PARAM_LONG(mode) ZEND_PARSE_PARAMETERS_END(); #endif switch (Z_TYPE_P(array)) { case IS_NULL: - RETURN_INT(0); + RETURN_LONG(0); break; case IS_ARRAY: cnt = zend_hash_num_elements(Z_ARRVAL_P(array)); @@ -316,7 +316,7 @@ PHP_FUNCTION(count) cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC); } ZEND_HASH_FOREACH_END(); } - RETURN_INT(cnt); + RETURN_LONG(cnt); break; case IS_OBJECT: { #ifdef HAVE_SPL @@ -324,8 +324,8 @@ PHP_FUNCTION(count) #endif /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { - RETVAL_INT(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_IVAL_P(return_value) TSRMLS_CC)) { + RETVAL_LONG(1); + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) { return; } } @@ -334,7 +334,7 @@ PHP_FUNCTION(count) if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { - RETVAL_INT(zval_get_int(&retval)); + RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); } return; @@ -342,7 +342,7 @@ PHP_FUNCTION(count) #endif } default: - RETURN_INT(1); + RETURN_LONG(1); break; } } @@ -378,13 +378,13 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_INT)) { - return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_LONG)) { + return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - return ZEND_NORMALIZE_BOOL(zval_get_int(&result)); + return ZEND_NORMALIZE_BOOL(zval_get_long(&result)); } /* }}} */ @@ -403,8 +403,8 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f int result = strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, fold_case); - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); return result; } /* }}} */ @@ -464,9 +464,9 @@ PHP_FUNCTION(natcasesort) PHP_FUNCTION(asort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -484,9 +484,9 @@ PHP_FUNCTION(asort) PHP_FUNCTION(arsort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -504,9 +504,9 @@ PHP_FUNCTION(arsort) PHP_FUNCTION(sort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -524,9 +524,9 @@ PHP_FUNCTION(sort) PHP_FUNCTION(rsort) { zval *array; - php_int_t sort_type = PHP_SORT_REGULAR; + zend_long sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -557,7 +557,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ BG(user_compare_fci).retval = &retval; BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - php_int_t ret = zval_get_int(&retval); + zend_long ret = zval_get_long(&retval); zval_ptr_dtor(&retval); zval_ptr_dtor(&args[1]); zval_ptr_dtor(&args[0]); @@ -695,7 +695,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Bucket *s; zval args[2]; zval retval; - php_int_t result; + zend_long result; ZVAL_NULL(&args[0]); ZVAL_NULL(&args[1]); @@ -704,14 +704,14 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* s = (Bucket *) b; if (f->key == NULL) { - ZVAL_INT(&args[0], f->h); + ZVAL_LONG(&args[0], f->h); } else { - ZVAL_STR(&args[0], STR_COPY(f->key)); + ZVAL_STR(&args[0], zend_string_copy(f->key)); } if (s->key == NULL) { - ZVAL_INT(&args[1], s->h); + ZVAL_LONG(&args[1], s->h); } else { - ZVAL_STR(&args[1], STR_COPY(s->key)); + ZVAL_STR(&args[1], zend_string_copy(s->key)); } BG(user_compare_fci).param_count = 2; @@ -719,7 +719,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* BG(user_compare_fci).retval = &retval; BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - result = zval_get_int(&retval); + result = zval_get_long(&retval); zval_ptr_dtor(&retval); } else { result = 0; @@ -1230,7 +1230,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ *array, /* array to check in */ *entry, /* pointer to array entry */ res; /* comparison result */ - php_uint_t num_idx; + zend_ulong num_idx; zend_string *str_idx; zend_bool strict = 0; /* strict comparison or not */ @@ -1256,9 +1256,9 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR(STR_COPY(str_idx)); + RETVAL_STR(zend_string_copy(str_idx)); } else { - RETVAL_INT(num_idx); + RETVAL_LONG(num_idx); } return; } @@ -1271,9 +1271,9 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR(STR_COPY(str_idx)); + RETVAL_STR(zend_string_copy(str_idx)); } else { - RETVAL_INT(num_idx); + RETVAL_LONG(num_idx); } return; } @@ -1339,14 +1339,14 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix)); + ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_'; + Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1357,15 +1357,15 @@ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int va PHP_FUNCTION(extract) { zval *var_array, *prefix = NULL; - php_int_t extract_type = EXTR_OVERWRITE; + zend_long extract_type = EXTR_OVERWRITE; zval *entry; zend_string *var_name; - php_uint_t num_key; + zend_ulong num_key; int var_exists, count = 0; int extract_refs = 0; zend_array *symbol_table; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|iz/", &var_array, &extract_type, &prefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|lz/", &var_array, &extract_type, &prefix) == FAILURE) { return; } @@ -1384,7 +1384,7 @@ PHP_FUNCTION(extract) if (prefix) { convert_to_string(prefix); - if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) { + if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; } @@ -1403,9 +1403,9 @@ PHP_FUNCTION(extract) } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) { zval num; - ZVAL_INT(&num, num_key); + ZVAL_LONG(&num, num_key); convert_to_string(&num); - php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); zval_dtor(&num); } else { continue; @@ -1424,7 +1424,7 @@ PHP_FUNCTION(extract) if (var_exists && var_name->len == sizeof("this")-1 && !strcmp(var_name->val, "this") && EG(scope) && EG(scope)->name->len != 0) { break; } - ZVAL_STR(&final_name, STR_COPY(var_name)); + ZVAL_STR(&final_name, zend_string_copy(var_name)); break; case EXTR_PREFIX_IF_EXISTS: @@ -1435,7 +1435,7 @@ PHP_FUNCTION(extract) case EXTR_PREFIX_SAME: if (!var_exists && var_name->len != 0) { - ZVAL_STR(&final_name, STR_COPY(var_name)); + ZVAL_STR(&final_name, zend_string_copy(var_name)); } /* break omitted intentionally */ @@ -1450,19 +1450,19 @@ PHP_FUNCTION(extract) if (!php_valid_var_name(var_name->val, var_name->len)) { php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1 TSRMLS_CC); } else { - ZVAL_STR(&final_name, STR_COPY(var_name)); + ZVAL_STR(&final_name, zend_string_copy(var_name)); } } break; default: if (!var_exists) { - ZVAL_STR(&final_name, STR_COPY(var_name)); + ZVAL_STR(&final_name, zend_string_copy(var_name)); } break; } - if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) { + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { if (extract_refs) { zval *orig_var; @@ -1487,7 +1487,7 @@ PHP_FUNCTION(extract) zval_dtor(&final_name); } ZEND_HASH_FOREACH_END(); - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ @@ -1554,9 +1554,9 @@ PHP_FUNCTION(compact) PHP_FUNCTION(array_fill) { zval *val; - php_int_t start_key, num; + zend_long start_key, num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiz", &start_key, &num, &val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz", &start_key, &num, &val) == FAILURE) { return; } @@ -1603,16 +1603,16 @@ PHP_FUNCTION(array_fill_keys) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), entry) { ZVAL_DEREF(entry); - if (Z_TYPE_P(entry) == IS_INT) { + if (Z_TYPE_P(entry) == IS_LONG) { zval_add_ref(val); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), val); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), val); } else { zend_string *key = zval_get_string(entry); zval_add_ref(val); zend_symtable_update(Z_ARRVAL_P(return_value), key, val); - STR_RELEASE(key); + zend_string_release(key); } } ZEND_HASH_FOREACH_END(); } @@ -1632,7 +1632,7 @@ PHP_FUNCTION(range) if (zstep) { if (Z_TYPE_P(zstep) == IS_DOUBLE || - (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE) + (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE) ) { is_step_double = 1; } @@ -1649,17 +1649,17 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { int type1, type2; unsigned char low, high; - php_int_t lstep = (php_int_t) step; + zend_long lstep = (zend_long) step; - type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0); - type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0); + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { goto double_str; - } else if (type1 == IS_INT || type2 == IS_INT) { + } else if (type1 == IS_LONG || type2 == IS_LONG) { goto long_str; } @@ -1673,7 +1673,7 @@ PHP_FUNCTION(range) } for (; low >= high; low -= (unsigned int)lstep) { if (CG(one_char_string)[low]) { - ZVAL_INT_STR(&tmp, CG(one_char_string)[low]); + ZVAL_LONG_STR(&tmp, CG(one_char_string)[low]); } else { ZVAL_STRINGL(&tmp, (char*)&low, 1); } @@ -1689,7 +1689,7 @@ PHP_FUNCTION(range) } for (; low <= high; low += (unsigned int)lstep) { if (CG(one_char_string)[low]) { - ZVAL_INT_STR(&tmp, CG(one_char_string)[low]); + ZVAL_LONG_STR(&tmp, CG(one_char_string)[low]); } else { ZVAL_STRINGL(&tmp, (char*)&low, 1); } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(range) } } else { if (CG(one_char_string)[low]) { - ZVAL_INT_STR(&tmp, CG(one_char_string)[low]); + ZVAL_LONG_STR(&tmp, CG(one_char_string)[low]); } else { ZVAL_STRINGL(&tmp, (char*)&low, 1); } @@ -1709,7 +1709,7 @@ PHP_FUNCTION(range) } else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) { double low, high, value; - php_int_t i; + zend_long i; double_str: low = zval_get_double(zlow); high = zval_get_double(zhigh); @@ -1742,20 +1742,20 @@ double_str: } } else { double low, high; - php_int_t lstep; + zend_long lstep; long_str: low = zval_get_double(zlow); high = zval_get_double(zhigh); - lstep = (php_int_t) step; + lstep = (zend_long) step; - Z_TYPE_INFO(tmp) = IS_INT; + Z_TYPE_INFO(tmp) = IS_LONG; if (low > high) { /* Negative steps */ if (low - high < lstep || lstep <= 0) { err = 1; goto err; } for (; low >= high; low -= lstep) { - Z_IVAL(tmp) = (php_int_t)low; + Z_LVAL(tmp) = (zend_long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else if (high > low) { /* Positive steps */ @@ -1764,11 +1764,11 @@ long_str: goto err; } for (; low <= high; low += lstep) { - Z_IVAL(tmp) = (php_int_t)low; + Z_LVAL(tmp) = (zend_long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else { - Z_IVAL(tmp) = (php_int_t)low; + Z_LVAL(tmp) = (zend_long)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } @@ -1824,7 +1824,7 @@ static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */ for (j = 0; j < n_elems; j++) { p = hash->arData + j; if (p->key && !IS_INTERNED(p->key)) { - STR_RELEASE(p->key); + zend_string_release(p->key); } p->h = j; p->key = NULL; @@ -1985,7 +1985,7 @@ PHP_FUNCTION(array_push) } /* Clean up and return the number of values in the stack */ - RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -1995,7 +1995,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zval *stack, /* Input stack */ *val; /* Value to be popped */ zend_string *key = NULL; - php_uint_t index; + zend_ulong index; #ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &stack) == FAILURE) { @@ -2129,7 +2129,7 @@ PHP_FUNCTION(array_unshift) zend_hash_destroy(&old_hash); /* Clean up and return the number of elements in the stack */ - RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -2145,13 +2145,13 @@ PHP_FUNCTION(array_splice) HashTable old_hash; uint idx; Bucket *p; /* Bucket used for traversing hash */ - php_int_t i, + zend_long i, offset, length = 0, repl_num = 0; /* Number of replacement elements */ int num_in; /* Number of elements in the input array */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/i|iz/", &array, &offset, &length, &repl_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/l|lz/", &array, &offset, &length, &repl_array) == FAILURE) { return; } @@ -2190,7 +2190,7 @@ PHP_FUNCTION(array_splice) /* ..and the length */ if (length < 0) { size = num_in - offset + length; - } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) { + } else if (((zend_ulong) offset + (zend_ulong) length) > (unsigned) num_in) { size = num_in - offset; } @@ -2222,22 +2222,22 @@ PHP_FUNCTION(array_slice) zval *input, /* Input array */ *z_length = NULL, /* How many elements to get */ *entry; /* An array entry */ - php_int_t offset, /* Offset to get elements from */ + zend_long offset, /* Offset to get elements from */ length = 0; zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ int num_in, /* Number of elements in the input array */ pos; /* Current position in the array */ zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ai|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_ARRAY(input) - Z_PARAM_INT(offset) + Z_PARAM_LONG(offset) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(z_length) Z_PARAM_BOOL(preserve_keys) @@ -2251,7 +2251,7 @@ PHP_FUNCTION(array_slice) if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) { length = num_in; } else { - length = zval_get_int(z_length); + length = zval_get_long(z_length); } /* Clamp the offset.. */ @@ -2265,7 +2265,7 @@ PHP_FUNCTION(array_slice) /* ..and the length */ if (length < 0) { length = num_in - offset + length; - } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) { + } else if (((zend_ulong) offset + (zend_ulong) length) > (unsigned) num_in) { length = num_in - offset; } @@ -2404,7 +2404,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC { zval *src_entry, *dest_entry, *src_zval, *dest_zval; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; int ret; ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) { @@ -2564,7 +2564,7 @@ PHP_FUNCTION(array_keys) new_val; /* New value */ int add_key; /* Flag to indicate whether a key should be added */ zend_bool strict = 0; /* do strict comparison */ - php_uint_t num_idx; + zend_ulong num_idx; zend_string *str_idx; int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; @@ -2602,9 +2602,9 @@ PHP_FUNCTION(array_keys) if (add_key) { if (str_idx) { - ZVAL_STR(&new_val, STR_COPY(str_idx)); + ZVAL_STR(&new_val, zend_string_copy(str_idx)); } else { - ZVAL_INT(&new_val, num_idx); + ZVAL_LONG(&new_val, num_idx); } zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &new_val); } @@ -2653,21 +2653,21 @@ PHP_FUNCTION(array_count_values) /* Go through input array and add values to the return array */ myht = Z_ARRVAL_P(input); ZEND_HASH_FOREACH_VAL(myht, entry) { - if (Z_TYPE_P(entry) == IS_INT) { - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_IVAL_P(entry))) == NULL) { + if (Z_TYPE_P(entry) == IS_LONG) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_P(entry))) == NULL) { zval data; - ZVAL_INT(&data, 1); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); + ZVAL_LONG(&data, 1); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); } else { - Z_IVAL_P(tmp)++; + Z_LVAL_P(tmp)++; } } else if (Z_TYPE_P(entry) == IS_STRING) { if ((tmp = zend_symtable_find(Z_ARRVAL_P(return_value), Z_STR_P(entry))) == NULL) { zval data; - ZVAL_INT(&data, 1); + ZVAL_LONG(&data, 1); zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { - Z_IVAL_P(tmp)++; + Z_LVAL_P(tmp)++; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!"); @@ -2686,7 +2686,7 @@ zend_bool array_column_param_helper(zval *param, case IS_DOUBLE: convert_to_int_ex(param); /* fallthrough */ - case IS_INT: + case IS_LONG: return 1; case IS_OBJECT: @@ -2736,8 +2736,8 @@ PHP_FUNCTION(array_column) } else if ((Z_TYPE_P(zcolumn) == IS_STRING) && ((zcolval = zend_hash_find(ht, Z_STR_P(zcolumn))) == NULL)) { continue; - } else if ((Z_TYPE_P(zcolumn) == IS_INT) && - ((zcolval = zend_hash_index_find(ht, Z_IVAL_P(zcolumn))) == NULL)) { + } else if ((Z_TYPE_P(zcolumn) == IS_LONG) && + ((zcolval = zend_hash_index_find(ht, Z_LVAL_P(zcolumn))) == NULL)) { continue; } @@ -2746,8 +2746,8 @@ PHP_FUNCTION(array_column) */ if (zkey && (Z_TYPE_P(zkey) == IS_STRING)) { zkeyval = zend_hash_find(ht, Z_STR_P(zkey)); - } else if (zkey && (Z_TYPE_P(zkey) == IS_INT)) { - zkeyval = zend_hash_index_find(ht, Z_IVAL_P(zkey)); + } else if (zkey && (Z_TYPE_P(zkey) == IS_LONG)) { + zkeyval = zend_hash_index_find(ht, Z_LVAL_P(zkey)); } if (Z_REFCOUNTED_P(zcolval)) { @@ -2755,8 +2755,8 @@ PHP_FUNCTION(array_column) } if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(zkeyval), zcolval); - } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_INT) { - add_index_zval(return_value, Z_IVAL_P(zkeyval), zcolval); + } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_LONG) { + add_index_zval(return_value, Z_LVAL_P(zkeyval), zcolval); } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_OBJECT) { SEPARATE_ZVAL(zkeyval); convert_to_string(zkeyval); @@ -2775,7 +2775,7 @@ PHP_FUNCTION(array_reverse) zval *input, /* Input array */ *entry; /* An entry in the input array */ zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; zend_bool preserve_keys = 0; /* whether to preserve keys */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &input, &preserve_keys) == FAILURE) { @@ -2810,14 +2810,14 @@ PHP_FUNCTION(array_pad) zval *pads; /* Array to pass to splice */ HashTable *new_hash;/* Return value from splice */ HashTable old_hash; - php_int_t pad_size; /* Size to pad to */ - php_int_t pad_size_abs; /* Absolute value of pad_size */ - php_int_t input_size; /* Size of the input array */ - php_int_t num_pads; /* How many pads do we need */ + zend_long pad_size; /* Size to pad to */ + zend_long pad_size_abs; /* Absolute value of pad_size */ + zend_long input_size; /* Size of the input array */ + zend_long num_pads; /* How many pads do we need */ int do_pad; /* Whether we should do padding at all */ int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aiz", &input, &pad_size, &pad_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "alz", &input, &pad_size, &pad_value) == FAILURE) { return; } @@ -2874,7 +2874,7 @@ PHP_FUNCTION(array_pad) PHP_FUNCTION(array_flip) { zval *array, *entry, data; - php_uint_t num_idx; + zend_ulong num_idx; zend_string *str_idx; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { @@ -2884,18 +2884,18 @@ PHP_FUNCTION(array_flip) array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { - if (Z_TYPE_P(entry) == IS_INT) { + if (Z_TYPE_P(entry) == IS_LONG) { if (str_idx) { - ZVAL_STR(&data, STR_COPY(str_idx)); + ZVAL_STR(&data, zend_string_copy(str_idx)); } else { - ZVAL_INT(&data, num_idx); + ZVAL_LONG(&data, num_idx); } - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); } else if (Z_TYPE_P(entry) == IS_STRING) { if (str_idx) { - ZVAL_STR(&data, STR_COPY(str_idx)); + ZVAL_STR(&data, zend_string_copy(str_idx)); } else { - ZVAL_INT(&data, num_idx); + ZVAL_LONG(&data, num_idx); } zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { @@ -2912,10 +2912,10 @@ PHP_FUNCTION(array_change_key_case) zval *array, *entry; zend_string *string_key; zend_string *new_key; - php_uint_t num_key; - php_int_t change_to_upper=0; + zend_ulong num_key; + zend_long change_to_upper=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &change_to_upper) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &change_to_upper) == FAILURE) { return; } @@ -2927,14 +2927,14 @@ PHP_FUNCTION(array_change_key_case) if (!string_key) { zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry); } else { - new_key = STR_INIT(string_key->val, string_key->len, 0); + new_key = zend_string_init(string_key->val, string_key->len, 0); if (change_to_upper) { php_strtoupper(new_key->val, new_key->len); } else { php_strtolower(new_key->val, new_key->len); } zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry); - STR_RELEASE(new_key); + zend_string_release(new_key); } } ZEND_HASH_FOREACH_END(); } @@ -2953,9 +2953,9 @@ PHP_FUNCTION(array_unique) }; struct bucketindex *arTmp, *cmpdata, *lastkept; unsigned int i; - php_int_t sort_type = PHP_SORT_STRING; + zend_long sort_type = PHP_SORT_STRING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { return; } @@ -3036,7 +3036,7 @@ static int zval_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */ } convert_to_int(&result); - return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); + return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); } /* }}} */ @@ -3061,7 +3061,7 @@ static int zval_user_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */ BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - php_int_t ret = zval_get_int(&retval); + zend_long ret = zval_get_long(&retval); zval_ptr_dtor(&retval); return ret < 0 ? -1 : ret > 0 ? 1 : 0;; } else { @@ -3935,7 +3935,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC); ARRAYG(compare_func)(&temp, &ab[r].val, &bb[r].val TSRMLS_CC); - result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_IVAL(temp); + result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp); if (result != 0) { return result; } @@ -4008,14 +4008,14 @@ PHP_FUNCTION(array_multisort) for (k = 0; k < MULTISORT_LAST; k++) { parse_state[k] = 1; } - } else if (Z_TYPE_P(arg) == IS_INT) { - switch (Z_IVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { + } else if (Z_TYPE_P(arg) == IS_LONG) { + switch (Z_LVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { case PHP_SORT_ASC: case PHP_SORT_DESC: /* flag allowed here */ if (parse_state[MULTISORT_ORDER] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_order = Z_IVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; + sort_order = Z_LVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; parse_state[MULTISORT_ORDER] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4033,7 +4033,7 @@ PHP_FUNCTION(array_multisort) /* flag allowed here */ if (parse_state[MULTISORT_TYPE] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_type = Z_IVAL(args[i]); + sort_type = Z_LVAL(args[i]); parse_state[MULTISORT_TYPE] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4141,12 +4141,12 @@ PHP_FUNCTION(array_multisort) PHP_FUNCTION(array_rand) { zval *input; - php_int_t randval, num_req = 1; + zend_long randval, num_req = 1; int num_avail; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &input, &num_req) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &input, &num_req) == FAILURE) { return; } @@ -4176,16 +4176,16 @@ PHP_FUNCTION(array_rand) /* If we are returning a single result, just do it. */ if (Z_TYPE_P(return_value) != IS_ARRAY) { if (string_key) { - RETURN_STR(STR_COPY(string_key)); + RETURN_STR(zend_string_copy(string_key)); } else { - RETURN_INT(num_key); + RETURN_LONG(num_key); } } else { /* Append the result to the return value. */ if (string_key) { - add_next_index_str(return_value, STR_COPY(string_key)); + add_next_index_str(return_value, zend_string_copy(string_key)); } else { - add_next_index_int(return_value, num_key); + add_next_index_long(return_value, num_key); } } num_req--; @@ -4207,7 +4207,7 @@ PHP_FUNCTION(array_sum) return; } - ZVAL_INT(return_value, 0); + ZVAL_LONG(return_value, 0); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) { if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) { @@ -4233,7 +4233,7 @@ PHP_FUNCTION(array_product) return; } - ZVAL_INT(return_value, 1); + ZVAL_LONG(return_value, 1); if (!zend_hash_num_elements(Z_ARRVAL_P(input))) { return; } @@ -4245,10 +4245,10 @@ PHP_FUNCTION(array_product) ZVAL_DUP(&entry_n, entry); convert_scalar_to_number(&entry_n TSRMLS_CC); - if (Z_TYPE(entry_n) == IS_INT && Z_TYPE_P(return_value) == IS_INT) { - dval = (double)Z_IVAL_P(return_value) * (double)Z_IVAL(entry_n); + if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { + dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n); if ( (double)PHP_INT_MIN <= dval && dval <= (double)PHP_INT_MAX ) { - Z_IVAL_P(return_value) *= Z_IVAL(entry_n); + Z_LVAL_P(return_value) *= Z_LVAL(entry_n); continue; } } @@ -4328,13 +4328,13 @@ PHP_FUNCTION(array_filter) zval args[2]; zval retval; zend_bool have_callback = 0; - php_int_t use_type = 0; + zend_long use_type = 0; zend_string *string_key; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; - php_uint_t num_key; + zend_ulong num_key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fi", &array, &fci, &fci_cache, &use_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) { return; } @@ -4357,15 +4357,15 @@ PHP_FUNCTION(array_filter) if (!string_key) { if (use_type == ARRAY_FILTER_USE_BOTH) { fci.param_count = 2; - ZVAL_INT(&args[1], num_key); + ZVAL_LONG(&args[1], num_key); } else if (use_type == ARRAY_FILTER_USE_KEY) { - ZVAL_INT(&args[0], num_key); + ZVAL_LONG(&args[0], num_key); } } else { if (use_type == ARRAY_FILTER_USE_BOTH) { - ZVAL_STR(&args[1], STR_COPY(string_key)); + ZVAL_STR(&args[1], zend_string_copy(string_key)); } else if (use_type == ARRAY_FILTER_USE_KEY) { - ZVAL_STR(&args[0], STR_COPY(string_key)); + ZVAL_STR(&args[0], zend_string_copy(string_key)); } } } @@ -4436,7 +4436,7 @@ PHP_FUNCTION(array_map) RETVAL_NULL(); if (n_arrays == 1) { - php_uint_t num_key; + zend_ulong num_key; zend_string *str_key; zval *zv, arg; @@ -4599,8 +4599,8 @@ PHP_FUNCTION(array_key_exists) RETURN_TRUE; } RETURN_FALSE; - case IS_INT: - if (zend_hash_index_exists(array, Z_IVAL_P(key))) { + case IS_LONG: + if (zend_hash_index_exists(array, Z_LVAL_P(key))) { RETURN_TRUE; } RETURN_FALSE; @@ -4622,15 +4622,15 @@ PHP_FUNCTION(array_key_exists) PHP_FUNCTION(array_chunk) { int argc = ZEND_NUM_ARGS(), num_in; - php_int_t size, current = 0; + zend_long size, current = 0; zend_string *str_key; - php_uint_t num_key; + zend_ulong num_key; zend_bool preserve_keys = 0; zval *input = NULL; zval chunk; zval *entry; - if (zend_parse_parameters(argc TSRMLS_CC, "ai|b", &input, &size, &preserve_keys) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) { return; } /* Do bounds checking for size parameter. */ @@ -4716,15 +4716,15 @@ PHP_FUNCTION(array_combine) break; } else if (Z_TYPE(Z_ARRVAL_P(values)->arData[pos_values].val) != IS_UNDEF) { entry_values = &Z_ARRVAL_P(values)->arData[pos_values].val; - if (Z_TYPE_P(entry_keys) == IS_INT) { + if (Z_TYPE_P(entry_keys) == IS_LONG) { zval_add_ref(entry_values); - add_index_zval(return_value, Z_IVAL_P(entry_keys), entry_values); + add_index_zval(return_value, Z_LVAL_P(entry_keys), entry_values); } else { zend_string *key = zval_get_string(entry_keys); zval_add_ref(entry_values); zend_symtable_update(Z_ARRVAL_P(return_value), key, entry_values); - STR_RELEASE(key); + zend_string_release(key); } pos_values++; break; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 31421fc9d4..abd7c4079e 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -25,10 +25,10 @@ /* }}} */ ZEND_BEGIN_MODULE_GLOBALS(assert) - php_int_t active; - php_int_t bail; - php_int_t warning; - php_int_t quiet_eval; + zend_long active; + zend_long bail; + zend_long warning; + zend_long quiet_eval; zval callback; char *cb; ZEND_END_MODULE_GLOBALS(assert) @@ -98,11 +98,11 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); return SUCCESS; } @@ -164,7 +164,7 @@ PHP_FUNCTION(assert) } compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); - if (zend_eval_stringl(myeval, Z_STRSIZE_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); if (description_len == 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); @@ -205,7 +205,7 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(TSRMLS_C); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_INT (&args[1], lineno); + ZVAL_LONG (&args[1], lineno); ZVAL_STRING(&args[2], SAFE_STRING(myeval)); ZVAL_FALSE(&retval); @@ -256,12 +256,12 @@ PHP_FUNCTION(assert) PHP_FUNCTION(assert_options) { zval *value = NULL; - php_int_t what; + zend_long what; int oldint; int ac = ZEND_NUM_ARGS(); zend_string *key; - if (zend_parse_parameters(ac TSRMLS_CC, "i|z", &what, &value) == FAILURE) { + if (zend_parse_parameters(ac TSRMLS_CC, "l|z", &what, &value) == FAILURE) { return; } @@ -270,48 +270,48 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(active); if (ac == 2) { zend_string *value_str = zval_get_string(value); - key = STR_INIT("assert.active", sizeof("assert.active")-1, 0); + key = zend_string_init("assert.active", sizeof("assert.active")-1, 0); zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(key); - STR_RELEASE(value_str); + zend_string_release(key); + zend_string_release(value_str); } - RETURN_INT(oldint); + RETURN_LONG(oldint); break; case ASSERT_BAIL: oldint = ASSERTG(bail); if (ac == 2) { zend_string *value_str = zval_get_string(value); - key = STR_INIT("assert.bail", sizeof("assert.bail")-1, 0); + key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0); zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(key); - STR_RELEASE(value_str); + zend_string_release(key); + zend_string_release(value_str); } - RETURN_INT(oldint); + RETURN_LONG(oldint); break; case ASSERT_QUIET_EVAL: oldint = ASSERTG(quiet_eval); if (ac == 2) { zend_string *value_str = zval_get_string(value); - key = STR_INIT("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); + key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(key); - STR_RELEASE(value_str); + zend_string_release(key); + zend_string_release(value_str); } - RETURN_INT(oldint); + RETURN_LONG(oldint); break; case ASSERT_WARNING: oldint = ASSERTG(warning); if (ac == 2) { zend_string *value_str = zval_get_string(value); - key = STR_INIT("assert.warning", sizeof("assert.warning")-1, 0); + key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0); zend_alter_ini_entry_ex(key, value_str->val, value_str->len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(key); - STR_RELEASE(value_str); + zend_string_release(key); + zend_string_release(value_str); } - RETURN_INT(oldint); + RETURN_LONG(oldint); break; case ASSERT_CALLBACK: diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 7ee643a7d5..370e1b2d90 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -63,7 +63,7 @@ PHPAPI zend_string *php_base64_encode(const unsigned char *str, php_size_t lengt return NULL; } - result = STR_ALLOC(((length + 2) / 3) * 4 * sizeof(char), 0); + result = zend_string_alloc(((length + 2) / 3) * 4 * sizeof(char), 0); p = (unsigned char *)result->val; while (length > 2) { /* keep going until we have less than 24 bits */ @@ -144,7 +144,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le /* this sucks for threaded environments */ zend_string *result; - result = STR_ALLOC(length, 0); + result = zend_string_alloc(length, 0); /* run through the whole string, converting as we go */ while ((ch = *current++) != '\0' && length-- > 0) { @@ -158,7 +158,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le continue; } } - STR_FREE(result); + zend_string_free(result); return NULL; } continue; @@ -168,7 +168,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le if ((!strict && ch < 0) || ch == -1) { /* a space or some other separator character, we simply skip over */ continue; } else if (ch == -2) { - STR_FREE(result); + zend_string_free(result); return NULL; } @@ -196,7 +196,7 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t le if (ch == base64_pad) { switch(i % 4) { case 1: - STR_FREE(result); + zend_string_free(result); return NULL; case 2: k++; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a00b05d44d..dbccaae265 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -99,7 +99,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef INADDR_NONE -#define INADDR_NONE ((php_uint_t) -1) +#define INADDR_NONE ((zend_ulong) -1) #endif #include "zend_globals.h" @@ -3545,28 +3545,28 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class(TSRMLS_C); - REGISTER_INT_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); #define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) REGISTER_MATH_CONSTANT(M_E); @@ -3589,10 +3589,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT); REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); #if ENABLE_TEST_CLASS test_class_startup(); @@ -3914,7 +3914,7 @@ PHP_FUNCTION(ip2long) #ifdef HAVE_INET_PTON struct in_addr ip; #else - php_uint_t ip; + zend_ulong ip; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { @@ -3925,7 +3925,7 @@ PHP_FUNCTION(ip2long) if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) { RETURN_FALSE; } - RETURN_INT(ntohl(ip.s_addr)); + RETURN_LONG(ntohl(ip.s_addr)); #else if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) { /* The only special case when we should return -1 ourselves, @@ -3934,11 +3934,11 @@ PHP_FUNCTION(ip2long) if (addr_len == sizeof("255.255.255.255") - 1 && !memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1) ) { - RETURN_INT(0xFFFFFFFF); + RETURN_LONG(0xFFFFFFFF); } RETURN_FALSE; } - RETURN_INT(ntohl(ip)); + RETURN_LONG(ntohl(ip)); #endif } /* }}} */ @@ -3950,7 +3950,7 @@ PHP_FUNCTION(long2ip) /* "It's a long but it's not, PHP ints are signed */ char *ip; int ip_len; - php_uint_t n; + zend_ulong n; struct in_addr myaddr; #ifdef HAVE_INET_PTON char str[40]; @@ -4252,7 +4252,7 @@ PHP_FUNCTION(getopt) argv[pos++] = estrdup(arg_str->val); - STR_RELEASE(arg_str); + zend_string_release(arg_str); } ZEND_HASH_FOREACH_END(); /* The C Standard requires argv[argc] to be NULL - this might @@ -4297,7 +4297,7 @@ PHP_FUNCTION(getopt) opts->opt_char = 0; opts++; - STR_RELEASE(arg_str); + zend_string_release(arg_str); } ZEND_HASH_FOREACH_END(); } else { opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 1)); @@ -4342,7 +4342,7 @@ PHP_FUNCTION(getopt) /* Add this option / argument pair to the result hash. */ optname_len = strlen(optname); - if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_INT) { + if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) { /* numeric string */ int optname_int = atoi(optname); if ((args = zend_hash_index_find(HASH_OF(return_value), optname_int)) != NULL) { @@ -4386,9 +4386,9 @@ PHP_FUNCTION(flush) Delay for a given number of seconds */ PHP_FUNCTION(sleep) { - php_int_t num; + zend_long num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { RETURN_FALSE; } if (num < 0) { @@ -4396,7 +4396,7 @@ PHP_FUNCTION(sleep) RETURN_FALSE; } #ifdef PHP_SLEEP_NON_VOID - RETURN_INT(php_sleep(num)); + RETURN_LONG(php_sleep(num)); #else php_sleep(num); #endif @@ -4409,9 +4409,9 @@ PHP_FUNCTION(sleep) PHP_FUNCTION(usleep) { #if HAVE_USLEEP - php_int_t num; + zend_long num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { return; } if (num < 0) { @@ -4428,10 +4428,10 @@ PHP_FUNCTION(usleep) Delay for a number of seconds and nano seconds */ PHP_FUNCTION(time_nanosleep) { - php_int_t tv_sec, tv_nsec; + zend_long tv_sec, tv_nsec; struct timespec php_req, php_rem; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &tv_sec, &tv_nsec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) { return; } @@ -4450,8 +4450,8 @@ PHP_FUNCTION(time_nanosleep) RETURN_TRUE; } else if (errno == EINTR) { array_init(return_value); - add_assoc_int_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); - add_assoc_int_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); + add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); + add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); return; } else if (errno == EINVAL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative"); @@ -4525,9 +4525,9 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args if (Z_TYPE_P(entry) == IS_STRING) { if (hash_key->key) { - add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, STR_COPY(Z_STR_P(entry))); + add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, zend_string_copy(Z_STR_P(entry))); } else { - add_index_str(retval, hash_key->h, STR_COPY(Z_STR_P(entry))); + add_index_str(retval, hash_key->h, zend_string_copy(Z_STR_P(entry))); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { array_init(&tmp); @@ -4626,9 +4626,9 @@ PHP_FUNCTION(error_log) char *message, *opt = NULL, *headers = NULL; int message_len, opt_len = 0, headers_len = 0; int opt_err = 0, argc = ZEND_NUM_ARGS(); - php_int_t erropt = 0; + zend_long erropt = 0; - if (zend_parse_parameters(argc TSRMLS_CC, "s|ips", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { return; } @@ -4703,10 +4703,10 @@ PHP_FUNCTION(error_get_last) if (PG(last_error_message)) { array_init(return_value); - add_assoc_int_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); + add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message)); add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-"); - add_assoc_int_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); + add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); } } /* }}} */ @@ -4858,12 +4858,12 @@ static int user_shutdown_function_call(zval *zv TSRMLS_DC) /* {{{ */ if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name TSRMLS_CC)) { php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", function_name->val); if (function_name) { - STR_RELEASE(function_name); + zend_string_release(function_name); } return 0; } if (function_name) { - STR_RELEASE(function_name); + zend_string_release(function_name); } if (call_user_function(EG(function_table), NULL, @@ -4937,11 +4937,11 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_ } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) { zval result; zend_compare_arrays(&result, func1, func2 TSRMLS_CC); - ret = (Z_IVAL(result) == 0); + ret = (Z_LVAL(result) == 0); } else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) { zval result; zend_compare_objects(&result, func1, func2 TSRMLS_CC); - ret = (Z_IVAL(result) == 0); + ret = (Z_LVAL(result) == 0); } else { ret = 0; } @@ -5019,7 +5019,7 @@ PHP_FUNCTION(register_shutdown_function) zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry)); } if (callback_name) { - STR_RELEASE(callback_name); + zend_string_release(callback_name); } } /* }}} */ @@ -5242,7 +5242,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze add_assoc_null(&option, "local_value"); } - add_assoc_int(&option, "access", ini_entry->modifiable); + add_assoc_long(&option, "access", ini_entry->modifiable); add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option); } else { @@ -5375,13 +5375,13 @@ PHP_FUNCTION(set_include_path) RETVAL_FALSE; } - key = STR_INIT("include_path", sizeof("include_path") - 1, 0); + key = zend_string_init("include_path", sizeof("include_path") - 1, 0); if (zend_alter_ini_entry_ex(key, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { - STR_RELEASE(key); + zend_string_release(key); zval_dtor(return_value); RETURN_FALSE; } - STR_RELEASE(key); + zend_string_release(key); } /* }}} */ @@ -5414,9 +5414,9 @@ PHP_FUNCTION(restore_include_path) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { return; } - key = STR_INIT("include_path", sizeof("include_path")-1, 0); + key = zend_string_init("include_path", sizeof("include_path")-1, 0); zend_restore_ini_entry(key, PHP_INI_STAGE_RUNTIME); - STR_FREE(key); + zend_string_free(key); } /* }}} */ @@ -5450,7 +5450,7 @@ PHP_FUNCTION(print_r) Returns true if client disconnected */ PHP_FUNCTION(connection_aborted) { - RETURN_INT(PG(connection_status) & PHP_CONNECTION_ABORTED); + RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED); } /* }}} */ @@ -5458,7 +5458,7 @@ PHP_FUNCTION(connection_aborted) Returns the connection status bitfield */ PHP_FUNCTION(connection_status) { - RETURN_INT(PG(connection_status)); + RETURN_LONG(PG(connection_status)); } /* }}} */ @@ -5477,12 +5477,12 @@ PHP_FUNCTION(ignore_user_abort) old_setting = PG(ignore_user_abort); if (arg) { - zend_string *key = STR_INIT("ignore_user_abort", sizeof("ignore_user_abort"), 0); + zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort"), 0); zend_alter_ini_entry_ex(key, arg, arg_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); } - RETURN_INT(old_setting); + RETURN_LONG(old_setting); } /* }}} */ @@ -5514,7 +5514,7 @@ PHP_FUNCTION(getservbyname) RETURN_FALSE; } - RETURN_INT(ntohs(serv->s_port)); + RETURN_LONG(ntohs(serv->s_port)); } /* }}} */ #endif @@ -5526,10 +5526,10 @@ PHP_FUNCTION(getservbyport) { char *proto; int proto_len; - php_int_t port; + zend_long port; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &port, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) { return; } @@ -5563,7 +5563,7 @@ PHP_FUNCTION(getprotobyname) RETURN_FALSE; } - RETURN_INT(ent->p_proto); + RETURN_LONG(ent->p_proto); } /* }}} */ #endif @@ -5573,10 +5573,10 @@ PHP_FUNCTION(getprotobyname) Returns protocol name associated with protocol number proto */ PHP_FUNCTION(getprotobynumber) { - php_int_t proto; + zend_long proto; struct protoent *ent; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &proto) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &proto) == FAILURE) { return; } @@ -5616,10 +5616,10 @@ PHP_FUNCTION(register_tick_function) if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name TSRMLS_CC)) { efree(tick_fe.arguments); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid tick callback '%s' passed", function_name->val); - STR_RELEASE(function_name); + zend_string_release(function_name); RETURN_FALSE; } else if (function_name) { - STR_RELEASE(function_name); + zend_string_release(function_name); } if (Z_TYPE(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE(tick_fe.arguments[0]) != IS_OBJECT) { @@ -5777,8 +5777,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal break; } - if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_INT) { - php_uint_t key = (php_uint_t) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)); + if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { + zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) { array_init(&hash); find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash); @@ -5797,7 +5797,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal ZVAL_DUP(&element, arg2); - if (arg3 && Z_STRSIZE_P(arg3) > 0) { + if (arg3 && Z_STRLEN_P(arg3) > 0) { zend_symtable_update(Z_ARRVAL_P(find_hash), Z_STR_P(arg3), &element); } else { add_next_index_zval(find_hash, &element); @@ -5839,11 +5839,11 @@ PHP_FUNCTION(parse_ini_file) char *filename = NULL; int filename_len = 0; zend_bool process_sections = 0; - php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL; + zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bi", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } @@ -5880,10 +5880,10 @@ PHP_FUNCTION(parse_ini_string) char *string = NULL, *str = NULL; int str_len = 0; zend_bool process_sections = 0; - php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL; + zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index ee79269cae..64a6c5363c 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -167,7 +167,7 @@ typedef struct _php_basic_globals { char *locale_string; char *strtok_last; char strtok_table[256]; - php_uint_t strtok_len; + zend_ulong strtok_len; char str_ebuf[40]; zend_fcall_info array_walk_fci; zend_fcall_info_cache array_walk_fci_cache; @@ -178,9 +178,9 @@ typedef struct _php_basic_globals { zval active_ini_file_section; /* pageinfo.c */ - php_int_t page_uid; - php_int_t page_gid; - php_int_t page_inode; + zend_long page_uid; + zend_long page_gid; + zend_long page_inode; time_t page_mtime; /* filestat.c && main/streams/streams.c */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index c5a4b47744..320d1f90a7 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -61,7 +61,7 @@ static void browscap_entry_dtor_request(zval *zvalue) /* {{{ */ zend_hash_destroy(Z_ARRVAL_P(zvalue)); efree(Z_ARR_P(zvalue)); } else if (Z_TYPE_P(zvalue) == IS_STRING) { - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); } } /* }}} */ @@ -71,7 +71,7 @@ static void browscap_entry_dtor_persistent(zval *zvalue) /* {{{ */ { zend_hash_destroy(Z_ARRVAL_P(zvalue)); free(Z_ARR_P(zvalue)); } else if (Z_TYPE_P(zvalue) == IS_STRING) { - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); } } /* }}} */ @@ -83,15 +83,15 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ zend_string *res; char *lc_pattern; - res = STR_SAFE_ALLOC(Z_STRSIZE_P(pattern), 2, 4, persistent); + res = zend_string_safe_alloc(Z_STRLEN_P(pattern), 2, 4, persistent); t = res->val; - lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern)); + lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); t[j++] = '\xA7'; /* section sign */ t[j++] = '^'; - for (i=0; i<Z_STRSIZE_P(pattern); i++, j++) { + for (i=0; i<Z_STRLEN_P(pattern); i++, j++) { switch (lc_pattern[i]) { case '?': t[j] = '.'; @@ -163,26 +163,26 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb } /* Set proper value for true/false settings */ - if ((Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || - (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || - (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) + if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || + (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || + (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) ) { - ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent)); + ZVAL_NEW_STR(&new_property, zend_string_init("1", sizeof("1")-1, persistent)); } else if ( - (Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || - (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || - (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || - (Z_STRSIZE_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) + (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || + (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || + (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || + (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) ) { // TODO: USE STR_EMPTY_ALLOC()? - ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent)); + ZVAL_NEW_STR(&new_property, zend_string_init("", sizeof("")-1, persistent)); } else { /* Other than true/false setting */ - ZVAL_STR(&new_property, STR_DUP(Z_STR_P(arg2), persistent)); + ZVAL_STR(&new_property, zend_string_dup(Z_STR_P(arg2), persistent)); } - new_key = STR_DUP(Z_STR_P(arg1), persistent); + new_key = zend_string_dup(Z_STR_P(arg1), persistent); zend_str_tolower(new_key->val, new_key->len); zend_hash_update(Z_ARRVAL(bdata->current_section), new_key, &new_property); - STR_RELEASE(new_key); + zend_string_release(new_key); } break; case ZEND_INI_PARSER_SECTION: { @@ -203,12 +203,12 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb pefree(bdata->current_section_name, persistent); } bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), - Z_STRSIZE_P(arg1), persistent); + Z_STRLEN_P(arg1), persistent); zend_hash_update(bdata->htab, Z_STR_P(arg1), &bdata->current_section); ZVAL_STR(&processed, Z_STR_P(arg1)); - ZVAL_STR(&unprocessed, STR_DUP(Z_STR_P(arg1), persistent)); + ZVAL_STR(&unprocessed, zend_string_dup(Z_STR_P(arg1), persistent)); convert_browscap_pattern(&processed, persistent); zend_hash_str_update(Z_ARRVAL(bdata->current_section), "browser_name_regex", sizeof("browser_name_regex")-1, &processed); @@ -388,7 +388,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar ua_len = lookup_browser_length; - for (i = 0; i < Z_STRSIZE_P(previous_match); i++) { + for (i = 0; i < Z_STRLEN_P(previous_match); i++) { switch (Z_STRVAL_P(previous_match)[i]) { case '?': case '*': @@ -400,7 +400,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar } } - for (i = 0; i < Z_STRSIZE_P(current_match); i++) { + for (i = 0; i < Z_STRLEN_P(current_match); i++) { switch (Z_STRVAL_P(current_match)[i]) { case '?': case '*': @@ -465,9 +465,9 @@ PHP_FUNCTION(get_browser) } if (agent_name == NULL) { - zend_string *key = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0); + zend_string *key = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0); zend_is_auto_global(key TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF || (http_user_agent = zend_hash_str_find(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT")-1)) == NULL ) { @@ -475,7 +475,7 @@ PHP_FUNCTION(get_browser) RETURN_FALSE; } agent_name = Z_STRVAL_P(http_user_agent); - agent_name_len = Z_STRSIZE_P(http_user_agent); + agent_name_len = Z_STRLEN_P(http_user_agent); } lookup_browser_name = estrndup(agent_name, agent_name_len); diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 6ff40d57c8..e9176e84da 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -39,7 +39,7 @@ PHP_NAMED_FUNCTION(php_if_crc32) for (; nr--; ++p) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ]; } - RETVAL_INT(crc^0xFFFFFFFF); + RETVAL_LONG(crc^0xFFFFFFFF); } /* }}} */ diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 47436398ff..5c9fcbafe8 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -102,18 +102,18 @@ PHP_MINIT_FUNCTION(crypt) /* {{{ */ { - REGISTER_INT_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); #ifdef PHP_SHA256_CRYPT - REGISTER_INT_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef PHP_SHA512_CRYPT - REGISTER_INT_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #if PHP_USE_PHP_CRYPT_R @@ -136,7 +136,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -static void php_to64(char *s, php_int_t v, int n) /* {{{ */ +static void php_to64(char *s, zend_long v, int n) /* {{{ */ { while (--n >= 0) { *s++ = itoa64[v&0x3f]; @@ -160,7 +160,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch out = php_md5_crypt_r(password, salt, output); if (out) { - return STR_INIT(out, strlen(out), 0); + return zend_string_init(out, strlen(out), 0); } return NULL; } else if (salt[0]=='$' && salt[1]=='6' && salt[2]=='$') { @@ -173,7 +173,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch efree(output); return NULL; } else { - result = STR_INIT(output, strlen(output), 0); + result = zend_string_init(output, strlen(output), 0); memset(output, 0, PHP_MAX_SALT_LEN); efree(output); return result; @@ -188,7 +188,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch efree(output); return NULL; } else { - result = STR_INIT(output, strlen(output), 0); + result = zend_string_init(output, strlen(output), 0); memset(output, 0, PHP_MAX_SALT_LEN); efree(output); return result; @@ -210,7 +210,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch memset(output, 0, PHP_MAX_SALT_LEN + 1); return NULL; } else { - result = STR_INIT(output, strlen(output), 0); + result = zend_string_init(output, strlen(output), 0); memset(output, 0, PHP_MAX_SALT_LEN + 1); return result; } @@ -222,7 +222,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch if (!crypt_res) { return NULL; } else { - result = STR_INIT(crypt_res, strlen(crypt_res), 0); + result = zend_string_init(crypt_res, strlen(crypt_res), 0); return result; } } @@ -243,7 +243,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch if (!crypt_res) { return FAILURE; } else { - result = STR_INIT(crypt_res, strlen(crypt_res), 0); + result = zend_string_init(crypt_res, strlen(crypt_res), 0); return result; } } diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index bf731b256f..95df4bdc59 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -372,7 +372,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha256_rounds_prefix) - 1; char *endp; - php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10); + zend_ulong srounds = ZEND_STRTOUI(num, &endp, 10); if (*endp == '$') { salt = endp + 1; rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX)); diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index f0732e3e17..411abf64e6 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -405,7 +405,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha512_rounds_prefix) - 1; char *endp; - php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10); + zend_ulong srounds = ZEND_STRTOUI(num, &endp, 10); if (*endp == '$') { salt = endp + 1; diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c index 326e9e21b8..503f3659ed 100644 --- a/ext/standard/cyr_convert.c +++ b/ext/standard/cyr_convert.c @@ -279,7 +279,7 @@ PHP_FUNCTION(convert_cyr_string) return; } - str = STR_INIT(input, input_len, 0); + str = zend_string_init(input, input_len, 0); php_convert_cyr_string(str->val, str->len, fr_cs[0], to_cs[0] TSRMLS_CC); RETVAL_NEW_STR(str); diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 8743708ad9..80a34a4548 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -104,14 +104,14 @@ PHP_FUNCTION(strptime) } array_init(return_value); - add_assoc_int(return_value, "tm_sec", parsed_time.tm_sec); - add_assoc_int(return_value, "tm_min", parsed_time.tm_min); - add_assoc_int(return_value, "tm_hour", parsed_time.tm_hour); - add_assoc_int(return_value, "tm_mday", parsed_time.tm_mday); - add_assoc_int(return_value, "tm_mon", parsed_time.tm_mon); - add_assoc_int(return_value, "tm_year", parsed_time.tm_year); - add_assoc_int(return_value, "tm_wday", parsed_time.tm_wday); - add_assoc_int(return_value, "tm_yday", parsed_time.tm_yday); + add_assoc_long(return_value, "tm_sec", parsed_time.tm_sec); + add_assoc_long(return_value, "tm_min", parsed_time.tm_min); + add_assoc_long(return_value, "tm_hour", parsed_time.tm_hour); + add_assoc_long(return_value, "tm_mday", parsed_time.tm_mday); + add_assoc_long(return_value, "tm_mon", parsed_time.tm_mon); + add_assoc_long(return_value, "tm_year", parsed_time.tm_year); + add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday); + add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday); add_assoc_string(return_value, "unparsed", unparsed_part); } /* }}} */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 5269b9827b..ff4a3bbc75 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -148,44 +148,44 @@ PHP_MINIT_FUNCTION(dir) pathsep_str[1] = '\0'; REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_GLOB #ifdef GLOB_BRACE - REGISTER_INT_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_BRACE 0 #endif #ifdef GLOB_MARK - REGISTER_INT_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_MARK 0 #endif #ifdef GLOB_NOSORT - REGISTER_INT_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOSORT 0 #endif #ifdef GLOB_NOCHECK - REGISTER_INT_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOCHECK 0 #endif #ifdef GLOB_NOESCAPE - REGISTER_INT_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOESCAPE 0 #endif #ifdef GLOB_ERR - REGISTER_INT_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); #else # define GLOB_ERR 0 #endif @@ -201,8 +201,8 @@ PHP_MINIT_FUNCTION(dir) /* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */ #define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR) - REGISTER_INT_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); #endif /* HAVE_GLOB */ @@ -430,13 +430,13 @@ PHP_FUNCTION(glob) #endif char *pattern = NULL; int pattern_len; - php_int_t flags = 0; + zend_long flags = 0; glob_t globbuf; int n; int ret; zend_bool basedir_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &pattern, &pattern_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) { return; } @@ -553,13 +553,13 @@ PHP_FUNCTION(scandir) { char *dirn; int dirn_len; - php_int_t flags = 0; + zend_long flags = 0; zend_string **namelist; int n, i; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { return; } diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 2f92c82d2c..19573d8e42 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -83,7 +83,7 @@ PHPAPI PHP_FUNCTION(dl) } php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC); - if (Z_IVAL_P(return_value) == 1) { + if (Z_LVAL_P(return_value) == 1) { EG(full_tables_cleanup) = 1; } } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 3ad926820d..852ebaab22 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -203,10 +203,10 @@ static zend_string *php_gethostbyaddr(char *ip) #endif if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') { - return STR_INIT(ip, strlen(ip), 0); + return zend_string_init(ip, strlen(ip), 0); } - return STR_INIT(hp->h_name, strlen(hp->h_name), 0); + return zend_string_init(hp->h_name, strlen(hp->h_name), 0); } /* }}} */ @@ -263,13 +263,13 @@ static zend_string *php_gethostbyname(char *name) hp = gethostbyname(name); if (!hp || !*(hp->h_addr_list)) { - return STR_INIT(name, strlen(name), 0); + return zend_string_init(name, strlen(name), 0); } memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr)); address = inet_ntoa(in); - return STR_INIT(address, strlen(address), 0); + return zend_string_init(address, strlen(address), 0); } /* }}} */ @@ -456,10 +456,10 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t add_assoc_string(subarray, "host", name); add_assoc_string(subarray, "class", "IN"); - add_assoc_int(subarray, "ttl", ttl); + add_assoc_long(subarray, "ttl", ttl); if (raw) { - add_assoc_int(subarray, "type", type); + add_assoc_long(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen); cp += dlen; return cp; @@ -477,7 +477,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(2); add_assoc_string(subarray, "type", "MX"); GETSHORT(n, cp); - add_assoc_int(subarray, "pri", n); + add_assoc_long(subarray, "pri", n); /* no break; */ case DNS_T_CNAME: if (type == DNS_T_CNAME) { @@ -523,7 +523,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t zend_string *tp; add_assoc_string(subarray, "type", "TXT"); - tp = STR_ALLOC(dlen, 0); + tp = zend_string_alloc(dlen, 0); array_init(&entries); @@ -564,15 +564,15 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t add_assoc_string(subarray, "rname", name); CHECKCP(5*4); GETLONG(n, cp); - add_assoc_int(subarray, "serial", n); + add_assoc_long(subarray, "serial", n); GETLONG(n, cp); - add_assoc_int(subarray, "refresh", n); + add_assoc_long(subarray, "refresh", n); GETLONG(n, cp); - add_assoc_int(subarray, "retry", n); + add_assoc_long(subarray, "retry", n); GETLONG(n, cp); - add_assoc_int(subarray, "expire", n); + add_assoc_long(subarray, "expire", n); GETLONG(n, cp); - add_assoc_int(subarray, "minimum-ttl", n); + add_assoc_long(subarray, "minimum-ttl", n); break; case DNS_T_AAAA: tp = (u_char*)name; @@ -614,7 +614,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(1); n = ((int)cp[0]) & 0xFF; cp++; - add_assoc_int(subarray, "masklen", n); + add_assoc_long(subarray, "masklen", n); tp = (u_char*)name; if (n > 15) { have_v6_break = 1; @@ -689,11 +689,11 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(3*2); add_assoc_string(subarray, "type", "SRV"); GETSHORT(n, cp); - add_assoc_int(subarray, "pri", n); + add_assoc_long(subarray, "pri", n); GETSHORT(n, cp); - add_assoc_int(subarray, "weight", n); + add_assoc_long(subarray, "weight", n); GETSHORT(n, cp); - add_assoc_int(subarray, "port", n); + add_assoc_long(subarray, "port", n); n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; @@ -705,9 +705,9 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(2*2); add_assoc_string(subarray, "type", "NAPTR"); GETSHORT(n, cp); - add_assoc_int(subarray, "order", n); + add_assoc_long(subarray, "order", n); GETSHORT(n, cp); - add_assoc_int(subarray, "pref", n); + add_assoc_long(subarray, "pref", n); CHECKCP(1); n = (cp[0] & 0xFF); @@ -1047,7 +1047,7 @@ PHP_FUNCTION(dns_get_mx) cp += i; add_next_index_string(mx_list, buf); if (weight_list) { - add_next_index_int(weight_list, weight); + add_next_index_long(weight_list, weight); } } php_dns_free_handle(handle); @@ -1059,20 +1059,20 @@ PHP_FUNCTION(dns_get_mx) #if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { - REGISTER_INT_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } #endif /* HAVE_FULL_DNS_FUNCS */ diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index 7ef53dd0e7..7decf91c5c 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -77,7 +77,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */ add_next_index_string(mx_list, pRec->Data.MX.pNameExchange); if (weight_list) { - add_next_index_int(weight_list, srv->wPriority); + add_next_index_long(weight_list, srv->wPriority); } } @@ -158,10 +158,10 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "host", pRec->pName); add_assoc_string(subarray, "class", "IN"); - add_assoc_int(subarray, "ttl", ttl); + add_assoc_long(subarray, "ttl", ttl); if (raw) { - add_assoc_int(subarray, "type", type); + add_assoc_long(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength); return; } @@ -177,7 +177,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, case DNS_TYPE_MX: add_assoc_string(subarray, "type", "MX"); - add_assoc_int(subarray, "pri", pRec->Data.Srv.wPriority); + add_assoc_long(subarray, "pri", pRec->Data.Srv.wPriority); /* no break; */ case DNS_TYPE_CNAME: @@ -219,7 +219,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, txt_len += strlen(data_txt->pStringArray[i]) + 1; } - txt = STR_SAFE_ALLOC(txt_len, 2, 0, 0); + txt = zend_string_safe_alloc(txt_len, 2, 0, 0); txt_dst = txt->val; for (i = 0; i < count; i++) { int len = strlen(data_txt->pStringArray[i]); @@ -241,11 +241,11 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "mname", data_soa->pNamePrimaryServer); add_assoc_string(subarray, "rname", data_soa->pNameAdministrator); - add_assoc_int(subarray, "serial", data_soa->dwSerialNo); - add_assoc_int(subarray, "refresh", data_soa->dwRefresh); - add_assoc_int(subarray, "retry", data_soa->dwRetry); - add_assoc_int(subarray, "expire", data_soa->dwExpire); - add_assoc_int(subarray, "minimum-ttl", data_soa->dwDefaultTtl); + add_assoc_long(subarray, "serial", data_soa->dwSerialNo); + add_assoc_long(subarray, "refresh", data_soa->dwRefresh); + add_assoc_long(subarray, "retry", data_soa->dwRetry); + add_assoc_long(subarray, "expire", data_soa->dwExpire); + add_assoc_long(subarray, "minimum-ttl", data_soa->dwDefaultTtl); } break; @@ -309,9 +309,9 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_SRV_DATA *data_srv = &pRec->Data.Srv; add_assoc_string(subarray, "type", "SRV"); - add_assoc_int(subarray, "pri", data_srv->wPriority); - add_assoc_int(subarray, "weight", data_srv->wWeight); - add_assoc_int(subarray, "port", data_srv->wPort); + add_assoc_long(subarray, "pri", data_srv->wPriority); + add_assoc_long(subarray, "weight", data_srv->wWeight); + add_assoc_long(subarray, "port", data_srv->wPort); add_assoc_string(subarray, "target", data_srv->pNameTarget); } break; @@ -322,8 +322,8 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr; add_assoc_string(subarray, "type", "NAPTR"); - add_assoc_int(subarray, "order", data_naptr->wOrder); - add_assoc_int(subarray, "pref", data_naptr->wPreference); + add_assoc_long(subarray, "order", data_naptr->wOrder); + add_assoc_long(subarray, "pref", data_naptr->wPreference); add_assoc_string(subarray, "flags", data_naptr->pFlags); add_assoc_string(subarray, "services", data_naptr->pService); add_assoc_string(subarray, "regex", data_naptr->pRegularExpression); diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 72878f9c9e..fe0443d59c 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -200,7 +200,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ } if (ret_code) { zval_dtor(ret_code); - ZVAL_INT(ret_code, ret); + ZVAL_LONG(ret_code, ret); } } /* }}} */ @@ -247,7 +247,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str) TSRMLS_FETCH(); - cmd = STR_ALLOC(2 * l, 0); + cmd = zend_string_alloc(2 * l, 0); for (x = 0, y = 0; x < l; x++) { int mb_len = php_mblen(str + x, (l - x)); @@ -320,7 +320,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str) if ((estimate - y) > 4096) { /* realloc if the estimate was way overill * Arbitrary cutoff point of 4096 */ - cmd = STR_REALLOC(cmd, y, 0); + cmd = zend_string_realloc(cmd, y, 0); } cmd->len = y; @@ -339,7 +339,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str) TSRMLS_FETCH(); - cmd = STR_ALLOC(4 * l + 2, 0); /* worst case */ + cmd = zend_string_alloc(4 * l + 2, 0); /* worst case */ #ifdef PHP_WIN32 cmd->val[y++] = '"'; @@ -387,7 +387,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str) if ((estimate - y) > 4096) { /* realloc if the estimate was way overill * Arbitrary cutoff point of 4096 */ - cmd = STR_REALLOC(cmd, y, 0); + cmd = zend_string_realloc(cmd, y, 0); } cmd->len = y; return cmd; @@ -470,9 +470,9 @@ PHP_FUNCTION(shell_exec) Change the priority of the current process */ PHP_FUNCTION(proc_nice) { - php_int_t pri; + zend_long pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pri) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 835180ee48..e2a63ceef8 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -188,135 +188,135 @@ PHP_MINIT_FUNCTION(file) REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); #ifdef PF_INET - REGISTER_INT_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); #elif defined(AF_INET) - REGISTER_INT_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); #endif #if HAVE_IPV6 # ifdef PF_INET6 - REGISTER_INT_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); # elif defined(AF_INET6) - REGISTER_INT_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); # endif #endif #ifdef PF_UNIX - REGISTER_INT_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); #elif defined(AF_UNIX) - REGISTER_INT_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_IP /* most people will use this one when calling socket() or socketpair() */ - REGISTER_INT_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_TCP - REGISTER_INT_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_UDP - REGISTER_INT_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_ICMP - REGISTER_INT_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_RAW - REGISTER_INT_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); #ifdef SOCK_RAW - REGISTER_INT_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_SEQPACKET - REGISTER_INT_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_RDM - REGISTER_INT_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_FNMATCH - REGISTER_INT_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); # ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */ - REGISTER_INT_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); # endif #endif @@ -342,9 +342,9 @@ PHP_FUNCTION(flock) zval *arg1, *arg3 = NULL; int act; php_stream *stream; - php_int_t operation = 0; + zend_long operation = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &arg1, &operation, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &arg1, &operation, &arg3) == FAILURE) { return; } @@ -358,14 +358,14 @@ PHP_FUNCTION(flock) if (arg3) { zval_dtor(arg3); - ZVAL_INT(arg3, 0); + ZVAL_LONG(arg3, 0); } /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { if (operation && errno == EWOULDBLOCK && arg3) { - ZVAL_INT(arg3, 1); + ZVAL_LONG(arg3, 1); } RETURN_FALSE; } @@ -526,14 +526,14 @@ PHP_FUNCTION(file_get_contents) int filename_len; zend_bool use_include_path = 0; php_stream *stream; - php_int_t offset = -1; - php_int_t maxlen = PHP_STREAM_COPY_ALL; + zend_long offset = -1; + zend_long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; php_stream_context *context = NULL; zend_string *contents; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { return; } @@ -579,15 +579,15 @@ PHP_FUNCTION(file_put_contents) char *filename; int filename_len; zval *data; - php_int_t numbytes = 0; - php_int_t flags = 0; + zend_long numbytes = 0; + zend_long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; char mode[3] = "wb"; char ret_ok = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|ir!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { return; } @@ -641,17 +641,17 @@ PHP_FUNCTION(file_put_contents) break; } case IS_NULL: - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(data); case IS_STRING: - if (Z_STRSIZE_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data)); - if (numbytes != Z_STRSIZE_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pl of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data)); + if (Z_STRLEN_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); + if (numbytes != Z_STRLEN_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pl of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); numbytes = -1; } } @@ -670,11 +670,11 @@ PHP_FUNCTION(file_put_contents) if (bytes_written != str->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %zd bytes to %s", str->len, filename); ret_ok = 0; - STR_RELEASE(str); + zend_string_release(str); break; } } - STR_RELEASE(str); + zend_string_release(str); } ZEND_HASH_FOREACH_END(); } break; @@ -684,9 +684,9 @@ PHP_FUNCTION(file_put_contents) zval out; if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { - numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out)); - if (numbytes != Z_STRSIZE(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out)); + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); + if (numbytes != Z_STRLEN(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %pd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); numbytes = -1; } zval_dtor(&out); @@ -703,7 +703,7 @@ PHP_FUNCTION(file_put_contents) RETURN_FALSE; } - RETURN_INT(numbytes); + RETURN_LONG(numbytes); } /* }}} */ @@ -718,7 +718,7 @@ PHP_FUNCTION(file) char *p, *s, *e; register int i = 0; char eol_marker = '\n'; - php_int_t flags = 0; + zend_long flags = 0; zend_bool use_include_path; zend_bool include_new_line; zend_bool skip_blank_lines; @@ -728,7 +728,7 @@ PHP_FUNCTION(file) zend_string *target_buf; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { return; } if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) { @@ -795,7 +795,7 @@ parse_eol: } if (target_buf) { - STR_FREE(target_buf); + zend_string_free(target_buf); } php_stream_close(stream); } @@ -832,7 +832,7 @@ PHP_FUNCTION(tempnam) RETVAL_STRING(opened_path); efree(opened_path); } - STR_RELEASE(p); + zend_string_release(p); } /* }}} */ @@ -977,7 +977,7 @@ PHP_FUNCTION(pclose) FG(pclose_wait) = 1; zend_list_close(stream->res); FG(pclose_wait) = 0; - RETURN_INT(FG(pclose_ret)); + RETURN_LONG(FG(pclose_ret)); } /* }}} */ @@ -1007,13 +1007,13 @@ PHPAPI PHP_FUNCTION(feof) PHPAPI PHP_FUNCTION(fgets) { zval *arg1; - php_int_t len = 1024; + zend_long len = 1024; char *buf = NULL; int argc = ZEND_NUM_ARGS(); size_t line_len = 0; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &len) == FAILURE) { RETURN_FALSE; } @@ -1091,7 +1091,7 @@ PHPAPI PHP_FUNCTION(fgetc) PHPAPI PHP_FUNCTION(fgetss) { zval *fd; - php_int_t bytes = 0; + zend_long bytes = 0; size_t len = 0; size_t actual_len, retval_len; char *buf = NULL, *retval; @@ -1100,7 +1100,7 @@ PHPAPI PHP_FUNCTION(fgetss) char *allowed_tags=NULL; int allowed_tags_len=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|iS", &fd, &bytes, &allowed) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed) == FAILURE) { RETURN_FALSE; } @@ -1197,11 +1197,11 @@ PHPAPI PHP_FUNCTION(fwrite) int arg2len; int ret; int num_bytes; - php_int_t arg3 = 0; + zend_long arg3 = 0; char *buffer = NULL; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { RETURN_FALSE; } @@ -1212,7 +1212,7 @@ PHPAPI PHP_FUNCTION(fwrite) } if (!num_bytes) { - RETURN_INT(0); + RETURN_LONG(0); } PHP_STREAM_TO_ZVAL(stream, arg1); @@ -1222,7 +1222,7 @@ PHPAPI PHP_FUNCTION(fwrite) efree(buffer); } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1273,7 +1273,7 @@ PHPAPI PHP_FUNCTION(rewind) PHPAPI PHP_FUNCTION(ftell) { zval *arg1; - php_int_t ret; + zend_long ret; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { @@ -1286,7 +1286,7 @@ PHPAPI PHP_FUNCTION(ftell) if (ret == -1) { RETURN_FALSE; } - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1295,16 +1295,16 @@ PHPAPI PHP_FUNCTION(ftell) PHPAPI PHP_FUNCTION(fseek) { zval *arg1; - php_int_t arg2, whence = SEEK_SET; + zend_long arg2, whence = SEEK_SET; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &arg2, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) { RETURN_FALSE; } PHP_STREAM_TO_ZVAL(stream, arg1); - RETURN_INT(php_stream_seek(stream, arg2, whence)); + RETURN_LONG(php_stream_seek(stream, arg2, whence)); } /* }}} */ @@ -1312,7 +1312,7 @@ PHPAPI PHP_FUNCTION(fseek) */ /* DEPRECATED APIs: Use php_stream_mkdir() instead */ -PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC) +PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options TSRMLS_DC) { int ret; @@ -1327,7 +1327,7 @@ PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC) return ret; } -PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC) +PHPAPI int php_mkdir(const char *dir, zend_long mode TSRMLS_DC) { return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC); } @@ -1340,11 +1340,11 @@ PHP_FUNCTION(mkdir) char *dir; int dir_len; zval *zcontext = NULL; - php_int_t mode = 0777; + zend_long mode = 0777; zend_bool recursive = 0; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ibr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1395,7 +1395,7 @@ PHP_FUNCTION(readfile) if (stream) { size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_INT(size); + RETURN_LONG(size); } RETURN_FALSE; @@ -1406,7 +1406,7 @@ PHP_FUNCTION(readfile) Return or change the umask */ PHP_FUNCTION(umask) { - php_int_t arg1 = 0; + zend_long arg1 = 0; int oldumask; oldumask = umask(077); @@ -1415,7 +1415,7 @@ PHP_FUNCTION(umask) BG(umask) = oldumask; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) { RETURN_FALSE; } @@ -1425,7 +1425,7 @@ PHP_FUNCTION(umask) umask(arg1); } - RETURN_INT(oldumask); + RETURN_LONG(oldumask); } /* }}} */ @@ -1444,7 +1444,7 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_STREAM_TO_ZVAL(stream, arg1); size = php_stream_passthru(stream); - RETURN_INT(size); + RETURN_LONG(size); } /* }}} */ @@ -1521,10 +1521,10 @@ PHP_FUNCTION(unlink) PHP_NAMED_FUNCTION(php_if_ftruncate) { zval *fp; - php_int_t size; + zend_long size; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &fp, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &fp, &size) == FAILURE) { RETURN_FALSE; } @@ -1565,30 +1565,30 @@ PHP_NAMED_FUNCTION(php_if_fstat) array_init(return_value); - ZVAL_INT(&stat_dev, stat_ssb.sb.st_dev); - ZVAL_INT(&stat_ino, stat_ssb.sb.st_ino); - ZVAL_INT(&stat_mode, stat_ssb.sb.st_mode); - ZVAL_INT(&stat_nlink, stat_ssb.sb.st_nlink); - ZVAL_INT(&stat_uid, stat_ssb.sb.st_uid); - ZVAL_INT(&stat_gid, stat_ssb.sb.st_gid); + ZVAL_LONG(&stat_dev, stat_ssb.sb.st_dev); + ZVAL_LONG(&stat_ino, stat_ssb.sb.st_ino); + ZVAL_LONG(&stat_mode, stat_ssb.sb.st_mode); + ZVAL_LONG(&stat_nlink, stat_ssb.sb.st_nlink); + ZVAL_LONG(&stat_uid, stat_ssb.sb.st_uid); + ZVAL_LONG(&stat_gid, stat_ssb.sb.st_gid); #ifdef HAVE_ST_RDEV - ZVAL_INT(&stat_rdev, stat_ssb.sb.st_rdev); + ZVAL_LONG(&stat_rdev, stat_ssb.sb.st_rdev); #else - ZVAL_INT(&stat_rdev, -1); + ZVAL_LONG(&stat_rdev, -1); #endif - ZVAL_INT(&stat_size, stat_ssb.sb.st_size); - ZVAL_INT(&stat_atime, stat_ssb.sb.st_atime); - ZVAL_INT(&stat_mtime, stat_ssb.sb.st_mtime); - ZVAL_INT(&stat_ctime, stat_ssb.sb.st_ctime); + ZVAL_LONG(&stat_size, stat_ssb.sb.st_size); + ZVAL_LONG(&stat_atime, stat_ssb.sb.st_atime); + ZVAL_LONG(&stat_mtime, stat_ssb.sb.st_mtime); + ZVAL_LONG(&stat_ctime, stat_ssb.sb.st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_INT(&stat_blksize, stat_ssb.sb.st_blksize); + ZVAL_LONG(&stat_blksize, stat_ssb.sb.st_blksize); #else - ZVAL_INT(&stat_blksize,-1); + ZVAL_LONG(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_INT(&stat_blocks, stat_ssb.sb.st_blocks); + ZVAL_LONG(&stat_blocks, stat_ssb.sb.st_blocks); #else - ZVAL_INT(&stat_blocks,-1); + ZVAL_LONG(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1764,10 +1764,10 @@ safe_to_copy: PHPAPI PHP_FUNCTION(fread) { zval *arg1; - php_int_t len; + zend_long len; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &len) == FAILURE) { RETURN_FALSE; } @@ -1778,11 +1778,11 @@ PHPAPI PHP_FUNCTION(fread) RETURN_FALSE; } - ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0)); - Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + ZVAL_NEW_STR(return_value, zend_string_alloc(len, 0)); + Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; } /* }}} */ @@ -1884,7 +1884,7 @@ PHP_FUNCTION(fputcsv) PHP_STREAM_TO_ZVAL(stream, fp); ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC); - RETURN_INT(ret); + RETURN_LONG(ret); } /* }}} */ @@ -1932,7 +1932,7 @@ PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, if (++i != count) { smart_str_appendl(&csvline, &delimiter, 1); } - STR_RELEASE(field_str); + zend_string_release(field_str); } ZEND_HASH_FOREACH_END(); smart_str_appendc(&csvline, '\n'); @@ -1956,7 +1956,7 @@ PHP_FUNCTION(fgetcsv) /* first section exactly as php_fgetss */ - php_int_t len = 0; + zend_long len = 0; size_t buf_len; char *buf; php_stream *stream; @@ -2015,7 +2015,7 @@ PHP_FUNCTION(fgetcsv) } if (len_zv != NULL && Z_TYPE_P(len_zv) != IS_NULL) { - len = zval_get_int(len_zv); + len = zval_get_long(len_zv); if (len < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative"); RETURN_FALSE; @@ -2454,9 +2454,9 @@ PHP_FUNCTION(fnmatch) { char *pattern, *filename; int pattern_len, filename_len; - php_int_t flags = 0; + zend_long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|i", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { return; } diff --git a/ext/standard/file.h b/ext/standard/file.h index b667a29233..e29d4b3c73 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -77,8 +77,8 @@ PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC); PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC); PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC); PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC); -PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC); -PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC); +PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options TSRMLS_DC); +PHPAPI int php_mkdir(const char *dir, zend_long mode TSRMLS_DC); PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); @@ -117,8 +117,8 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC); typedef struct { int pclose_ret; size_t def_chunk_size; - php_int_t auto_detect_line_endings; - php_int_t default_socket_timeout; + zend_long auto_detect_line_endings; + zend_long default_socket_timeout; char *user_agent; /* for the http wrapper */ char *from_address; /* for the ftp and http wrappers */ const char *user_stream_current_filename; /* for simple recursion protection */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 8e24fec657..c0ea9bc056 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -158,7 +158,7 @@ static int php_disk_total_space(char *path, double *space TSRMLS_DC) /* {{{ */ /* i know - this is ugly, but i works <thies@thieso.net> */ bytestotal = TotalNumberOfBytes.HighPart * - (double) (((php_uint_t)1) << 31) * 2.0 + + (double) (((zend_ulong)1) << 31) * 2.0 + TotalNumberOfBytes.LowPart; } else { /* If it's not available, we just use GetDiskFreeSpace */ if (GetDiskFreeSpace(path, @@ -290,7 +290,7 @@ static int php_disk_free_space(char *path, double *space TSRMLS_DC) /* {{{ */ /* i know - this is ugly, but i works <thies@thieso.net> */ bytesfree = FreeBytesAvailableToCaller.HighPart * - (double) (((php_uint_t)1) << 31) * 2.0 + + (double) (((zend_ulong)1) << 31) * 2.0 + FreeBytesAvailableToCaller.LowPart; } else { /* If it's not available, we just use GetDiskFreeSpace */ if (GetDiskFreeSpace(path, @@ -437,9 +437,9 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(group) == IS_INT) { + if (Z_TYPE_P(group) == IS_LONG) { option = PHP_STREAM_META_GROUP; - value = &Z_IVAL_P(group); + value = &Z_LVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { option = PHP_STREAM_META_GROUP_NAME; value = Z_STRVAL_P(group); @@ -465,8 +465,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ /* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */ RETURN_FALSE; #else - if (Z_TYPE_P(group) == IS_INT) { - gid = (gid_t)Z_IVAL_P(group); + if (Z_TYPE_P(group) == IS_LONG) { + gid = (gid_t)Z_LVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { if(php_get_gid_by_name(Z_STRVAL_P(group), &gid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group)); @@ -574,9 +574,9 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(user) == IS_INT) { + if (Z_TYPE_P(user) == IS_LONG) { option = PHP_STREAM_META_OWNER; - value = &Z_IVAL_P(user); + value = &Z_LVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { option = PHP_STREAM_META_OWNER_NAME; value = Z_STRVAL_P(user); @@ -603,8 +603,8 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ RETURN_FALSE; #else - if (Z_TYPE_P(user) == IS_INT) { - uid = (uid_t)Z_IVAL_P(user); + if (Z_TYPE_P(user) == IS_LONG) { + uid = (uid_t)Z_LVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { if(php_get_uid_by_name(Z_STRVAL_P(user), &uid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user)); @@ -668,12 +668,12 @@ PHP_FUNCTION(chmod) { char *filename; int filename_len; - php_int_t mode; + zend_long mode; int ret; mode_t imode; php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) { return; } @@ -714,14 +714,14 @@ PHP_FUNCTION(touch) { char *filename; int filename_len; - php_int_t filetime = 0, fileatime = 0; + zend_long filetime = 0, fileatime = 0; int ret, argc = ZEND_NUM_ARGS(); FILE *file; struct utimbuf newtimebuf; struct utimbuf *newtime = &newtimebuf; php_stream_wrapper *wrapper; - if (zend_parse_parameters(argc TSRMLS_CC, "p|ii", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { return; } @@ -962,21 +962,21 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ switch (type) { case FS_PERMS: - RETURN_INT((php_int_t)ssb.sb.st_mode); + RETURN_LONG((zend_long)ssb.sb.st_mode); case FS_INODE: - RETURN_INT((php_int_t)ssb.sb.st_ino); + RETURN_LONG((zend_long)ssb.sb.st_ino); case FS_SIZE: - RETURN_INT((php_int_t)ssb.sb.st_size); + RETURN_LONG((zend_long)ssb.sb.st_size); case FS_OWNER: - RETURN_INT((php_int_t)ssb.sb.st_uid); + RETURN_LONG((zend_long)ssb.sb.st_uid); case FS_GROUP: - RETURN_INT((php_int_t)ssb.sb.st_gid); + RETURN_LONG((zend_long)ssb.sb.st_gid); case FS_ATIME: - RETURN_INT((php_int_t)ssb.sb.st_atime); + RETURN_LONG((zend_long)ssb.sb.st_atime); case FS_MTIME: - RETURN_INT((php_int_t)ssb.sb.st_mtime); + RETURN_LONG((zend_long)ssb.sb.st_mtime); case FS_CTIME: - RETURN_INT((php_int_t)ssb.sb.st_ctime); + RETURN_LONG((zend_long)ssb.sb.st_ctime); case FS_TYPE: if (S_ISLNK(ssb.sb.st_mode)) { RETURN_STRING("link"); @@ -1012,30 +1012,30 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ case FS_STAT: array_init(return_value); - ZVAL_INT(&stat_dev, stat_sb->st_dev); - ZVAL_INT(&stat_ino, stat_sb->st_ino); - ZVAL_INT(&stat_mode, stat_sb->st_mode); - ZVAL_INT(&stat_nlink, stat_sb->st_nlink); - ZVAL_INT(&stat_uid, stat_sb->st_uid); - ZVAL_INT(&stat_gid, stat_sb->st_gid); + ZVAL_LONG(&stat_dev, stat_sb->st_dev); + ZVAL_LONG(&stat_ino, stat_sb->st_ino); + ZVAL_LONG(&stat_mode, stat_sb->st_mode); + ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); + ZVAL_LONG(&stat_uid, stat_sb->st_uid); + ZVAL_LONG(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_INT(&stat_rdev, stat_sb->st_rdev); + ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_INT(&stat_rdev, -1); + ZVAL_LONG(&stat_rdev, -1); #endif - ZVAL_INT(&stat_size, stat_sb->st_size); - ZVAL_INT(&stat_atime, stat_sb->st_atime); - ZVAL_INT(&stat_mtime, stat_sb->st_mtime); - ZVAL_INT(&stat_ctime, stat_sb->st_ctime); + ZVAL_LONG(&stat_size, stat_sb->st_size); + ZVAL_LONG(&stat_atime, stat_sb->st_atime); + ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); + ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_INT(&stat_blksize, stat_sb->st_blksize); + ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_INT(&stat_blksize,-1); + ZVAL_LONG(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_INT(&stat_blocks, stat_sb->st_blocks); + ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_INT(&stat_blocks,-1); + ZVAL_LONG(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1201,7 +1201,7 @@ PHP_FUNCTION(realpath_cache_size) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_INT(realpath_cache_size(TSRMLS_C)); + RETURN_LONG(realpath_cache_size(TSRMLS_C)); } /* {{{ proto bool realpath_cache_get() @@ -1224,13 +1224,13 @@ PHP_FUNCTION(realpath_cache_get) /* bucket->key is unsigned long */ if (ZEND_INT_MAX >= bucket->key) { - add_assoc_int(&entry, "key", bucket->key); + add_assoc_long(&entry, "key", bucket->key); } else { add_assoc_double(&entry, "key", (double)bucket->key); } add_assoc_bool(&entry, "is_dir", bucket->is_dir); add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len); - add_assoc_int(&entry, "expires", bucket->expires); + add_assoc_long(&entry, "expires", bucket->expires); #ifdef PHP_WIN32 add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid); add_assoc_bool(&entry, "is_wvalid", bucket->is_wvalid); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 7944cdc4c7..f7ddbf5a39 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -263,14 +263,14 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { convert_to_string_ex(tmp); smart_str_appendc(&tags_ss, '<'); - smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); smart_str_appendc(&tags_ss, '>'); } ZEND_HASH_FOREACH_END(); smart_str_0(&tags_ss); } else { /* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */ convert_to_string_ex(filterparams); - smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRSIZE_P(filterparams)); + smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRLEN_P(filterparams)); } } @@ -1224,7 +1224,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr *pretval_len = str->len; memcpy(*pretval, str->val, str->len + 1); - STR_RELEASE(str); + zend_string_release(str); } else { return PHP_CONV_ERR_NOT_FOUND; } @@ -1232,7 +1232,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr } #if IT_WAS_USED -static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t *pretval, char *field_name, size_t field_name_len) +static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, zend_long *pretval, char *field_name, size_t field_name_len) { zval **tmpval; @@ -1241,13 +1241,13 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t * if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { zval tmp, *ztval = *tmpval; - if (Z_TYPE_PP(tmpval) != IS_INT) { + if (Z_TYPE_PP(tmpval) != IS_LONG) { tmp = *ztval; zval_copy_ctor(&tmp); convert_to_int(&tmp); ztval = &tmp; } - *pretval = Z_IVAL_P(ztval); + *pretval = Z_LVAL_P(ztval); } else { return PHP_CONV_ERR_NOT_FOUND; } @@ -1255,7 +1255,7 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t * } #endif -static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, php_uint_t *pretval, char *field_name, size_t field_name_len) +static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, zend_ulong *pretval, char *field_name, size_t field_name_len) { zval *tmpval; @@ -1264,15 +1264,15 @@ static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, php_uint_t if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) { zval tmp; - if (Z_TYPE_P(tmpval) != IS_INT) { + if (Z_TYPE_P(tmpval) != IS_LONG) { ZVAL_DUP(&tmp, tmpval);; convert_to_int(&tmp); tmpval = &tmp; } - if (Z_IVAL_P(tmpval) < 0) { + if (Z_LVAL_P(tmpval) < 0) { *pretval = 0; } else { - *pretval = Z_IVAL_P(tmpval); + *pretval = Z_LVAL_P(tmpval); } } else { return PHP_CONV_ERR_NOT_FOUND; @@ -1306,7 +1306,7 @@ static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretva #if IT_WAS_USED static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len) { - php_int_t l; + zend_long l; php_conv_err_t err; *pretval = 0; @@ -1320,7 +1320,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len) { - php_uint_t l; + zend_ulong l; php_conv_err_t err; *pretval = 0; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 3c570d32ee..a445625297 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -56,7 +56,7 @@ php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC { if (!*buffer || (*pos + 1) >= (*buffer)->len) { PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), (*buffer)->len)); - *buffer = STR_REALLOC(*buffer, (*buffer)->len << 1, 0); + *buffer = zend_string_realloc(*buffer, (*buffer)->len << 1, 0); } PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos)); (*buffer)->val[(*pos)++] = add; @@ -88,7 +88,7 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, req_size = *pos + m_width + 1; if (!*buffer || req_size > (*buffer)->len) { - zend_size_t size = (*buffer)->len; + size_t size = (*buffer)->len; while (req_size > size) { if (size > ZEND_SIZE_MAX/2) { zend_error_noreturn(E_ERROR, "Field width %zd is too long", req_size); @@ -96,7 +96,7 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, size <<= 1; } PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", size)); - *buffer = STR_REALLOC(*buffer, size, 0); + *buffer = zend_string_realloc(*buffer, size, 0); } if (alignment == ALIGN_RIGHT) { if ((neg || always_sign) && padding=='0') { @@ -122,21 +122,21 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, /* php_spintf_appendint() {{{ */ inline static void -php_sprintf_appendint(zend_string **buffer, php_size_t *pos, php_int_t number, +php_sprintf_appendint(zend_string **buffer, php_size_t *pos, zend_long number, php_size_t width, char padding, php_size_t alignment, int always_sign) { char numbuf[NUM_BUF_SIZE]; - register php_uint_t magn, nmagn; + register zend_ulong magn, nmagn; register unsigned int i = NUM_BUF_SIZE - 1, neg = 0; PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n", *buffer, pos, &(*buffer)->len, number, width, padding, alignment)); if (number < 0) { neg = 1; - magn = ((php_uint_t) -(number + 1)) + 1; + magn = ((zend_ulong) -(number + 1)) + 1; } else { - magn = (php_uint_t) number; + magn = (zend_ulong) number; } /* Can't right-pad 0's on integers */ @@ -167,16 +167,16 @@ php_sprintf_appendint(zend_string **buffer, php_size_t *pos, php_int_t number, /* php_spintf_appenduint() {{{ */ inline static void php_sprintf_appenduint(zend_string **buffer, php_size_t *pos, - php_uint_t number, + zend_ulong number, php_size_t width, char padding, php_size_t alignment) { char numbuf[NUM_BUF_SIZE]; - register php_uint_t magn, nmagn; + register zend_ulong magn, nmagn; register unsigned int i = NUM_BUF_SIZE - 1; PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n", *buffer, pos, &(*buffer)->len, number, width, padding, alignment)); - magn = (php_uint_t) number; + magn = (zend_ulong) number; /* Can't right-pad 0's on integers */ if (alignment == 0 && padding == '0') padding = ' '; @@ -290,13 +290,13 @@ php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos, /* php_spintf_appendd2n() {{{ */ inline static void -php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number, +php_sprintf_append2n(zend_string **buffer, php_size_t *pos, zend_long number, php_size_t width, char padding, php_size_t alignment, int n, char *chartable, int expprec) { char numbuf[NUM_BUF_SIZE]; - register php_uint_t num; - register php_uint_t i = NUM_BUF_SIZE - 1; + register zend_ulong num; + register zend_ulong i = NUM_BUF_SIZE - 1; register int andbits = (1 << n) - 1; PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n", @@ -304,7 +304,7 @@ php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number, chartable)); PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits)); - num = (php_uint_t) number; + num = (zend_ulong) number; numbuf[i] = '\0'; do { @@ -324,7 +324,7 @@ inline static int php_sprintf_getnumber(char *buffer, php_size_t *pos) { char *endptr; - register php_int_t num = ZEND_STRTOI(&buffer[*pos], &endptr, 10); + register zend_long num = ZEND_STRTOI(&buffer[*pos], &endptr, 10); register php_size_t i = 0; if (endptr != NULL) { @@ -414,12 +414,12 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) } format = Z_STRVAL(args[format_offset]); - format_len = Z_STRSIZE(args[format_offset]); - result = STR_ALLOC(size, 0); + format_len = Z_STRLEN(args[format_offset]); + result = zend_string_alloc(size, 0); currarg = 1; - while (inpos < Z_STRSIZE(args[format_offset])) { + while (inpos < Z_STRLEN(args[format_offset])) { int expprec = 0; zval *tmp; @@ -561,20 +561,20 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) alignment, str->len, 0, expprec, 0); - STR_RELEASE(str); + zend_string_release(str); break; } case 'd': php_sprintf_appendint(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment, always_sign); break; case 'u': php_sprintf_appenduint(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment); break; @@ -594,33 +594,33 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) case 'c': php_sprintf_appendchar(&result, &outpos, - (char) zval_get_int(tmp) TSRMLS_CC); + (char) zval_get_long(tmp) TSRMLS_CC); break; case 'o': php_sprintf_append2n(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment, 3, hexchars, expprec); break; case 'x': php_sprintf_append2n(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment, 4, hexchars, expprec); break; case 'X': php_sprintf_append2n(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment, 4, HEXCHARS, expprec); break; case 'b': php_sprintf_append2n(&result, &outpos, - zval_get_int(tmp), + zval_get_long(tmp), width, padding, alignment, 1, hexchars, expprec); break; @@ -684,8 +684,8 @@ PHP_FUNCTION(user_printf) RETURN_FALSE; } rlen = PHPWRITE(result->val, result->len); - STR_FREE(result); - RETURN_INT(rlen); + zend_string_free(result); + RETURN_LONG(rlen); } /* }}} */ @@ -700,8 +700,8 @@ PHP_FUNCTION(vprintf) RETURN_FALSE; } rlen = PHPWRITE(result->val, result->len); - STR_FREE(result); - RETURN_INT(rlen); + zend_string_free(result); + RETURN_LONG(rlen); } /* }}} */ @@ -729,8 +729,8 @@ PHP_FUNCTION(fprintf) php_stream_write(stream, result->val, result->len); - RETVAL_INT(result->len); - STR_FREE(result); + RETVAL_LONG(result->len); + zend_string_free(result); } /* }}} */ @@ -758,8 +758,8 @@ PHP_FUNCTION(vfprintf) php_stream_write(stream, result->val, result->len); - RETVAL_INT(result->len); - STR_FREE(result); + RETVAL_LONG(result->len); + zend_string_free(result); } /* }}} */ diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 72f892b60b..741e71aa84 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -33,21 +33,21 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) { char *host; int host_len; - php_int_t port = -1; + zend_long port = -1; zval *zerrno = NULL, *zerrstr = NULL; double timeout = FG(default_socket_timeout); - php_uint_t conv; + zend_ulong conv; struct timeval tv; char *hashkey = NULL; php_stream *stream = NULL; int err; char *hostname = NULL; - php_int_t hostname_len; + zend_long hostname_len; zend_string *errstr = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) { RETURN_FALSE; } @@ -69,7 +69,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, 0); + ZVAL_LONG(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -93,21 +93,21 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, err); + ZVAL_LONG(zerrno, err); } if (zerrstr && errstr) { /* no need to dup; we need to efree buf anyway */ zval_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (!zerrstr && errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } RETURN_FALSE; } if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } php_stream_to_zval(stream, return_value); diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 709d90840b..4833bddc01 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -41,16 +41,16 @@ PHP_FUNCTION(ftok) if (pathname_len == 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid"); - RETURN_INT(-1); + RETURN_LONG(-1); } if (proj_len != 1){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid"); - RETURN_INT(-1); + RETURN_LONG(-1); } if (php_check_open_basedir(pathname TSRMLS_CC)) { - RETURN_INT(-1); + RETURN_LONG(-1); } k = ftok(pathname, proj[0]); @@ -58,7 +58,7 @@ PHP_FUNCTION(ftok) php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno)); } - RETURN_INT(k); + RETURN_LONG(k); } /* }}} */ #endif diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 79665a4f99..cb96c190db 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -498,7 +498,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } else if (read_write == 2) { /* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "overwrite")) != NULL) { - allow_overwrite = Z_IVAL_P(tmpzval); + allow_overwrite = Z_LVAL_P(tmpzval); } if (result <= 299 && result >= 200) { if (allow_overwrite) { @@ -529,12 +529,12 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa /* set resume position if applicable */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL && - Z_TYPE_P(tmpzval) == IS_INT && - Z_IVAL_P(tmpzval) > 0) { - php_stream_printf(stream TSRMLS_CC, "REST %pd\r\n", Z_IVAL_P(tmpzval)); + Z_TYPE_P(tmpzval) == IS_LONG && + Z_LVAL_P(tmpzval) > 0) { + php_stream_printf(stream TSRMLS_CC, "REST %pd\r\n", Z_LVAL_P(tmpzval)); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %pd", Z_IVAL_P(tmpzval)); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %pd", Z_LVAL_P(tmpzval)); goto errexit; } } @@ -632,7 +632,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count tmp_len = MIN(sizeof(ent->d_name), basename->len - 1); memcpy(ent->d_name, basename->val, tmp_len); ent->d_name[tmp_len - 1] = '\0'; - STR_RELEASE(basename); + zend_string_release(basename); /* Trim off trailing whitespace characters */ tmp_len--; diff --git a/ext/standard/head.c b/ext/standard/head.c index 928c26293e..b53740563d 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -41,7 +41,7 @@ PHP_FUNCTION(header) zend_bool rep = 1; sapi_header_line ctr = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &ctr.line, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line, &ctr.line_len, &rep, &ctr.response_code) == FAILURE) return; @@ -97,7 +97,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t encoded_value = php_url_encode(value, value_len); len += encoded_value->len; } else if (value) { - encoded_value = STR_INIT(value, value_len, 0); + encoded_value = zend_string_init(value, value_len, 0); len += encoded_value->len; } @@ -118,7 +118,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t */ dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, 1, 0 TSRMLS_CC); snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s; Max-Age=0", name, dt->val); - STR_FREE(dt); + zend_string_free(dt); } else { snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value->val : ""); if (expires > 0) { @@ -129,14 +129,14 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t /* check to make sure that the year does not exceed 4 digits in length */ p = zend_memrchr(dt->val, '-', dt->len); if (!p || *(p + 5) != ' ') { - STR_FREE(dt); + zend_string_free(dt); efree(cookie); - STR_FREE(encoded_value); + zend_string_free(encoded_value); zend_error(E_WARNING, "Expiry date cannot have a year greater than 9999"); return FAILURE; } strlcat(cookie, dt->val, len + 100); - STR_FREE(dt); + zend_string_free(dt); snprintf(tsdelta, sizeof(tsdelta), "%li", (long) difftime(expires, time(NULL))); strlcat(cookie, COOKIE_MAX_AGE, len + 100); @@ -145,7 +145,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t } if (encoded_value) { - STR_FREE(encoded_value); + zend_string_free(encoded_value); } if (path && path_len > 0) { @@ -178,11 +178,11 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t PHP_FUNCTION(setcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; - php_int_t expires = 0; + zend_long expires = 0; zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; @@ -201,11 +201,11 @@ PHP_FUNCTION(setcookie) PHP_FUNCTION(setrawcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; - php_int_t expires = 0; + zend_long expires = 0; zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; @@ -239,7 +239,7 @@ PHP_FUNCTION(headers_sent) switch(ZEND_NUM_ARGS()) { case 2: zval_dtor(arg2); - ZVAL_INT(arg2, line); + ZVAL_LONG(arg2, line); case 1: zval_dtor(arg1); if (file) { @@ -289,21 +289,21 @@ PHP_FUNCTION(headers_list) Sets a response code, or returns the current HTTP response code */ PHP_FUNCTION(http_response_code) { - php_int_t response_code = 0; + zend_long response_code = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &response_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) { return; } if (response_code) { - php_int_t old_response_code; + zend_long old_response_code; old_response_code = SG(sapi_headers).http_response_code; SG(sapi_headers).http_response_code = response_code; if (old_response_code) { - RETURN_INT(old_response_code); + RETURN_LONG(old_response_code); } RETURN_TRUE; @@ -313,7 +313,7 @@ PHP_FUNCTION(http_response_code) RETURN_FALSE; } - RETURN_INT(SG(sapi_headers).http_response_code); + RETURN_LONG(SG(sapi_headers).http_response_code); } /* }}} */ diff --git a/ext/standard/html.c b/ext/standard/html.c index 7df76708a9..a2c7c29990 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -790,7 +790,7 @@ static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type) */ static inline int process_numeric_entity(const char **buf, unsigned *code_point) { - php_int_t code_l; + zend_long code_l; int hexadecimal = (**buf == 'x' || **buf == 'X'); /* TODO: XML apparently disallows "X" */ char *endptr; @@ -856,7 +856,7 @@ static inline int process_named_entity_html(const char **buf, const char **start static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; - php_uint_t hash = zend_inline_hash_func(start, length); + zend_ulong hash = zend_inline_hash_func(start, length); s = ht->buckets[hash % ht->num_elems]; while (s->entity) { @@ -1112,11 +1112,11 @@ PHPAPI zend_string *php_unescape_html_entities(unsigned char *old, size_t oldlen if (oldlen > new_size) { /* overflow, refuse to do anything */ - ret = STR_INIT((char*)old, oldlen, 0); + ret = zend_string_init((char*)old, oldlen, 0); retlen = oldlen; goto empty_source; } - ret = STR_ALLOC(new_size, 0); + ret = zend_string_alloc(new_size, 0); ret->val[0] = '\0'; ret->len = oldlen; retlen = oldlen; @@ -1275,7 +1275,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle } } - replaced = STR_ALLOC(maxlen, 0); + replaced = zend_string_alloc(maxlen, 0); len = 0; cursor = 0; while (cursor < oldlen) { @@ -1288,7 +1288,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle /* guarantee we have at least 40 bytes to write. * In HTML5, entities may take up to 33 bytes */ if (len > maxlen - 40) { /* maxlen can never be smaller than 128 */ - replaced = STR_SAFE_REALLOC(replaced, maxlen, 1, 128, 0); + replaced = zend_string_safe_realloc(replaced, maxlen, 1, 128, 0); maxlen += 128; } @@ -1301,7 +1301,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle len += replacement_len; continue; } else { - STR_FREE(replaced); + zend_string_free(replaced); return STR_EMPTY_ALLOC(); } } else { /* SUCCESS */ @@ -1420,7 +1420,7 @@ encode_amp: /* at this point maxlen - len >= 40 */ if (maxlen - len < ent_len + 2 /* & and ; */) { /* ent_len < oldlen, which is certainly <= SIZE_MAX/2 */ - replaced = STR_SAFE_REALLOC(replaced, maxlen, 1, ent_len + 128, 0); + replaced = zend_string_safe_realloc(replaced, maxlen, 1, ent_len + 128, 0); maxlen += ent_len + 128; } replaced->val[len++] = '&'; @@ -1444,19 +1444,19 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { zend_string *str, *hint_charset = NULL; char *default_charset; - php_int_t flags = ENT_COMPAT; + zend_long flags = ENT_COMPAT; zend_string *replaced; zend_bool double_encode = 1; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_INT(flags) + Z_PARAM_LONG(flags) Z_PARAM_STR_EX(hint_charset, 1, 0) Z_PARAM_BOOL(double_encode); ZEND_PARSE_PARAMETERS_END(); @@ -1477,18 +1477,18 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) */ void register_html_constants(INIT_FUNC_ARGS) { - REGISTER_INT_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); } /* }}} */ @@ -1506,10 +1506,10 @@ PHP_FUNCTION(htmlspecialchars_decode) { char *str; int str_len; - php_int_t quote_style = ENT_COMPAT; + zend_long quote_style = ENT_COMPAT; zend_string *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, "e_style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, "e_style) == FAILURE) { return; } @@ -1528,11 +1528,11 @@ PHP_FUNCTION(html_entity_decode) zend_string *str, *hint_charset = NULL; char *default_charset; size_t new_len = 0; - php_int_t quote_style = ENT_COMPAT; + zend_long quote_style = ENT_COMPAT; zend_string *replaced; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS", &str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, "e_style, &hint_charset) == FAILURE) { return; } @@ -1540,7 +1540,7 @@ PHP_FUNCTION(html_entity_decode) ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_INT(quote_style) + Z_PARAM_LONG(quote_style) Z_PARAM_STR(hint_charset) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1626,7 +1626,7 @@ static inline void write_s3row_data( Returns the internal translation table used by htmlspecialchars and htmlentities */ PHP_FUNCTION(get_html_translation_table) { - php_int_t all = HTML_SPECIALCHARS, + zend_long all = HTML_SPECIALCHARS, flags = ENT_COMPAT; int doctype; entity_table_opt entity_table; @@ -1639,7 +1639,7 @@ PHP_FUNCTION(get_html_translation_table) * getting the translated table from data structures that are optimized for * random access, not traversal */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { return; } diff --git a/ext/standard/http.c b/ext/standard/http.c index 58c6d1d8f4..609a6ffa65 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -35,7 +35,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, char *newprefix, *p; const char *prop_name; int arg_sep_len, newprefix_len, prop_len; - php_uint_t idx; + zend_ulong idx; zval *zdata = NULL, copyzval; if (!ht) { @@ -95,7 +95,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, memcpy(p, ekey->val, ekey->len); p += ekey->len; - STR_FREE(ekey); + zend_string_free(ekey); if (key_suffix) { memcpy(p, key_suffix, key_suffix_len); @@ -160,7 +160,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, ekey = php_url_encode(prop_name, prop_len); } smart_str_appendl(formstr, ekey->val, ekey->len); - STR_FREE(ekey); + zend_string_free(ekey); } else { char *ekey; int ekey_len; @@ -178,19 +178,19 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, case IS_STRING: { zend_string *ekey; if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); + ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); } else { - ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); + ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); } smart_str_appendl(formstr, ekey->val, ekey->len); - STR_FREE(ekey); + zend_string_free(ekey); } break; - case IS_INT: + case IS_LONG: { char *ekey; int ekey_len; - ekey_len = spprintf(&ekey, 0, "%pd", Z_IVAL_P(zdata)); + ekey_len = spprintf(&ekey, 0, "%pd", Z_LVAL_P(zdata)); smart_str_appendl(formstr, ekey, ekey_len); efree(ekey); } @@ -217,13 +217,13 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, ZVAL_DUP(©zval, zdata); convert_to_string_ex(©zval); if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); + ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); } else { - ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); + ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); } smart_str_appendl(formstr, ekey->val, ekey->len); zval_ptr_dtor(©zval); - STR_FREE(ekey); + zend_string_free(ekey); } } } @@ -241,9 +241,9 @@ PHP_FUNCTION(http_build_query) char *prefix = NULL, *arg_sep=NULL; int arg_sep_len = 0, prefix_len = 0; smart_str formstr = {0}; - php_int_t enc_type = PHP_QUERY_RFC1738; + zend_long enc_type = PHP_QUERY_RFC1738; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssi", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) { RETURN_FALSE; } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 4359c34efa..4bf86a4947 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -160,7 +160,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (!context || (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) == NULL || Z_TYPE_P(tmpzval) != IS_STRING || - Z_STRSIZE_P(tmpzval) <= 0) { + Z_STRLEN_P(tmpzval) <= 0) { php_url_free(resource); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); } @@ -169,8 +169,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, use_ssl = 0; use_proxy = 1; - transport_len = Z_STRSIZE_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); + transport_len = Z_STRLEN_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); } else { /* Normal http request (possibly with proxy) */ @@ -190,10 +190,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (context && (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) != NULL && Z_TYPE_P(tmpzval) == IS_STRING && - Z_STRSIZE_P(tmpzval) > 0) { + Z_STRLEN_P(tmpzval) > 0) { use_proxy = 1; - transport_len = Z_STRSIZE_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); + transport_len = Z_STRLEN_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); } else { transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); } @@ -218,7 +218,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (errstr) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr->val); - STR_RELEASE(errstr); + zend_string_release(errstr); errstr = NULL; } @@ -271,7 +271,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, } while (*s != 0); } } ZEND_HASH_FOREACH_END(); - } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { + } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { s = Z_STRVAL_P(tmpzval); do { while (*s == ' ' || *s == '\t') s++; @@ -346,20 +346,20 @@ finish: php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) { - redirect_max = zval_get_int(tmpzval); + redirect_max = zval_get_long(tmpzval); } if (context && (tmpzval = php_stream_context_get_option(context, "http", "method")) != NULL) { - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { /* As per the RFC, automatically redirected requests MUST NOT use other methods than * GET and HEAD unless it can be confirmed by the user */ if (!redirected - || (Z_STRSIZE_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) - || (Z_STRSIZE_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) + || (Z_STRLEN_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) + || (Z_STRLEN_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) ) { - scratch_len = strlen(path) + 29 + Z_STRSIZE_P(tmpzval); + scratch_len = strlen(path) + 29 + Z_STRLEN_P(tmpzval); scratch = emalloc(scratch_len); - strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) + 1); + strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) + 1); strncat(scratch, " ", 1); } } @@ -422,7 +422,7 @@ finish: ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) { if (Z_TYPE_P(tmpheader) == IS_STRING) { - smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRSIZE_P(tmpheader)); + smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRLEN_P(tmpheader)); smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); } } ZEND_HASH_FOREACH_END(); @@ -433,9 +433,9 @@ finish: smart_str_free(&tmpstr); } } - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ - tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { char *s; @@ -537,7 +537,7 @@ finish: php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0); } - STR_FREE(stmp); + zend_string_free(stmp); } /* if the user has configured who they are, send a From: line */ @@ -609,9 +609,9 @@ finish: context && !(have_header & HTTP_HEADER_CONTENT_LENGTH) && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0 + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0 ) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); have_header |= HTTP_HEADER_CONTENT_LENGTH; } @@ -624,9 +624,9 @@ finish: /* Request content, such as for POST requests */ if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); } if (!(have_header & HTTP_HEADER_TYPE)) { @@ -635,7 +635,7 @@ finish: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } php_stream_write(stream, "\r\n", sizeof("\r\n")-1); - php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); + php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); } else { php_stream_write(stream, "\r\n", sizeof("\r\n")-1); } @@ -731,7 +731,7 @@ finish: if (!strncasecmp(http_header_line, "Location: ", 10)) { if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) { - follow_location = zval_get_int(tmpzval); + follow_location = zval_get_long(tmpzval); } else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) { /* we shouldn't redirect automatically if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307) @@ -749,7 +749,7 @@ finish: /* create filter to decode response body */ if (!(options & STREAM_ONLY_GET_HEADERS)) { - php_int_t decode = 1; + zend_long decode = 1; if (context && (tmpzval = php_stream_context_get_option(context, "http", "auto_decode")) != NULL) { decode = zend_is_true(tmpzval TSRMLS_CC); diff --git a/ext/standard/image.c b/ext/standard/image.c index 24576fd671..79e26c6310 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -72,28 +72,28 @@ struct gfxinfo { * Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */ PHP_MINIT_FUNCTION(imagetypes) { - REGISTER_INT_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); #if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) - REGISTER_INT_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_INT_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ - REGISTER_INT_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ + REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -237,7 +237,7 @@ static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC) } while ((status==Z_BUF_ERROR)&&(factor<maxfactor)); if (bufz) { - STR_RELEASE(bufz); + zend_string_release(bufz); } if (status == Z_OK) { @@ -1160,9 +1160,9 @@ PHPAPI char * php_image_type_to_mime_type(int image_type) Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ PHP_FUNCTION(image_type_to_mime_type) { - php_int_t p_image_type; + zend_long p_image_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &p_image_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &p_image_type) == FAILURE) { return; } @@ -1174,10 +1174,10 @@ PHP_FUNCTION(image_type_to_mime_type) Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ PHP_FUNCTION(image_type_to_extension) { - php_int_t image_type; + zend_long image_type; zend_bool inc_dot=1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|b", &image_type, &inc_dot) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &image_type, &inc_dot) == FAILURE) { RETURN_FALSE; } @@ -1364,19 +1364,19 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA } if (result) { - char temp[MAX_LENGTH_OF_ZEND_INT * 2 + sizeof("width=\"\" height=\"\"")]; + char temp[MAX_LENGTH_OF_LONG * 2 + sizeof("width=\"\" height=\"\"")]; array_init(return_value); - add_index_int(return_value, 0, result->width); - add_index_int(return_value, 1, result->height); - add_index_int(return_value, 2, itype); + add_index_long(return_value, 0, result->width); + add_index_long(return_value, 1, result->height); + add_index_long(return_value, 2, itype); snprintf(temp, sizeof(temp), "width=\"%d\" height=\"%d\"", result->width, result->height); add_index_string(return_value, 3, temp); if (result->bits != 0) { - add_assoc_int(return_value, "bits", result->bits); + add_assoc_long(return_value, "bits", result->bits); } if (result->channels != 0) { - add_assoc_int(return_value, "channels", result->channels); + add_assoc_long(return_value, "channels", result->channels); } add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype)); efree(result); diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index fb63703792..c76451cef9 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -42,7 +42,7 @@ static void incomplete_class_message(zval *object, int error_type TSRMLS_DC) if (class_name) { php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name->val); - STR_RELEASE(class_name); + zend_string_release(class_name); } else { php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, "unknown"); } @@ -141,7 +141,7 @@ PHPAPI zend_string *php_lookup_class_name(zval *object) object_properties = Z_OBJPROP_P(object); if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL) { - return STR_COPY(Z_STR_P(val)); + return zend_string_copy(Z_STR_P(val)); } return NULL; diff --git a/ext/standard/info.c b/ext/standard/info.c index 92ee07a925..d0d1d114e6 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -69,7 +69,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */ new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC); written = php_output_write(new_str->val, new_str->len TSRMLS_CC); - STR_FREE(new_str); + zend_string_free(new_str); return written; } /* }}} */ @@ -196,10 +196,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) { zval *data, *tmp, tmp2; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; zend_string *key; - key = STR_INIT(name, name_length, 0); + key = zend_string_init(name, name_length, 0); zend_is_auto_global(key TSRMLS_CC); if ((data = zend_hash_find(&EG(symbol_table).ht, key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) { @@ -244,10 +244,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } if (!sapi_module.phpinfo_as_text) { - if (Z_STRSIZE(tmp2) == 0) { + if (Z_STRLEN(tmp2) == 0) { php_info_print("<i>no value</i>"); } else { - php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2)); + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); } } else { php_info_print(Z_STRVAL(tmp2)); @@ -264,7 +264,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } } ZEND_HASH_FOREACH_END(); } - STR_FREE(key); + zend_string_free(key); } /* }}} */ @@ -655,7 +655,7 @@ PHPAPI zend_string *php_get_uname(char mode) php_uname = PHP_UNAME; #endif #endif - return STR_INIT(php_uname, strlen(php_uname), 0); + return zend_string_init(php_uname, strlen(php_uname), 0); } /* }}} */ @@ -833,7 +833,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC); } php_info_print_box_end(); - STR_FREE(php_uname); + zend_string_free(php_uname); } zend_ini_sort_entries(TSRMLS_C); @@ -1143,22 +1143,22 @@ PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, */ void register_phpinfo_constants(INIT_FUNC_ARGS) { - REGISTER_INT_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); } /* }}} */ @@ -1166,9 +1166,9 @@ void register_phpinfo_constants(INIT_FUNC_ARGS) Output a page of useful information about PHP and the current request */ PHP_FUNCTION(phpinfo) { - php_int_t flag = PHP_INFO_ALL; + zend_long flag = PHP_INFO_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { return; } @@ -1210,9 +1210,9 @@ PHP_FUNCTION(phpversion) Prints the list of people who've contributed to the PHP project */ PHP_FUNCTION(phpcredits) { - php_int_t flag = PHP_CREDITS_ALL; + zend_long flag = PHP_CREDITS_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { return; } diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 9102b4b07a..daf667df87 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -179,7 +179,7 @@ PHP_FUNCTION(iptcembed) { char *iptcdata, *jpeg_file; int iptcdata_len, jpeg_file_len; - php_int_t spool = 0; + zend_long spool = 0; FILE *fp; unsigned int marker, done = 0; int inx; @@ -187,7 +187,7 @@ PHP_FUNCTION(iptcembed) struct stat sb; zend_bool written = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|i", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) { return; } @@ -334,8 +334,8 @@ PHP_FUNCTION(iptcparse) if((inx+6) >= str_len) { break; } - len = (((php_int_t) buffer[ inx + 2 ]) << 24) + (((php_int_t) buffer[ inx + 3 ]) << 16) + - (((php_int_t) buffer[ inx + 4 ]) << 8) + (((php_int_t) buffer[ inx + 5 ])); + len = (((zend_long) buffer[ inx + 2 ]) << 24) + (((zend_long) buffer[ inx + 3 ]) << 16) + + (((zend_long) buffer[ inx + 4 ]) << 8) + (((zend_long) buffer[ inx + 5 ])); inx += 6; } else { /* short tag */ len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ]; diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 232366e030..03e7e0075d 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -95,7 +95,7 @@ PHP_FUNCTION(levenshtein) char *str1, *str2; char *callback_name; int str1_len, str2_len, callback_len; - php_int_t cost_ins, cost_rep, cost_del; + zend_long cost_ins, cost_rep, cost_del; int distance = -1; switch (argc) { @@ -107,7 +107,7 @@ PHP_FUNCTION(levenshtein) break; case 5: /* more general version: calc cost by ins/rep/del weights */ - if (zend_parse_parameters(5 TSRMLS_CC, "ssiii", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) { + if (zend_parse_parameters(5 TSRMLS_CC, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) { return; } distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del); @@ -128,7 +128,7 @@ PHP_FUNCTION(levenshtein) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long"); } - RETURN_INT(distance); + RETURN_LONG(distance); } /* }}} */ diff --git a/ext/standard/link.c b/ext/standard/link.c index 4265823616..0f889a9e6a 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -106,11 +106,11 @@ PHP_FUNCTION(linkinfo) if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); efree(dirname); - RETURN_INT(-1L); + RETURN_LONG(-1L); } efree(dirname); - RETURN_INT((long) sb.st_dev); + RETURN_LONG((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index 8a04fb3f77..f0875d8ee5 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -98,10 +98,10 @@ PHP_FUNCTION(linkinfo) ret = VCWD_STAT(link, &sb); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); - RETURN_INT(-1L); + RETURN_LONG(-1L); } - RETURN_INT((long) sb.st_dev); + RETURN_LONG((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 0ce10bb02a..1b0e2e37b6 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -72,7 +72,7 @@ *p = ' '; \ } \ -extern php_int_t php_getuid(TSRMLS_D); +extern zend_long php_getuid(TSRMLS_D); /* {{{ proto int ezmlm_hash(string addr) Calculate EZMLM list hash value. */ @@ -92,7 +92,7 @@ PHP_FUNCTION(ezmlm_hash) h = (h % 53); - RETURN_INT((int) h); + RETURN_LONG((int) h); } /* }}} */ @@ -182,7 +182,7 @@ PHP_FUNCTION(mail) } if (extra_cmd) { - STR_RELEASE(extra_cmd); + zend_string_release(extra_cmd); } if (to_r != to) { efree(to_r); @@ -259,7 +259,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s\n", date_str->val, zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); - STR_FREE(date_str); + zend_string_free(date_str); if (hdr) { php_mail_log_crlf_to_spaces(tmp); @@ -289,7 +289,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char } else { spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_INT_FMT ":%s", php_getuid(TSRMLS_C), f->val); } - STR_RELEASE(f); + zend_string_release(f); } if (!sendmail_path) { diff --git a/ext/standard/math.c b/ext/standard/math.c index 267b8c0170..f9d144e295 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -285,11 +285,11 @@ PHP_FUNCTION(abs) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_INT) { - if (Z_IVAL_P(value) == ZEND_INT_MIN) { + } else if (Z_TYPE_P(value) == IS_LONG) { + if (Z_LVAL_P(value) == ZEND_INT_MIN) { RETURN_DOUBLE(-(double)ZEND_INT_MIN); } else { - RETURN_INT(Z_IVAL_P(value) < 0 ? -Z_IVAL_P(value) : Z_IVAL_P(value)); + RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value)); } } RETURN_FALSE; @@ -309,7 +309,7 @@ PHP_FUNCTION(ceil) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(ceil(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_INT) { + } else if (Z_TYPE_P(value) == IS_LONG) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -329,7 +329,7 @@ PHP_FUNCTION(floor) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(floor(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_INT) { + } else if (Z_TYPE_P(value) == IS_LONG) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -342,11 +342,11 @@ PHP_FUNCTION(round) { zval *value; int places = 0; - php_int_t precision = 0; - php_int_t mode = PHP_ROUND_HALF_UP; + zend_long precision = 0; + zend_long mode = PHP_ROUND_HALF_UP; double return_val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", &value, &precision, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &value, &precision, &mode) == FAILURE) { return; } @@ -356,15 +356,15 @@ PHP_FUNCTION(round) convert_scalar_to_number_ex(value); switch (Z_TYPE_P(value)) { - case IS_INT: + case IS_LONG: /* Simple case - long that doesn't need to be rounded. */ if (places >= 0) { - RETURN_DOUBLE((double) Z_IVAL_P(value)); + RETURN_DOUBLE((double) Z_LVAL_P(value)); } /* break omitted intentionally */ case IS_DOUBLE: - return_val = (Z_TYPE_P(value) == IS_INT) ? (double)Z_IVAL_P(value) : Z_DVAL_P(value); + return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value); return_val = _php_math_round(return_val, places, mode); RETURN_DOUBLE(return_val); break; @@ -926,9 +926,9 @@ PHP_FUNCTION(rad2deg) /* * Convert a string representation of a base(2-36) number to a long. */ -PHPAPI php_int_t _php_math_basetolong(zval *arg, int base) +PHPAPI zend_long _php_math_basetolong(zval *arg, int base) { - php_int_t num = 0, digit, onum; + zend_long num = 0, digit, onum; int i; char c, *s; @@ -938,7 +938,7 @@ PHPAPI php_int_t _php_math_basetolong(zval *arg, int base) s = Z_STRVAL_P(arg); - for (i = Z_STRSIZE_P(arg); i > 0; i--) { + for (i = Z_STRLEN_P(arg); i > 0; i--) { c = *s++; digit = (c >= '0' && c <= '9') ? c - '0' @@ -973,12 +973,12 @@ PHPAPI php_int_t _php_math_basetolong(zval *arg, int base) */ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) { - php_int_t num = 0; + zend_long num = 0; double fnum = 0; int i; int mode = 0; char c, *s; - php_int_t cutoff; + zend_long cutoff; int cutlim; if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { @@ -990,7 +990,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) cutoff = ZEND_INT_MAX / base; cutlim = ZEND_INT_MAX % base; - for (i = Z_STRSIZE_P(arg); i > 0; i--) { + for (i = Z_STRLEN_P(arg); i > 0; i--) { c = *s++; /* might not work for EBCDIC */ @@ -1024,7 +1024,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) if (mode == 1) { ZVAL_DOUBLE(ret, fnum); } else { - ZVAL_INT(ret, num); + ZVAL_LONG(ret, num); } return SUCCESS; } @@ -1038,15 +1038,15 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - char buf[(sizeof(php_uint_t) << 3) + 1]; + char buf[(sizeof(zend_ulong) << 3) + 1]; char *ptr, *end; - php_uint_t value; + zend_ulong value; - if (Z_TYPE_P(arg) != IS_INT || base < 2 || base > 36) { + if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } - value = Z_IVAL_P(arg); + value = Z_LVAL_P(arg); end = ptr = buf + sizeof(buf) - 1; *ptr = '\0'; @@ -1056,7 +1056,7 @@ PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC) value /= base; } while (ptr > buf && value); - return STR_INIT(ptr, end - ptr, 0); + return zend_string_init(ptr, end - ptr, 0); } /* }}} */ @@ -1069,7 +1069,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - if ((Z_TYPE_P(arg) != IS_INT && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { + if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } @@ -1092,7 +1092,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC) fvalue /= base; } while (ptr > buf && fabs(fvalue) >= 1); - return STR_INIT(ptr, end - ptr, 0); + return zend_string_init(ptr, end - ptr, 0); } return _php_math_longtobase(arg, base TSRMLS_CC); @@ -1200,10 +1200,10 @@ PHP_FUNCTION(dechex) PHP_FUNCTION(base_convert) { zval *number, temp; - php_int_t frombase, tobase; + zend_long frombase, tobase; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &number, &frombase, &tobase) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &number, &frombase, &tobase) == FAILURE) { return; } convert_to_string_ex(number); @@ -1292,7 +1292,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin if (is_negative) { reslen++; } - res = STR_ALLOC(reslen, 0); + res = zend_string_alloc(reslen, 0); s = tmpbuf->val + tmpbuf->len - 1; t = res->val + reslen; @@ -1341,7 +1341,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin } res->len = reslen; - STR_RELEASE(tmpbuf); + zend_string_release(tmpbuf); return res; } @@ -1350,20 +1350,20 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin PHP_FUNCTION(number_format) { double num; - php_int_t dec = 0; + zend_long dec = 0; char *thousand_sep = NULL, *dec_point = NULL; char thousand_sep_chr = ',', dec_point_chr = '.'; int thousand_sep_len = 0, dec_point_len = 0; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|is!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_DOUBLE(num) Z_PARAM_OPTIONAL - Z_PARAM_INT(dec) + Z_PARAM_LONG(dec) Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0) Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0) ZEND_PARSE_PARAMETERS_END(); @@ -1422,9 +1422,9 @@ PHP_FUNCTION(fmod) Returns the integer division of the numerator by the divisor */ PHP_FUNCTION(intdiv) { - php_int_t numerator, divisor; + zend_long numerator, divisor; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &numerator, &divisor) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &numerator, &divisor) == FAILURE) { return; } @@ -1434,10 +1434,10 @@ PHP_FUNCTION(intdiv) } else if (divisor == -1 && numerator == PHP_INT_MIN) { /* Prevent overflow error/crash We don't return a float here as that violates function contract */ - RETURN_INT(0); + RETURN_LONG(0); } - RETURN_INT(numerator/divisor); + RETURN_LONG(numerator/divisor); } /* }}} */ diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index 880f6c5103..d2c3ebf9c4 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -25,7 +25,7 @@ #include "php.h" #include "php_metaphone.h" -static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional); +static int metaphone(unsigned char *word, php_size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional); /* {{{ proto string metaphone(string text[, int phones]) Break english phrases down into their phonemes */ @@ -33,9 +33,9 @@ PHP_FUNCTION(metaphone) { zend_string *str; zend_string *result = NULL; - php_int_t phones = 0; + zend_long phones = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &phones) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &phones) == FAILURE) { return; } @@ -43,7 +43,7 @@ PHP_FUNCTION(metaphone) RETVAL_STR(result); } else { if (result) { - STR_FREE(result); + zend_string_free(result); } RETURN_FALSE; } @@ -142,7 +142,7 @@ static char Lookahead(char *word, int how_far) * could be one though; or more too). */ #define Phonize(c) { \ if (p_idx >= max_buffer_len) { \ - *phoned_word = STR_REALLOC(*phoned_word, 2 * sizeof(char) + max_buffer_len, 0); \ + *phoned_word = zend_string_realloc(*phoned_word, 2 * sizeof(char) + max_buffer_len, 0); \ max_buffer_len += 2; \ } \ (*phoned_word)->val[p_idx++] = c; \ @@ -151,7 +151,7 @@ static char Lookahead(char *word, int how_far) /* Slap a null character on the end of the phoned word */ #define End_Phoned_Word { \ if (p_idx == max_buffer_len) { \ - *phoned_word = STR_REALLOC(*phoned_word, 1 * sizeof(char) + max_buffer_len, 0); \ + *phoned_word = zend_string_realloc(*phoned_word, 1 * sizeof(char) + max_buffer_len, 0); \ max_buffer_len += 1; \ } \ (*phoned_word)->val[p_idx] = '\0'; \ @@ -165,7 +165,7 @@ static char Lookahead(char *word, int how_far) /* {{{ metaphone */ -static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional) +static int metaphone(unsigned char *word, php_size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional) { int w_idx = 0; /* point in the phonization we're at. */ int p_idx = 0; /* end of the phoned phrase */ @@ -187,10 +187,10 @@ static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_pho /*-- Allocate memory for our phoned_phrase --*/ if (max_phonemes == 0) { /* Assume largest possible */ max_buffer_len = word_len; - *phoned_word = STR_ALLOC(sizeof(char) * word_len + 1, 0); + *phoned_word = zend_string_alloc(sizeof(char) * word_len + 1, 0); } else { max_buffer_len = max_phonemes; - *phoned_word = STR_ALLOC(sizeof(char) * max_phonemes + 1, 0); + *phoned_word = zend_string_alloc(sizeof(char) * max_phonemes + 1, 0); } diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 58ecbdc881..e20223b011 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -73,11 +73,11 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode) offset = timelib_get_time_zone_info(tp.tv_sec, get_timezone_info(TSRMLS_C)); array_init(return_value); - add_assoc_int(return_value, "sec", tp.tv_sec); - add_assoc_int(return_value, "usec", tp.tv_usec); + add_assoc_long(return_value, "sec", tp.tv_sec); + add_assoc_long(return_value, "usec", tp.tv_usec); - add_assoc_int(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); - add_assoc_int(return_value, "dsttime", offset->is_dst); + add_assoc_long(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); + add_assoc_long(return_value, "dsttime", offset->is_dst); timelib_time_offset_dtor(offset); } else { @@ -111,10 +111,10 @@ PHP_FUNCTION(gettimeofday) PHP_FUNCTION(getrusage) { struct rusage usg; - php_int_t pwho = 0; + zend_long pwho = 0; int who = RUSAGE_SELF; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &pwho) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &pwho) == FAILURE) { return; } @@ -130,7 +130,7 @@ PHP_FUNCTION(getrusage) array_init(return_value); #define PHP_RUSAGE_PARA(a) \ - add_assoc_int(return_value, #a, usg.a) + add_assoc_long(return_value, #a, usg.a) #if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 613a58b5fd..f82e4a394c 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -90,7 +90,7 @@ static void php_pack(zval *val, php_size_t size, int *map, char *output) char *v; convert_to_int_ex(val); - v = (char *) &Z_IVAL_P(val); + v = (char *) &Z_LVAL_P(val); for (i = 0; i < size; i++) { *output++ = v[map[i]]; @@ -126,7 +126,7 @@ PHP_FUNCTION(pack) convert_to_string_ex(&argv[0]); format = Z_STRVAL(argv[0]); - formatlen = Z_STRSIZE(argv[0]); + formatlen = Z_STRLEN(argv[0]); /* We have a maximum of <formatlen> format codes to deal with */ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); @@ -185,7 +185,7 @@ PHP_FUNCTION(pack) SEPARATE_ZVAL(&argv[currentarg]); } convert_to_string_ex(&argv[currentarg]); - arg = Z_STRSIZE(argv[currentarg]); + arg = Z_STRLEN(argv[currentarg]); if (code == 'Z') { /* add one because Z is always NUL-terminated: * pack("Z*", "aa") === "aa\0" @@ -329,7 +329,7 @@ PHP_FUNCTION(pack) (str->len < arg_cp) ? str->len : arg_cp); outputpos += arg; - STR_RELEASE(str); + zend_string_release(str); break; } @@ -372,7 +372,7 @@ PHP_FUNCTION(pack) } outputpos++; - STR_RELEASE(str); + zend_string_release(str); break; } @@ -480,9 +480,9 @@ PHP_FUNCTION(pack) /* {{{ php_unpack */ -static php_int_t php_unpack(char *data, php_size_t size, int issigned, int *map) +static zend_long php_unpack(char *data, php_size_t size, int issigned, int *map) { - php_int_t result; + zend_long result; char *cresult = (char *) &result; int i; @@ -771,8 +771,8 @@ PHP_FUNCTION(unpack) case 'c': case 'C': { int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; - php_int_t v = php_unpack(&input[inputpos], 1, issigned, byte_map); - add_assoc_int(return_value, n, v); + zend_long v = php_unpack(&input[inputpos], 1, issigned, byte_map); + add_assoc_long(return_value, n, v); break; } @@ -780,7 +780,7 @@ PHP_FUNCTION(unpack) case 'S': case 'n': case 'v': { - php_int_t v; + zend_long v; int issigned = 0; int *map = machine_endian_short_map; @@ -793,13 +793,13 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], 2, issigned, map); - add_assoc_int(return_value, n, v); + add_assoc_long(return_value, n, v); break; } case 'i': case 'I': { - php_int_t v; + zend_long v; int issigned = 0; if (type == 'i') { @@ -807,7 +807,7 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map); - add_assoc_int(return_value, n, v); + add_assoc_long(return_value, n, v); break; } @@ -817,7 +817,7 @@ PHP_FUNCTION(unpack) case 'V': { int issigned = 0; int *map = machine_endian_long_map; - php_int_t v = 0; + zend_long v = 0; if (type == 'l' || type == 'L') { issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80; @@ -841,7 +841,7 @@ PHP_FUNCTION(unpack) v = (unsigned int) v; } } - add_assoc_int(return_value, n, v); + add_assoc_long(return_value, n, v); break; } @@ -951,8 +951,8 @@ PHP_MINIT_FUNCTION(pack) } else { zval val; - int size = sizeof(Z_IVAL(val)); - Z_IVAL(val)=0; /*silence a warning*/ + int size = sizeof(Z_LVAL(val)); + Z_LVAL(val)=0; /*silence a warning*/ /* Where to get hi to lo bytes from */ byte_map[0] = size - 1; diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index 7381100fab..d2b3cd1ce4 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -79,14 +79,14 @@ PHPAPI void php_statpage(TSRMLS_D) /* {{{ php_getuid */ -php_int_t php_getuid(TSRMLS_D) +zend_long php_getuid(TSRMLS_D) { php_statpage(TSRMLS_C); return (BG(page_uid)); } /* }}} */ -php_int_t php_getgid(TSRMLS_D) +zend_long php_getgid(TSRMLS_D) { php_statpage(TSRMLS_C); return (BG(page_gid)); @@ -96,7 +96,7 @@ php_int_t php_getgid(TSRMLS_D) Get PHP script owner's UID */ PHP_FUNCTION(getmyuid) { - php_int_t uid; + zend_long uid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -106,7 +106,7 @@ PHP_FUNCTION(getmyuid) if (uid < 0) { RETURN_FALSE; } else { - RETURN_INT(uid); + RETURN_LONG(uid); } } /* }}} */ @@ -115,7 +115,7 @@ PHP_FUNCTION(getmyuid) Get PHP script owner's GID */ PHP_FUNCTION(getmygid) { - php_int_t gid; + zend_long gid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -125,7 +125,7 @@ PHP_FUNCTION(getmygid) if (gid < 0) { RETURN_FALSE; } else { - RETURN_INT(gid); + RETURN_LONG(gid); } } /* }}} */ @@ -134,7 +134,7 @@ PHP_FUNCTION(getmygid) Get current process ID */ PHP_FUNCTION(getmypid) { - php_int_t pid; + zend_long pid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -144,7 +144,7 @@ PHP_FUNCTION(getmypid) if (pid < 0) { RETURN_FALSE; } else { - RETURN_INT(pid); + RETURN_LONG(pid); } } /* }}} */ @@ -161,7 +161,7 @@ PHP_FUNCTION(getmyinode) if (BG(page_inode) < 0) { RETURN_FALSE; } else { - RETURN_INT(BG(page_inode)); + RETURN_LONG(BG(page_inode)); } } /* }}} */ @@ -176,7 +176,7 @@ PHPAPI time_t php_getlastmod(TSRMLS_D) Get time of last page modification */ PHP_FUNCTION(getlastmod) { - php_int_t lm; + zend_long lm; if (zend_parse_parameters_none() == FAILURE) { return; @@ -186,7 +186,7 @@ PHP_FUNCTION(getlastmod) if (lm < 0) { RETURN_FALSE; } else { - RETURN_INT(lm); + RETURN_LONG(lm); } } /* }}} */ diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h index 1dbe6ce1e6..204fb85c19 100644 --- a/ext/standard/pageinfo.h +++ b/ext/standard/pageinfo.h @@ -29,7 +29,7 @@ PHP_FUNCTION(getlastmod); PHPAPI void php_statpage(TSRMLS_D); PHPAPI time_t php_getlastmod(TSRMLS_D); -extern php_int_t php_getuid(TSRMLS_D); -extern php_int_t php_getgid(TSRMLS_D); +extern zend_long php_getuid(TSRMLS_D); +extern zend_long php_getgid(TSRMLS_D); #endif diff --git a/ext/standard/password.c b/ext/standard/password.c index 23e0ae4259..4010f6a04c 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -37,10 +37,10 @@ PHP_MINIT_FUNCTION(password) /* {{{ */ { - REGISTER_INT_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -89,20 +89,20 @@ static int php_password_salt_to64(const char *str, const size_t str_len, const s buffer = php_base64_encode((unsigned char*) str, (int) str_len); if (buffer->len < out_len) { /* Too short of an encoded string generated */ - STR_RELEASE(buffer); + zend_string_release(buffer); return FAILURE; } for (pos = 0; pos < out_len; pos++) { if (buffer->val[pos] == '+') { ret[pos] = '.'; } else if (buffer->val[pos] == '=') { - STR_FREE(buffer); + zend_string_free(buffer); return FAILURE; } else { ret[pos] = buffer->val[pos]; } } - STR_FREE(buffer); + zend_string_free(buffer); return SUCCESS; } /* }}} */ @@ -195,9 +195,9 @@ PHP_FUNCTION(password_get_info) switch (algo) { case PHP_PASSWORD_BCRYPT: { - php_int_t cost = PHP_PASSWORD_BCRYPT_COST; + zend_long cost = PHP_PASSWORD_BCRYPT_COST; sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost); - add_assoc_int(&options, "cost", cost); + add_assoc_long(&options, "cost", cost); } break; case PHP_PASSWORD_UNKNOWN: @@ -207,21 +207,21 @@ PHP_FUNCTION(password_get_info) array_init(return_value); - add_assoc_int(return_value, "algo", algo); + add_assoc_long(return_value, "algo", algo); add_assoc_string(return_value, "algoName", algo_name); add_assoc_zval(return_value, "options", &options); } PHP_FUNCTION(password_needs_rehash) { - php_int_t new_algo = 0; + zend_long new_algo = 0; php_password_algo algo; int hash_len; char *hash; HashTable *options = 0; zval *option_buffer; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &hash, &hash_len, &new_algo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) { return; } @@ -239,17 +239,17 @@ PHP_FUNCTION(password_needs_rehash) switch (algo) { case PHP_PASSWORD_BCRYPT: { - php_int_t new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; + zend_long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_INT) { + if (Z_TYPE_P(option_buffer) != IS_LONG) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); convert_to_int(&cast_option_buffer); - new_cost = Z_IVAL(cast_option_buffer); + new_cost = Z_LVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - new_cost = Z_IVAL_P(option_buffer); + new_cost = Z_LVAL_P(option_buffer); } } @@ -283,7 +283,7 @@ PHP_FUNCTION(password_verify) } if (ret->len != hash_len || hash_len < 13) { - STR_FREE(ret); + zend_string_free(ret); RETURN_FALSE; } @@ -295,7 +295,7 @@ PHP_FUNCTION(password_verify) status |= (ret->val[i] ^ hash[i]); } - STR_FREE(ret); + zend_string_free(ret); RETURN_BOOL(status == 0); @@ -307,31 +307,31 @@ Hash a password */ PHP_FUNCTION(password_hash) { char *hash_format, *hash, *salt, *password; - php_int_t algo = 0; + zend_long algo = 0; int password_len = 0, hash_len; size_t salt_len = 0, required_salt_len = 0, hash_format_len; HashTable *options = 0; zval *option_buffer; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &password, &password_len, &algo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &password, &password_len, &algo, &options) == FAILURE) { return; } switch (algo) { case PHP_PASSWORD_BCRYPT: { - php_int_t cost = PHP_PASSWORD_BCRYPT_COST; + zend_long cost = PHP_PASSWORD_BCRYPT_COST; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_INT) { + if (Z_TYPE_P(option_buffer) != IS_LONG) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); convert_to_int(&cast_option_buffer); - cost = Z_IVAL(cast_option_buffer); + cost = Z_LVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - cost = Z_IVAL_P(option_buffer); + cost = Z_LVAL_P(option_buffer); } } @@ -358,10 +358,10 @@ PHP_FUNCTION(password_hash) size_t buffer_len; switch (Z_TYPE_P(option_buffer)) { case IS_STRING: - buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRSIZE_P(option_buffer)); - buffer_len_int = Z_STRSIZE_P(option_buffer); + buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRLEN_P(option_buffer)); + buffer_len_int = Z_STRLEN_P(option_buffer); break; - case IS_INT: + case IS_LONG: case IS_DOUBLE: case IS_OBJECT: { zval cast_option_buffer; @@ -369,8 +369,8 @@ PHP_FUNCTION(password_hash) ZVAL_DUP(&cast_option_buffer, option_buffer); convert_to_string(&cast_option_buffer); if (Z_TYPE(cast_option_buffer) == IS_STRING) { - buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer)); - buffer_len_int = Z_STRSIZE(cast_option_buffer); + buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer)); + buffer_len_int = Z_STRLEN(cast_option_buffer); zval_dtor(&cast_option_buffer); break; } @@ -443,7 +443,7 @@ PHP_FUNCTION(password_hash) efree(hash); if (result->len < 13) { - STR_FREE(result); + zend_string_free(result); RETURN_FALSE; } diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index 2154e603fa..c001ee5509 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -107,7 +107,7 @@ PHPAPI HashTable* php_splice(HashTable *, int, int, zval *, int, HashTable *); PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC); PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC); PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC); -PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC); +PHPAPI zend_long php_count_recursive(zval *array, zend_long mode TSRMLS_DC); #define PHP_SORT_REGULAR 0 #define PHP_SORT_NUMERIC 1 diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index bf4a62ff2b..5280a4f014 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -178,7 +178,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa int mode_rw = 0; php_stream * stream = NULL; char *p, *token, *pathdup; - php_int_t max_memory; + zend_long max_memory; FILE *file = NULL; if (!strncasecmp(path, "php://", 6)) { @@ -286,7 +286,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa } else if (!strncasecmp(path, "fd/", 3)) { const char *start; char *end; - php_int_t fildes_ori; + zend_long fildes_ori; int dtablesize; if (strcmp(sapi_module.name, "cli")) { diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index 804ca05206..6c64ae71ac 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -32,7 +32,7 @@ Z_OBJCE_P(struc) == BG(incomplete_class)) { \ class_name = php_lookup_class_name(struc); \ if (!class_name) { \ - class_name = STR_INIT(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \ + class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \ } \ incomplete_class = 1; \ } else { \ @@ -40,7 +40,7 @@ } #define PHP_CLEANUP_CLASS_ATTRIBUTES() \ - STR_RELEASE(class_name) + zend_string_release(class_name) #define PHP_CLASS_ATTRIBUTES \ zend_string *class_name; \ diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h index f8be7da42c..afdf54166f 100644 --- a/ext/standard/php_math.h +++ b/ext/standard/php_math.h @@ -25,7 +25,7 @@ PHPAPI zend_string *_php_math_number_format(double, int, char, char); PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t); PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC); -PHPAPI php_int_t _php_math_basetolong(zval *arg, int base); +PHPAPI zend_long _php_math_basetolong(zval *arg, int base); PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret); PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC); diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index dd41c57d88..6ec0f38706 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -42,19 +42,19 @@ #endif #define RAND_RANGE(__n, __min, __max, __tmax) \ - (__n) = (__min) + (php_int_t) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) + (__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) /* MT Rand */ -#define PHP_MT_RAND_MAX ((php_int_t) (0x7FFFFFFF)) /* (1<<31) - 1 */ +#define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */ #ifdef PHP_WIN32 -#define GENERATE_SEED() (((php_int_t) (time(0) * GetCurrentProcessId())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) #else -#define GENERATE_SEED() (((php_int_t) (time(0) * getpid())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#define GENERATE_SEED() (((zend_long) (time(0) * getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) #endif -PHPAPI void php_srand(php_int_t seed TSRMLS_DC); -PHPAPI php_int_t php_rand(TSRMLS_D); +PHPAPI void php_srand(zend_long seed TSRMLS_DC); +PHPAPI zend_long php_rand(TSRMLS_D); PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC); PHPAPI php_uint32 php_mt_rand(TSRMLS_D); diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index f4913f7b99..c153fa884c 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -62,7 +62,7 @@ (d)->a = newlen < SMART_STR_START_SIZE \ ? SMART_STR_START_SIZE \ : newlen + SMART_STR_PREALLOC; \ - (d)->s = STR_ALLOC((d)->a, (what)); \ + (d)->s = zend_string_alloc((d)->a, (what)); \ (d)->s->len = 0; \ } else { \ newlen = (d)->s->len + (n); \ @@ -91,8 +91,8 @@ smart_str_appendl_ex((dest), (src), (len), 0) #define smart_str_append(dest, src) \ smart_str_append_ex((dest), (src), 0) -#define smart_str_append_int(dest, val) \ - smart_str_append_int_ex((dest), (val), 0) +#define smart_str_append_long(dest, val) \ + smart_str_append_long_ex((dest), (val), 0) #define smart_str_append_off_t(dest, val) \ smart_str_append_off_t_ex((dest), (val), 0) #define smart_str_append_unsigned(dest, val) \ @@ -108,7 +108,7 @@ #define smart_str_free_ex(buf, what) do { \ smart_str *__s = (smart_str *) (buf); \ if (__s->s) { \ - STR_RELEASE(__s->s); \ + zend_string_release(__s->s); \ __s->s = NULL; \ } \ __s->a = 0; \ @@ -130,15 +130,15 @@ * #define f(..) ({char *r;..;__r;}) */ -static inline char *smart_str_print_long(char *buf, zend_int_t num) { +static inline char *smart_str_print_long(char *buf, zend_long num) { char *r; - _zend_print_signed_to_buf(buf, num, zend_int_t, r); + _zend_print_signed_to_buf(buf, num, zend_long, r); return r; } -static inline char *smart_str_print_unsigned(char *buf, zend_int_t num) { +static inline char *smart_str_print_unsigned(char *buf, zend_long num) { char *r; - _zend_print_unsigned_to_buf(buf, num, zend_uint_t, r); + _zend_print_unsigned_to_buf(buf, num, zend_ulong, r); return r; } @@ -150,10 +150,10 @@ static inline char *smart_str_print_unsigned(char *buf, zend_int_t num) { } while (0) #define smart_str_append_unsigned_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _unsigned) + smart_str_append_generic_ex((dest), (num), (type), zend_ulong, _unsigned) -#define smart_str_append_int_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _signed) +#define smart_str_append_long_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), zend_ulong, _signed) #define smart_str_append_off_t_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), zend_off_t, _signed) diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h index 83d59054dd..91530d94d3 100644 --- a/ext/standard/php_smart_string.h +++ b/ext/standard/php_smart_string.h @@ -119,13 +119,13 @@ __dest->len = __nl; \ } while (0) -static inline char *smart_string_print_long(char *buf, php_int_t num) { +static inline char *smart_string_print_long(char *buf, zend_long num) { char *r; _zend_print_signed_to_buf(buf, num, unsigned long, r); return r; } -static inline char *smart_string_print_unsigned(char *buf, php_int_t num) { +static inline char *smart_string_print_unsigned(char *buf, zend_long num) { char *r; _zend_print_unsigned_to_buf(buf, num, unsigned long, r); return r; diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 325467d534..f2cb5c1755 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -138,7 +138,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count); PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result); PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); -PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit); +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, zend_long limit); PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 9e960f3d55..fc58b9f7b8 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -110,7 +110,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) { zend_string *str = zval_get_string(element); uint el_len = str->len; - STR_RELEASE(str); + zend_string_release(str); if (el_len == 0) { continue; @@ -162,7 +162,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent p += str->len + 1; } next_element: - STR_RELEASE(str); + zend_string_release(str); } ZEND_HASH_FOREACH_END(); assert((uint)(p - env.envp) <= sizeenv); @@ -260,9 +260,9 @@ PHP_FUNCTION(proc_terminate) { zval *zproc; struct php_process_handle *proc; - php_int_t sig_no = SIGTERM; + zend_long sig_no = SIGTERM; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zproc, &sig_no) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) { RETURN_FALSE; } @@ -300,7 +300,7 @@ PHP_FUNCTION(proc_close) FG(pclose_wait) = 1; zend_list_close(Z_RES_P(zproc)); FG(pclose_wait) = 0; - RETURN_INT(FG(pclose_ret)); + RETURN_LONG(FG(pclose_ret)); } /* }}} */ @@ -328,7 +328,7 @@ PHP_FUNCTION(proc_get_status) array_init(return_value); add_assoc_string(return_value, "command", proc->command); - add_assoc_int(return_value, "pid", (php_int_t) proc->child); + add_assoc_long(return_value, "pid", (zend_long) proc->child); #ifdef PHP_WIN32 @@ -368,9 +368,9 @@ PHP_FUNCTION(proc_get_status) add_assoc_bool(return_value, "running", running); add_assoc_bool(return_value, "signaled", signaled); add_assoc_bool(return_value, "stopped", stopped); - add_assoc_int(return_value, "exitcode", exitcode); - add_assoc_int(return_value, "termsig", termsig); - add_assoc_int(return_value, "stopsig", stopsig); + add_assoc_long(return_value, "exitcode", exitcode); + add_assoc_long(return_value, "termsig", termsig); + add_assoc_long(return_value, "stopsig", stopsig); } /* }}} */ @@ -427,7 +427,7 @@ PHP_FUNCTION(proc_open) int i; zval *descitem = NULL; zend_string *str_index; - php_uint_t nindex; + zend_ulong nindex; struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS]; #ifdef PHP_WIN32 PROCESS_INFORMATION pi; @@ -471,14 +471,14 @@ PHP_FUNCTION(proc_open) if (other_options) { zval *item = zend_hash_str_find(Z_ARRVAL_P(other_options), "suppress_errors", sizeof("suppress_errors") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { suppress_errors = 1; } } item = zend_hash_str_find(Z_ARRVAL_P(other_options), "bypass_shell", sizeof("bypass_shell") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { bypass_shell = 1; } } @@ -584,7 +584,7 @@ PHP_FUNCTION(proc_open) #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRSIZE_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') + if (Z_STRLEN_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') descriptors[ndesc].mode_flags |= O_BINARY; #endif diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 1d13d56678..b2186b5ed1 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -96,7 +96,7 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt i--; } - retval = STR_ALLOC(buf_size, 0); + retval = zend_string_alloc(buf_size, 0); i = length; p1 = str; p2 = (unsigned char*)retval->val; decoded_len = 0; @@ -147,12 +147,12 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t length) /* {{{ */ { - php_uint_t lp = 0; + zend_ulong lp = 0; unsigned char c, *d; char *hex = "0123456789ABCDEF"; zend_string *ret; - ret = STR_SAFE_ALLOC(3, (length + (((3 * length)/(PHP_QPRINT_MAXL-9)) + 1)), 0, 0); + ret = zend_string_safe_alloc(3, (length + (((3 * length)/(PHP_QPRINT_MAXL-9)) + 1)), 0, 0); d = (unsigned char*)ret->val; while (length--) { @@ -187,7 +187,7 @@ PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t lengt } } *d = '\0'; - ret = STR_REALLOC(ret, d - (unsigned char*)ret->val, 0); + ret = zend_string_realloc(ret, d - (unsigned char*)ret->val, 0); return ret; } /* }}} */ @@ -216,7 +216,7 @@ PHP_FUNCTION(quoted_printable_decode) } str_in = arg1->val; - str_out = STR_ALLOC(arg1->len, 0); + str_out = zend_string_alloc(arg1->len, 0); while (str_in[i]) { switch (str_in[i]) { case '=': diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 972f015948..8cff654c3f 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -38,7 +38,7 @@ /* {{{ php_srand */ -PHPAPI void php_srand(php_int_t seed TSRMLS_DC) +PHPAPI void php_srand(zend_long seed TSRMLS_DC) { #ifdef ZTS BG(rand_seed) = (unsigned int) seed; @@ -59,9 +59,9 @@ PHPAPI void php_srand(php_int_t seed TSRMLS_DC) /* {{{ php_rand */ -PHPAPI php_int_t php_rand(TSRMLS_D) +PHPAPI zend_long php_rand(TSRMLS_D) { - php_int_t ret; + zend_long ret; if (!BG(rand_is_seeded)) { php_srand(GENERATE_SEED() TSRMLS_CC); @@ -229,9 +229,9 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D) Seeds random number generator */ PHP_FUNCTION(srand) { - php_int_t seed = 0; + zend_long seed = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) return; if (ZEND_NUM_ARGS() == 0) @@ -245,9 +245,9 @@ PHP_FUNCTION(srand) Seeds Mersenne Twister random number generator */ PHP_FUNCTION(mt_srand) { - php_int_t seed = 0; + zend_long seed = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) return; if (ZEND_NUM_ARGS() == 0) @@ -288,12 +288,12 @@ PHP_FUNCTION(mt_srand) Returns a random number */ PHP_FUNCTION(rand) { - php_int_t min; - php_int_t max; - php_int_t number; + zend_long min; + zend_long max; + zend_long number; int argc = ZEND_NUM_ARGS(); - if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE) + if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) return; number = php_rand(TSRMLS_C); @@ -301,7 +301,7 @@ PHP_FUNCTION(rand) RAND_RANGE(number, min, max, PHP_RAND_MAX); } - RETURN_INT(number); + RETURN_LONG(number); } /* }}} */ @@ -309,13 +309,13 @@ PHP_FUNCTION(rand) Returns a random number from Mersenne Twister */ PHP_FUNCTION(mt_rand) { - php_int_t min; - php_int_t max; - php_int_t number; + zend_long min; + zend_long max; + zend_long number; int argc = ZEND_NUM_ARGS(); if (argc != 0) { - if (zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { return; } else if (max < min) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_INT_FMT ") is smaller than min(" ZEND_INT_FMT ")", max, min); @@ -335,12 +335,12 @@ PHP_FUNCTION(mt_rand) * Update: * I talked with Cokus via email and it won't ruin the algorithm */ - number = (php_int_t) (php_mt_rand(TSRMLS_C) >> 1); + number = (zend_long) (php_mt_rand(TSRMLS_C) >> 1); if (argc == 2) { RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); } - RETURN_INT(number); + RETURN_LONG(number); } /* }}} */ @@ -352,7 +352,7 @@ PHP_FUNCTION(getrandmax) return; } - RETURN_INT(PHP_RAND_MAX); + RETURN_LONG(PHP_RAND_MAX); } /* }}} */ @@ -368,7 +368,7 @@ PHP_FUNCTION(mt_getrandmax) * Melo: it could be 2^^32 but we only use 2^^31 to maintain * compatibility with the previous php_rand */ - RETURN_INT(PHP_MT_RAND_MAX); /* 2^^31 */ + RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */ } /* }}} */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 815d7c7290..935ead4161 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -582,7 +582,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, { int numVars, nconversions, totalVars = -1; int i, result; - php_int_t value; + zend_long value; int objIndex; char *end, *baseString; zval *current; @@ -590,7 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, int base = 0; int underflow = 0; size_t width; - php_int_t (*fn)() = NULL; + zend_long (*fn)() = NULL; char *ch, sch; int flags; char buf[64]; /* Temporary buffer to hold scanned number @@ -744,9 +744,9 @@ literal: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_INT(current, (php_int_t)(string - baseString) ); + ZVAL_LONG(current, (zend_long)(string - baseString) ); } else { - add_index_int(return_value, objIndex++, string - baseString); + add_index_long(return_value, objIndex++, string - baseString); } } nconversions++; @@ -756,29 +756,29 @@ literal: case 'D': op = 'i'; base = 10; - fn = (php_int_t (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOI_PTR; break; case 'i': op = 'i'; base = 0; - fn = (php_int_t (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOI_PTR; break; case 'o': op = 'i'; base = 8; - fn = (php_int_t (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOI_PTR; break; case 'x': case 'X': op = 'i'; base = 16; - fn = (php_int_t (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOI_PTR; break; case 'u': op = 'i'; base = 10; flags |= SCAN_UNSIGNED; - fn = (php_int_t (*)())ZEND_STRTOUI_PTR; + fn = (zend_long (*)())ZEND_STRTOUI_PTR; break; case 'f': @@ -1049,7 +1049,7 @@ addToInt: */ if (!(flags & SCAN_SUPPRESS)) { *end = '\0'; - value = (php_int_t) (*fn)(buf, NULL, base); + value = (zend_long) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { snprintf(buf, sizeof(buf), ZEND_UINT_FMT, value); /* INTL: ISO digit */ if (numVars && objIndex >= argCount) { @@ -1068,9 +1068,9 @@ addToInt: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_INT(current, value); + ZVAL_LONG(current, value); } else { - add_index_int(return_value, objIndex++, value); + add_index_long(return_value, objIndex++, value); } } } @@ -1191,7 +1191,7 @@ done: result = SCAN_ERROR_EOF; } else if (numVars) { convert_to_int(return_value ); - Z_IVAL_P(return_value) = nconversions; + Z_LVAL_P(return_value) = nconversions; } else if (nconversions < totalVars) { /* TODO: not all elements converted. we need to prune the list - cc */ } @@ -1203,7 +1203,7 @@ done: static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ { if (numVars) { - ZVAL_INT(return_value, SCAN_ERROR_EOF); /* EOF marker */ + ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ convert_to_null(return_value); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index b02a1386c4..5585b8e73d 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -51,11 +51,11 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC) Creates a pair of connected, indistinguishable socket streams */ PHP_FUNCTION(stream_socket_pair) { - php_int_t domain, type, protocol; + zend_long domain, type, protocol; php_stream *s1, *s2; php_socket_t pair[2]; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &domain, &type, &protocol)) { RETURN_FALSE; } @@ -96,13 +96,13 @@ PHP_FUNCTION(stream_socket_client) char *hashkey = NULL; php_stream *stream = NULL; int err; - php_int_t flags = PHP_STREAM_CLIENT_CONNECT; + zend_long flags = PHP_STREAM_CLIENT_CONNECT; zend_string *errstr = NULL; php_stream_context *context = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dir", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -123,7 +123,7 @@ PHP_FUNCTION(stream_socket_client) #endif if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, 0); + ZVAL_LONG(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -141,7 +141,7 @@ PHP_FUNCTION(stream_socket_client) zend_string *quoted_host = php_addslashes(host, host_len, 0 TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", quoted_host->val, errstr == NULL ? "Unknown error" : errstr->val); - STR_RELEASE(quoted_host); + zend_string_release(quoted_host); } if (hashkey) { @@ -151,19 +151,19 @@ PHP_FUNCTION(stream_socket_client) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, err); + ZVAL_LONG(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } RETURN_FALSE; } if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } php_stream_to_zval(stream, return_value); @@ -180,13 +180,13 @@ PHP_FUNCTION(stream_socket_server) zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; php_stream *stream = NULL; int err = 0; - php_int_t flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN; + zend_long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN; zend_string *errstr = NULL; php_stream_context *context = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/ir", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/lr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -198,7 +198,7 @@ PHP_FUNCTION(stream_socket_server) if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, 0); + ZVAL_LONG(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -216,19 +216,19 @@ PHP_FUNCTION(stream_socket_server) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_INT(zerrno, err); + ZVAL_LONG(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); ZVAL_STR(zerrstr, errstr); } else if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } RETURN_FALSE; } if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } php_stream_to_zval(stream, return_value); @@ -284,7 +284,7 @@ PHP_FUNCTION(stream_socket_accept) } if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } } /* }}} */ @@ -321,13 +321,13 @@ PHP_FUNCTION(stream_socket_sendto) { php_stream *stream; zval *zstream; - php_int_t flags = 0; + zend_long flags = 0; char *data, *target_addr = NULL; int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|is", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, zstream); @@ -340,7 +340,7 @@ PHP_FUNCTION(stream_socket_sendto) } } - RETURN_INT(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); + RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); } /* }}} */ @@ -351,12 +351,12 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream *stream; zval *zstream, *zremote = NULL; zend_string *remote_addr = NULL; - php_int_t to_read = 0; + zend_long to_read = 0; zend_string *read_buf; - php_int_t flags = 0; + zend_long flags = 0; int recvd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|iz/", &zstream, &to_read, &flags, &zremote) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz/", &zstream, &to_read, &flags, &zremote) == FAILURE) { RETURN_FALSE; } @@ -372,7 +372,7 @@ PHP_FUNCTION(stream_socket_recvfrom) RETURN_FALSE; } - read_buf = STR_ALLOC(to_read, 0); + read_buf = zend_string_alloc(to_read, 0); recvd = php_stream_xport_recvfrom(stream, read_buf->val, to_read, flags, NULL, NULL, zremote ? &remote_addr : NULL @@ -387,7 +387,7 @@ PHP_FUNCTION(stream_socket_recvfrom) RETURN_NEW_STR(read_buf); } - STR_FREE(read_buf); + zend_string_free(read_buf); RETURN_FALSE; } /* }}} */ @@ -398,11 +398,11 @@ PHP_FUNCTION(stream_get_contents) { php_stream *stream; zval *zsrc; - php_int_t maxlen = PHP_STREAM_COPY_ALL, + zend_long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; zend_string *contents; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ii", &zsrc, &maxlen, &desiredpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { RETURN_FALSE; } @@ -446,11 +446,11 @@ PHP_FUNCTION(stream_copy_to_stream) { php_stream *src, *dest; zval *zsrc, *zdest; - php_int_t maxlen = PHP_STREAM_COPY_ALL, pos = 0; + zend_long maxlen = PHP_STREAM_COPY_ALL, pos = 0; size_t len; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ii", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { RETURN_FALSE; } @@ -467,7 +467,7 @@ PHP_FUNCTION(stream_copy_to_stream) if (ret != SUCCESS) { RETURN_FALSE; } - RETURN_INT(len); + RETURN_LONG(len); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(stream_get_meta_data) } #endif - add_assoc_int(return_value, "unread_bytes", stream->writepos - stream->readpos); + add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); if (stream->orig_path) { @@ -541,7 +541,7 @@ PHP_FUNCTION(stream_get_transports) if ((stream_xport_hash = php_stream_xport_get_hash())) { array_init(return_value); ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) { - add_next_index_str(return_value, STR_COPY(stream_xport)); + add_next_index_str(return_value, zend_string_copy(stream_xport)); } ZEND_HASH_FOREACH_END(); } else { RETURN_FALSE; @@ -564,7 +564,7 @@ PHP_FUNCTION(stream_get_wrappers) array_init(return_value); ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) { if (stream_protocol) { - add_next_index_str(return_value, STR_COPY(stream_protocol)); + add_next_index_str(return_value, zend_string_copy(stream_protocol)); } } ZEND_HASH_FOREACH_END(); } else { @@ -619,7 +619,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) php_stream *stream; int ret = 0; zend_string *key; - php_uint_t num_ind; + zend_ulong num_ind; if (Z_TYPE_P(stream_array) != IS_ARRAY) { return 0; @@ -723,10 +723,10 @@ PHP_FUNCTION(stream_select) fd_set rfds, wfds, efds; php_socket_t max_fd = 0; int retval, sets = 0; - php_int_t usec = 0; + zend_long usec = 0; int set_count, max_set_count = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) return; FD_ZERO(&rfds); @@ -765,7 +765,7 @@ PHP_FUNCTION(stream_select) if (sec != NULL) { convert_to_int_ex(sec); - if (Z_IVAL_P(sec) < 0) { + if (Z_LVAL_P(sec) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0"); RETURN_FALSE; } else if (usec < 0) { @@ -775,10 +775,10 @@ PHP_FUNCTION(stream_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_IVAL_P(sec); + tv.tv_sec = Z_LVAL_P(sec); tv.tv_usec = usec; } @@ -798,7 +798,7 @@ PHP_FUNCTION(stream_select) if (e_array != NULL) { zend_hash_clean(Z_ARRVAL_P(e_array)); } - RETURN_INT(retval); + RETURN_LONG(retval); } } @@ -814,7 +814,7 @@ PHP_FUNCTION(stream_select) if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_INT(retval); + RETURN_LONG(retval); } /* }}} */ @@ -827,16 +827,16 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco zval zvs[6]; int i; - ZVAL_INT(&zvs[0], notifycode); - ZVAL_INT(&zvs[1], severity); + ZVAL_LONG(&zvs[0], notifycode); + ZVAL_LONG(&zvs[1], severity); if (xmsg) { ZVAL_STRING(&zvs[2], xmsg); } else { ZVAL_NULL(&zvs[2]); } - ZVAL_INT(&zvs[3], xcode); - ZVAL_INT(&zvs[4], bytes_sofar); - ZVAL_INT(&zvs[5], bytes_max); + ZVAL_LONG(&zvs[3], xcode); + ZVAL_LONG(&zvs[4], bytes_sofar); + ZVAL_LONG(&zvs[5], bytes_max); if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, zvs, 0, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier"); @@ -1118,12 +1118,12 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) php_stream *stream; char *filtername; int filternamelen; - php_int_t read_write = 0; + zend_long read_write = 0; zval *filterparams = NULL; php_stream_filter *filter = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|iz", &zstream, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { RETURN_FALSE; } @@ -1242,12 +1242,12 @@ PHP_FUNCTION(stream_get_line) { char *str = NULL; int str_len = 0; - php_int_t max_length; + zend_long max_length; zval *zstream; zend_string *buf; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|s", &zstream, &max_length, &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1276,10 +1276,10 @@ PHP_FUNCTION(stream_set_blocking) { zval *arg1; int block; - php_int_t arg2; + zend_long arg2; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { return; } @@ -1302,12 +1302,12 @@ PHP_FUNCTION(stream_set_blocking) PHP_FUNCTION(stream_set_timeout) { zval *socket; - php_int_t seconds, microseconds = 0; + zend_long seconds, microseconds = 0; struct timeval t; php_stream *stream; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &socket, &seconds, µseconds) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &socket, &seconds, µseconds) == FAILURE) { return; } @@ -1337,11 +1337,11 @@ PHP_FUNCTION(stream_set_write_buffer) { zval *arg1; int ret; - php_int_t arg2; + zend_long arg2; size_t buff; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } @@ -1356,7 +1356,7 @@ PHP_FUNCTION(stream_set_write_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_INT(ret == 0 ? 0 : EOF); + RETURN_LONG(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1365,11 +1365,11 @@ PHP_FUNCTION(stream_set_write_buffer) PHP_FUNCTION(stream_set_chunk_size) { int ret; - php_int_t csize; + zend_long csize; zval *zstream; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &csize) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &csize) == FAILURE) { RETURN_FALSE; } @@ -1390,7 +1390,7 @@ PHP_FUNCTION(stream_set_chunk_size) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL); - RETURN_INT(ret > 0 ? (php_int_t)ret : (php_int_t)EOF); + RETURN_LONG(ret > 0 ? (zend_long)ret : (zend_long)EOF); } /* }}} */ @@ -1400,11 +1400,11 @@ PHP_FUNCTION(stream_set_read_buffer) { zval *arg1; int ret; - php_int_t arg2; + zend_long arg2; size_t buff; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } @@ -1419,7 +1419,7 @@ PHP_FUNCTION(stream_set_read_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_INT(ret == 0 ? 0 : EOF); + RETURN_LONG(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1427,13 +1427,13 @@ PHP_FUNCTION(stream_set_read_buffer) Enable or disable a specific kind of crypto on the stream */ PHP_FUNCTION(stream_socket_enable_crypto) { - php_int_t cryptokind = 0; + zend_long cryptokind = 0; zval *zstream, *zsessstream = NULL; php_stream *stream, *sessstream = NULL; zend_bool enable, cryptokindnull; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|i!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|l!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) { RETURN_FALSE; } @@ -1448,7 +1448,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; } - cryptokind = Z_IVAL_P(val); + cryptokind = Z_LVAL_P(val); } if (zsessstream) { @@ -1466,7 +1466,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; case 0: - RETURN_INT(0); + RETURN_LONG(0); default: RETURN_TRUE; @@ -1558,11 +1558,11 @@ PHP_FUNCTION(stream_supports_lock) disallowed. */ PHP_FUNCTION(stream_socket_shutdown) { - php_int_t how; + zend_long how; zval *zstream; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &how) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/string.c b/ext/standard/string.c index 4ead166495..7e6543555b 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -81,13 +81,13 @@ */ void register_string_constants(INIT_FUNC_ARGS) { - REGISTER_INT_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_LOCALECONV /* If last members of struct lconv equal CHAR_MAX, no grouping is done */ @@ -97,18 +97,18 @@ void register_string_constants(INIT_FUNC_ARGS) # define CHAR_MAX 127 # endif - REGISTER_INT_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_LOCALE_H - REGISTER_INT_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); # ifdef LC_MESSAGES - REGISTER_INT_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); # endif #endif @@ -132,7 +132,7 @@ static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen) zend_string *result; size_t i, j; - result = STR_SAFE_ALLOC(oldlen, 2 * sizeof(char), 0, 0); + result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0); for (i = j = 0; i < oldlen; i++) { result->val[j++] = hexconvtab[old[i] >> 4]; @@ -149,7 +149,7 @@ static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen) static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) { size_t target_length = oldlen >> 1; - zend_string *str = STR_ALLOC(target_length, 0); + zend_string *str = zend_string_alloc(target_length, 0); unsigned char *ret = (unsigned char *)str->val; size_t i, j; @@ -164,7 +164,7 @@ static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) } else if (c >= 'A' && c <= 'F') { d = (c - 'A' + 10) << 4; } else { - STR_FREE(str); + zend_string_free(str); return NULL; } c = old[j++]; @@ -175,7 +175,7 @@ static zend_string *php_hex2bin(const unsigned char *old, const size_t oldlen) } else if (c >= 'A' && c <= 'F') { d |= c - 'A' + 10; } else { - STR_FREE(str); + zend_string_free(str); return NULL; } ret[i] = d; @@ -282,9 +282,9 @@ PHP_FUNCTION(hex2bin) static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ { zend_string *s11, *s22; - php_int_t start = 0, len = 0; + zend_long start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", &s11, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", &s11, &s22, &start, &len) == FAILURE) { return; } @@ -296,7 +296,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / /* look at substr() function for more information */ if (start < 0) { - start += (php_int_t)s11->len; + start += (zend_long)s11->len; if (start < 0) { start = 0; } @@ -311,21 +311,21 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / } } - if (len > (php_int_t)s11->len - start) { + if (len > (zend_long)s11->len - start) { len = s11->len - start; } if(len == 0) { - RETURN_INT(0); + RETURN_LONG(0); } if (behavior == STR_STRSPN) { - RETURN_INT(php_strspn(s11->val + start /*str1_start*/, + RETURN_LONG(php_strspn(s11->val + start /*str1_start*/, s22->val /*str2_start*/, s11->val + start + len /*str1_end*/, s22->val + s22->len /*str2_end*/)); } else if (behavior == STR_STRCSPN) { - RETURN_INT(php_strcspn(s11->val + start /*str1_start*/, + RETURN_LONG(php_strcspn(s11->val + start /*str1_start*/, s22->val /*str2_start*/, s11->val + start + len /*str1_end*/, s22->val + s22->len /*str2_end*/)); @@ -354,7 +354,7 @@ PHP_FUNCTION(strcspn) #if HAVE_NL_LANGINFO PHP_MINIT_FUNCTION(nl_langinfo) { -#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) #ifdef ABDAY_1 REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); @@ -524,10 +524,10 @@ PHP_MINIT_FUNCTION(nl_langinfo) Query language and locale information */ PHP_FUNCTION(nl_langinfo) { - php_int_t item; + zend_long item; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &item) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) { return; } @@ -718,7 +718,7 @@ PHP_FUNCTION(strcoll) return; } - RETURN_INT(strcoll((const char *) s1->val, + RETURN_LONG(strcoll((const char *) s1->val, (const char *) s2->val)); } /* }}} */ @@ -780,7 +780,7 @@ static inline int php_charmask(unsigned char *input, php_size_t len, char *mask */ PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC) { - register php_int_t i; + register zend_long i; int trimmed = 0; char mask[256]; @@ -875,23 +875,23 @@ PHP_FUNCTION(wordwrap) zend_string *text, *breakchar = NULL, *breakchar_save = NULL; php_size_t newtextlen, chk; size_t alloced; - php_int_t current = 0, laststart = 0, lastspace = 0; - php_int_t linelength = 75; + zend_long current = 0, laststart = 0, lastspace = 0; + zend_long linelength = 75; zend_bool docut = 0; zend_string *newtext; - breakchar = breakchar_save = STR_INIT("\n", 1, 1); + breakchar = breakchar_save = zend_string_init("\n", 1, 1); if (!breakchar) { return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iSb", &text, &linelength, &breakchar, &docut) == FAILURE) { - STR_FREE(breakchar); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lSb", &text, &linelength, &breakchar, &docut) == FAILURE) { + zend_string_free(breakchar); return; } if (breakchar != breakchar_save) { - STR_FREE(breakchar_save); + zend_string_free(breakchar_save); } if (text->len == 0) { @@ -911,7 +911,7 @@ PHP_FUNCTION(wordwrap) /* Special case for a single-character break as it needs no additional storage space */ if (breakchar->len == 1 && !docut) { - newtext = STR_INIT(text->val, text->len, 0); + newtext = zend_string_init(text->val, text->len, 0); laststart = lastspace = 0; for (current = 0; current < text->len; current++) { @@ -934,12 +934,12 @@ PHP_FUNCTION(wordwrap) /* Multiple character line break or forced cut */ if (linelength > 0) { chk = (php_size_t)(text->len/linelength + 1); - newtext = STR_ALLOC(chk * breakchar->len + text->len, 0); + newtext = zend_string_alloc(chk * breakchar->len + text->len, 0); alloced = text->len + chk * breakchar->len + 1; } else { chk = text->len; alloced = text->len * (breakchar->len + 1) + 1; - newtext = STR_ALLOC(text->len * (breakchar->len + 1), 0); + newtext = zend_string_alloc(text->len * (breakchar->len + 1), 0); } /* now keep track of the actual new text length */ @@ -949,7 +949,7 @@ PHP_FUNCTION(wordwrap) for (current = 0; current < text->len; current++) { if (chk <= 0) { alloced += (php_size_t) (((text->len - current + 1)/linelength + 1) * breakchar->len) + 1; - newtext = STR_REALLOC(newtext, alloced, 0); + newtext = zend_string_realloc(newtext, alloced, 0); chk = (php_size_t) ((text->len - current)/linelength) + 1; } /* when we hit an existing break, copy to new buffer, and @@ -1010,7 +1010,7 @@ PHP_FUNCTION(wordwrap) newtext->val[newtextlen] = '\0'; /* free unused memory */ - newtext = STR_REALLOC(newtext, newtextlen, 0); + newtext = zend_string_realloc(newtext, newtextlen, 0); RETURN_NEW_STR(newtext); } @@ -1019,22 +1019,22 @@ PHP_FUNCTION(wordwrap) /* {{{ php_explode */ -PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit) +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, zend_long limit) { char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str)); + add_next_index_stringl(return_value, p1, Z_STRLEN_P(str)); } else { do { add_next_index_stringl(return_value, p1, p2 - p1); - p1 = p2 + Z_STRSIZE_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL && + p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) @@ -1045,15 +1045,15 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t li /* {{{ php_explode_negative_limit */ -PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, php_int_t limit) +PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, zend_long limit) { #define EXPLODE_ALLOC_STEP 64 char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); if (p2 == NULL) { /* @@ -1062,7 +1062,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu */ } else { php_size_t allocated = EXPLODE_ALLOC_STEP, found = 0; - php_int_t i, to_return; + zend_long i, to_return; char **positions = emalloc(allocated * sizeof(char *)); positions[found++] = p1; @@ -1071,14 +1071,14 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ positions = erealloc(positions, allocated*sizeof(char *)); } - positions[found++] = p1 = p2 + Z_STRSIZE_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL); + positions[found++] = p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); to_return = limit + found; /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i]); + (positions[i+1] - Z_STRLEN_P(delim)) - positions[i]); } efree(positions); } @@ -1091,11 +1091,11 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu PHP_FUNCTION(explode) { zend_string *str, *delim; - php_int_t limit = PHP_INT_MAX; /* No limit */ + zend_long limit = PHP_INT_MAX; /* No limit */ zval zdelim, zstr; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|i", &delim, &str, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &str, &limit) == FAILURE) { return; } #else @@ -1103,7 +1103,7 @@ PHP_FUNCTION(explode) Z_PARAM_STR(delim) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_INT(limit) + Z_PARAM_LONG(limit) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1156,11 +1156,11 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) again: switch (Z_TYPE_P(tmp)) { case IS_STRING: - smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); break; - case IS_INT: - smart_str_append_int(&implstr, Z_IVAL_P(tmp)); + case IS_LONG: + smart_str_append_long(&implstr, Z_LVAL_P(tmp)); break; case IS_TRUE: @@ -1186,13 +1186,13 @@ again: default: str = zval_get_string(tmp); smart_str_appendl(&implstr, str->val, str->len); - STR_RELEASE(str); + zend_string_release(str); break; } if (++i != numelems) { - smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim)); + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); } } ZEND_HASH_FOREACH_END(); @@ -1360,7 +1360,7 @@ PHP_FUNCTION(strtoupper) return; } - result = STR_INIT(arg->val, arg->len, 0); + result = zend_string_init(arg->val, arg->len, 0); php_strtoupper(result->val, result->len); RETURN_NEW_STR(result); } @@ -1400,7 +1400,7 @@ PHP_FUNCTION(strtolower) ZEND_PARSE_PARAMETERS_END(); #endif - result = STR_INIT(str->val, str->len, 0); + result = zend_string_init(str->val, str->len, 0); php_strtolower(result->val, result->len); RETURN_NEW_STR(result); } @@ -1481,7 +1481,7 @@ quit_loop: len = cend - comp; - ret = STR_INIT(comp, len, 0); + ret = zend_string_init(comp, len, 0); return ret; } /* }}} */ @@ -1521,7 +1521,7 @@ PHP_FUNCTION(dirname) return; } - ret = STR_INIT(str, str_len, 0); + ret = zend_string_init(str, str_len, 0); ret->len = zend_dirname(ret->val, str_len); RETURN_NEW_STR(ret); @@ -1535,10 +1535,10 @@ PHP_FUNCTION(pathinfo) zval tmp; char *path, *dirname; int path_len, have_basename; - php_int_t opt = PHP_PATHINFO_ALL; + zend_long opt = PHP_PATHINFO_ALL; zend_string *ret = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &path_len, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) { return; } @@ -1557,7 +1557,7 @@ PHP_FUNCTION(pathinfo) if (have_basename) { ret = php_basename(path, path_len, NULL, 0 TSRMLS_CC); - add_assoc_str(&tmp, "basename", STR_COPY(ret)); + add_assoc_str(&tmp, "basename", zend_string_copy(ret)); } if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) { @@ -1592,7 +1592,7 @@ PHP_FUNCTION(pathinfo) } if (ret) { - STR_RELEASE(ret); + zend_string_release(ret); } if (opt == PHP_PATHINFO_ALL) { @@ -1663,8 +1663,8 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) static int php_needle_char(zval *needle, char *target TSRMLS_DC) { switch (Z_TYPE_P(needle)) { - case IS_INT: - *target = (char)Z_IVAL_P(needle); + case IS_LONG: + *target = (char)Z_LVAL_P(needle); return SUCCESS; case IS_NULL: case IS_FALSE: @@ -1681,10 +1681,10 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC) zval holder = *needle; zval_copy_ctor(&(holder)); convert_to_int(&(holder)); - if(Z_TYPE(holder) != IS_INT) { + if(Z_TYPE(holder) != IS_LONG) { return FAILURE; } - *target = (char)Z_IVAL(holder); + *target = (char)Z_LVAL(holder); return SUCCESS; } default: { @@ -1715,13 +1715,13 @@ PHP_FUNCTION(stristr) if (Z_TYPE_P(needle) == IS_STRING) { char *orig_needle; - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); efree(haystack_dup); RETURN_FALSE; } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); - found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRSIZE_P(needle)); + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRLEN_P(needle)); efree(orig_needle); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1756,7 +1756,7 @@ PHP_FUNCTION(strstr) zend_string *haystack; char *found = NULL; char needle_char[2]; - php_int_t found_offset; + zend_long found_offset; zend_bool part = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &needle, &part) == FAILURE) { @@ -1764,12 +1764,12 @@ PHP_FUNCTION(strstr) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack->val + haystack->len); + found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack->val + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1803,10 +1803,10 @@ PHP_FUNCTION(strpos) zend_string *haystack; char *found = NULL; char needle_char[2]; - php_int_t offset = 0; + zend_long offset = 0; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &needle, &offset) == FAILURE) { return; } #else @@ -1814,7 +1814,7 @@ PHP_FUNCTION(strpos) Z_PARAM_STR(haystack) Z_PARAM_ZVAL(needle) Z_PARAM_OPTIONAL - Z_PARAM_INT(offset) + Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1824,14 +1824,14 @@ PHP_FUNCTION(strpos) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } found = (char*)php_memnstr(haystack->val + offset, Z_STRVAL_P(needle), - Z_STRSIZE_P(needle), + Z_STRLEN_P(needle), haystack->val + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1846,7 +1846,7 @@ PHP_FUNCTION(strpos) } if (found) { - RETURN_INT(found - haystack->val); + RETURN_LONG(found - haystack->val); } else { RETURN_FALSE; } @@ -1859,12 +1859,12 @@ PHP_FUNCTION(stripos) { char *found = NULL; zend_string *haystack; - php_int_t offset = 0; + zend_long offset = 0; char *needle_dup = NULL, *haystack_dup; char needle_char[2]; zval *needle; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &needle, &offset) == FAILURE) { return; } @@ -1881,14 +1881,14 @@ PHP_FUNCTION(stripos) php_strtolower(haystack_dup, haystack->len); if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack->len) { + if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack->len) { efree(haystack_dup); RETURN_FALSE; } - needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); - php_strtolower(needle_dup, Z_STRSIZE_P(needle)); - found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack->len); + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + php_strtolower(needle_dup, Z_STRLEN_P(needle)); + found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { efree(haystack_dup); @@ -1908,7 +1908,7 @@ PHP_FUNCTION(stripos) } if (found) { - RETURN_INT(found - haystack_dup); + RETURN_LONG(found - haystack_dup); } else { RETURN_FALSE; } @@ -1923,11 +1923,11 @@ PHP_FUNCTION(strrpos) char *needle; zend_string *haystack; php_size_t needle_len; - php_int_t offset = 0; + zend_long offset = 0; char *p, *e, ord_needle[2]; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } #else @@ -1935,13 +1935,13 @@ PHP_FUNCTION(strrpos) Z_PARAM_STR(haystack) Z_PARAM_ZVAL(zneedle) Z_PARAM_OPTIONAL - Z_PARAM_INT(offset) + Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRSIZE_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1980,7 +1980,7 @@ PHP_FUNCTION(strrpos) /* Single character search can shortcut memcmps */ while (e >= p) { if (*e == *needle) { - RETURN_INT(e - p + (offset > 0 ? offset : 0)); + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -1989,7 +1989,7 @@ PHP_FUNCTION(strrpos) while (e >= p) { if (memcmp(e, needle, needle_len) == 0) { - RETURN_INT(e - p + (offset > 0 ? offset : 0)); + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2006,17 +2006,17 @@ PHP_FUNCTION(strripos) char *needle; zend_string *haystack; php_size_t needle_len; - php_int_t offset = 0; + zend_long offset = 0; char *p, *e, ord_needle[2]; char *needle_dup, *haystack_dup; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRSIZE_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -2052,7 +2052,7 @@ PHP_FUNCTION(strripos) *ord_needle = tolower(*needle); while (e >= p) { if (tolower(*e) == *ord_needle) { - RETURN_INT(e - p + (offset > 0 ? offset : 0)); + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2092,7 +2092,7 @@ PHP_FUNCTION(strripos) if (memcmp(e, needle_dup, needle_len) == 0) { efree(haystack_dup); efree(needle_dup); - RETURN_INT(e - p + (offset > 0 ? offset : 0)); + RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2110,7 +2110,7 @@ PHP_FUNCTION(strrchr) zval *needle; zend_string *haystack; const char *found = NULL; - php_int_t found_offset; + zend_long found_offset; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &haystack, &needle) == FAILURE) { return; @@ -2162,7 +2162,7 @@ static zend_string *php_chunk_split(char *src, php_size_t srclen, char *end, php } out_len += srclen + 1; - dest = STR_ALLOC(out_len * sizeof(char), 0); + dest = zend_string_alloc(out_len * sizeof(char), 0); for (p = src, q = dest->val; p < (src + srclen - chunklen + 1); ) { memcpy(q, p, chunklen); @@ -2193,10 +2193,10 @@ PHP_FUNCTION(chunk_split) zend_string *str; char *end = "\r\n"; int endlen = 2; - php_int_t chunklen = 76; + zend_long chunklen = 76; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &chunklen, &end, &endlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &str, &chunklen, &end, &endlen) == FAILURE) { return; } @@ -2207,7 +2207,7 @@ PHP_FUNCTION(chunk_split) if (chunklen > str->len) { /* to maintain BC, we must return original string + ending */ - result = STR_ALLOC(endlen + str->len, 0); + result = zend_string_alloc(endlen + str->len, 0); memcpy(result->val, str->val, str->len); memcpy(result->val + str->len, end, endlen); result->val[result->len] = '\0'; @@ -2233,39 +2233,39 @@ PHP_FUNCTION(chunk_split) PHP_FUNCTION(substr) { zend_string *str; - php_int_t l = 0, f; + zend_long l = 0, f; int argc = ZEND_NUM_ARGS(); #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &str, &f, &l) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &str, &f, &l) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(str) - Z_PARAM_INT(f) + Z_PARAM_LONG(f) Z_PARAM_OPTIONAL - Z_PARAM_INT(l) + Z_PARAM_LONG(l) ZEND_PARSE_PARAMETERS_END(); #endif if (argc > 2) { if ((l < 0 && -l > str->len)) { RETURN_FALSE; - } else if (l > (php_int_t)str->len) { + } else if (l > (zend_long)str->len) { l = str->len; } } else { l = str->len; } - if (f > (php_int_t)str->len) { + if (f > (zend_long)str->len) { RETURN_FALSE; } else if (f < 0 && -f > str->len) { f = 0; } - if (l < 0 && (l + (php_int_t)str->len - f) < 0) { + if (l < 0 && (l + (zend_long)str->len - f) < 0) { RETURN_FALSE; } @@ -2273,7 +2273,7 @@ PHP_FUNCTION(substr) * of the string */ if (f < 0) { - f = (php_int_t)str->len + f; + f = (zend_long)str->len + f; if (f < 0) { f = 0; } @@ -2283,17 +2283,17 @@ PHP_FUNCTION(substr) * needed to stop that many chars from the end of the string */ if (l < 0) { - l = ((php_int_t)str->len - f) + l; + l = ((zend_long)str->len - f) + l; if (l < 0) { l = 0; } } - if (f >= (php_int_t)str->len) { + if (f >= (zend_long)str->len) { RETURN_FALSE; } - if ((f + l) > (php_int_t)str->len) { + if ((f + l) > (zend_long)str->len) { l = str->len - f; } @@ -2309,8 +2309,8 @@ PHP_FUNCTION(substr_replace) zval *from; zval *len = NULL; zval *repl; - php_int_t l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/ - php_int_t f; + zend_long l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/ + zend_long f; int argc = ZEND_NUM_ARGS(); zend_string *result; @@ -2333,11 +2333,11 @@ PHP_FUNCTION(substr_replace) if (argc > 3) { if (Z_TYPE_P(len) != IS_ARRAY) { - l = zval_get_int(len); + l = zval_get_long(len); } } else { if (Z_TYPE_P(str) != IS_ARRAY) { - l = Z_STRSIZE_P(str); + l = Z_STRLEN_P(str); } } @@ -2347,12 +2347,12 @@ PHP_FUNCTION(substr_replace) (argc == 4 && Z_TYPE_P(from) != Z_TYPE_P(len)) ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array "); - RETURN_STR(STR_COPY(Z_STR_P(str))); + RETURN_STR(zend_string_copy(Z_STR_P(str))); } if (argc == 4 && Z_TYPE_P(from) == IS_ARRAY) { if (zend_hash_num_elements(Z_ARRVAL_P(from)) != zend_hash_num_elements(Z_ARRVAL_P(len))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements"); - RETURN_STR(STR_COPY(Z_STR_P(str))); + RETURN_STR(zend_string_copy(Z_STR_P(str))); } } } @@ -2361,65 +2361,65 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(from) != IS_ARRAY) { php_size_t repl_len = 0; - f = Z_IVAL_P(from); + f = Z_LVAL_P(from); /* if "from" position is negative, count start position from the end * of the string */ if (f < 0) { - f = Z_STRSIZE_P(str) + f; + f = Z_STRLEN_P(str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_P(str)) { - f = Z_STRSIZE_P(str); + } else if (f > Z_STRLEN_P(str)) { + f = Z_STRLEN_P(str); } /* if "length" position is negative, set it to the length * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (Z_STRSIZE_P(str) - f) + l; + l = (Z_STRLEN_P(str) - f) + l; if (l < 0) { l = 0; } } - if (f > Z_STRSIZE_P(str) || (f < 0 && -f > Z_STRSIZE_P(str))) { + if (f > Z_STRLEN_P(str) || (f < 0 && -f > Z_STRLEN_P(str))) { RETURN_FALSE; - } else if (l > Z_STRSIZE_P(str) || (l < 0 && -l > Z_STRSIZE_P(str))) { - l = Z_STRSIZE_P(str); + } else if (l > Z_STRLEN_P(str) || (l < 0 && -l > Z_STRLEN_P(str))) { + l = Z_STRLEN_P(str); } - if ((f + l) > Z_STRSIZE_P(str)) { - l = Z_STRSIZE_P(str) - f; + if ((f + l) > Z_STRLEN_P(str)) { + l = Z_STRLEN_P(str) - f; } if (Z_TYPE_P(repl) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(repl), &pos_repl); if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { convert_to_string_ex(tmp_repl); - repl_len = Z_STRSIZE_P(tmp_repl); + repl_len = Z_STRLEN_P(tmp_repl); } } else { - repl_len = Z_STRSIZE_P(repl); + repl_len = Z_STRLEN_P(repl); } - result = STR_ALLOC(Z_STRSIZE_P(str) - l + repl_len, 0); + result = zend_string_alloc(Z_STRLEN_P(str) - l + repl_len, 0); memcpy(result->val, Z_STRVAL_P(str), f); if (repl_len) { memcpy((result->val + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len); } - memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRSIZE_P(str) - f - l); + memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l); result->val[result->len] = '\0'; RETURN_NEW_STR(result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented"); - RETURN_STR(STR_COPY(Z_STR_P(str))); + RETURN_STR(zend_string_copy(Z_STR_P(str))); } } else { /* str is array of strings */ zend_string *str_index = NULL; php_size_t result_len; - php_uint_t num_index; + zend_ulong num_index; array_init(return_value); @@ -2458,57 +2458,57 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(from) == IS_ARRAY) { if (NULL != (tmp_from = zend_hash_get_current_data_ex(Z_ARRVAL_P(from), &pos_from))) { - f = zval_get_int(tmp_from); + f = zval_get_long(tmp_from); if (f < 0) { - f = Z_STRSIZE_P(orig_str) + f; + f = Z_STRLEN_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_P(orig_str)) { - f = Z_STRSIZE_P(orig_str); + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); } zend_hash_move_forward_ex(Z_ARRVAL_P(from), &pos_from); } else { f = 0; } } else { - f = Z_IVAL_P(from); + f = Z_LVAL_P(from); if (f < 0) { - f = Z_STRSIZE_P(orig_str) + f; + f = Z_STRLEN_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_P(orig_str)) { - f = Z_STRSIZE_P(orig_str); + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); } } if (argc > 3 && Z_TYPE_P(len) == IS_ARRAY) { if (NULL != (tmp_len = zend_hash_get_current_data_ex(Z_ARRVAL_P(len), &pos_len))) { - l = zval_get_int(tmp_len); + l = zval_get_long(tmp_len); zend_hash_move_forward_ex(Z_ARRVAL_P(len), &pos_len); } else { - l = Z_STRSIZE_P(orig_str); + l = Z_STRLEN_P(orig_str); } } else if (argc > 3) { - l = Z_IVAL_P(len); + l = Z_LVAL_P(len); } else { - l = Z_STRSIZE_P(orig_str); + l = Z_STRLEN_P(orig_str); } if (l < 0) { - l = (Z_STRSIZE_P(orig_str) - f) + l; + l = (Z_STRLEN_P(orig_str) - f) + l; if (l < 0) { l = 0; } } - if ((f + l) > Z_STRSIZE_P(orig_str)) { - l = Z_STRSIZE_P(orig_str) - f; + if ((f + l) > Z_STRLEN_P(orig_str)) { + l = Z_STRLEN_P(orig_str) - f; } - result_len = Z_STRSIZE_P(orig_str) - l; + result_len = Z_STRLEN_P(orig_str) - l; if (Z_TYPE_P(repl) == IS_ARRAY) { if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { @@ -2533,30 +2533,30 @@ PHP_FUNCTION(substr_replace) } */ - result_len += Z_STRSIZE_P(repl_str); + result_len += Z_STRLEN_P(repl_str); zend_hash_move_forward_ex(Z_ARRVAL_P(repl), &pos_repl); - result = STR_ALLOC(result_len, 0); + result = zend_string_alloc(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str)); - memcpy((result->val + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); + memcpy((result->val + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); if(Z_TYPE_P(tmp_repl) != IS_STRING) { zval_dtor(repl_str); } } else { - result = STR_ALLOC(result_len, 0); + result = zend_string_alloc(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); } } else { - result_len += Z_STRSIZE_P(repl); + result_len += Z_STRLEN_P(repl); - result = STR_ALLOC(result_len, 0); + result = zend_string_alloc(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRSIZE_P(repl)); - memcpy((result->val + f + Z_STRSIZE_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl)); + memcpy((result->val + f + Z_STRLEN_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); } result->val[result->len] = '\0'; @@ -2600,7 +2600,7 @@ PHP_FUNCTION(quotemeta) RETURN_FALSE; } - str = STR_ALLOC(2 * old->len, 0); + str = zend_string_alloc(2 * old->len, 0); for (p = old->val, q = str->val; p != old_end; p++) { c = *p; @@ -2625,7 +2625,7 @@ PHP_FUNCTION(quotemeta) *q = '\0'; - RETURN_NEW_STR(STR_REALLOC(str, q - str->val, 0)); + RETURN_NEW_STR(zend_string_realloc(str, q - str->val, 0)); } /* }}} */ @@ -2646,7 +2646,7 @@ PHP_FUNCTION(ord) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_INT((unsigned char) str[0]); + RETURN_LONG((unsigned char) str[0]); } /* }}} */ @@ -2654,14 +2654,14 @@ PHP_FUNCTION(ord) Converts ASCII code to a character */ PHP_FUNCTION(chr) { - php_int_t c; + zend_long c; char temp[2]; if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i", &c) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) { c = 0; } @@ -2768,7 +2768,7 @@ PHP_FUNCTION(ucwords) r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); - for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) { + for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { if (mask[(unsigned char)*r++]) { *r = toupper((unsigned char) *r); } @@ -2813,7 +2813,7 @@ static int php_strtr_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ /* {{{ php_strtr_array */ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, HashTable *pats TSRMLS_DC) { - php_uint_t num_key; + zend_ulong num_key; zend_string *str_key; php_size_t len, pos, found; int num_keys = 0; @@ -2856,7 +2856,7 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash zend_hash_init(&str_hash, zend_hash_num_elements(pats), NULL, NULL, 0); ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) { if (UNEXPECTED(!str_key)) { - ZVAL_INT(&tmp, num_key); + ZVAL_LONG(&tmp, num_key); convert_to_string(&tmp); str_key = Z_STR(tmp); len = str_key->len; @@ -2915,7 +2915,7 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash smart_str_appendl(&result, str->val, str->len); pos += len; found = 1; - STR_RELEASE(str); + zend_string_release(str); break; } } ZEND_HASH_FOREACH_END(); @@ -2940,7 +2940,7 @@ static void php_strtr_array(zval *return_value, char *str, php_size_t slen, Hash smart_str_appendl(&result, str->val, str->len); pos += len; found = 1; - STR_RELEASE(str); + zend_string_release(str); break; } } @@ -3000,10 +3000,10 @@ PHP_FUNCTION(strtr) ZVAL_STRINGL(return_value, str, str_len); php_strtr(Z_STRVAL_P(return_value), - Z_STRSIZE_P(return_value), + Z_STRLEN_P(return_value), Z_STRVAL_P(from), to, - MIN(Z_STRSIZE_P(from), + MIN(Z_STRLEN_P(from), to_len)); } } @@ -3021,7 +3021,7 @@ PHP_FUNCTION(strrev) return; } - n = STR_ALLOC(str->len, 0); + n = zend_string_alloc(str->len, 0); p = n->val; e = str->val + str->len; @@ -3104,7 +3104,7 @@ PHP_FUNCTION(similar_text) Z_DVAL_P(percent) = 0; } - RETURN_INT(0); + RETURN_LONG(0); } sim = php_similar_char(t1->val, t1->len, t2->val, t2->len); @@ -3113,7 +3113,7 @@ PHP_FUNCTION(similar_text) Z_DVAL_P(percent) = sim * 200.0 / (t1->len + t2->len); } - RETURN_INT(sim); + RETURN_LONG(sim); } /* }}} */ @@ -3217,7 +3217,7 @@ PHP_FUNCTION(stripcslashes) } ZVAL_STRINGL(return_value, str->val, str->len); - php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value)); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); } /* }}} */ @@ -3232,7 +3232,7 @@ PHP_FUNCTION(stripslashes) } ZVAL_STRINGL(return_value, str->val, str->len); - php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); } /* }}} */ @@ -3327,7 +3327,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int shou char *end; char c; php_size_t newlen; - zend_string *new_str = STR_ALLOC(4 * (length? length : (length = strlen(str))), 0); + zend_string *new_str = zend_string_alloc(4 * (length? length : (length = strlen(str))), 0); if (!wlength) { wlength = strlen(what); @@ -3359,7 +3359,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int shou *target = 0; newlen = target - new_str->val; if (newlen < length * 4) { - new_str = STR_REALLOC(new_str, newlen, 0); + new_str = zend_string_realloc(new_str, newlen, 0); } if (should_free) { efree((char*)str); @@ -3381,7 +3381,7 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free return STR_EMPTY_ALLOC(); } - new_str = STR_ALLOC(2 * (length ? length : (length = strlen(str))), 0); + new_str = zend_string_alloc(2 * (length ? length : (length = strlen(str))), 0); source = str; end = source + length; target = new_str->val; @@ -3409,7 +3409,7 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free if (should_free) { efree(str); } - new_str = STR_REALLOC(new_str, target - new_str->val, 0); + new_str = zend_string_realloc(new_str, target - new_str->val, 0); return new_str; } @@ -3449,9 +3449,9 @@ PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char } if (to_len > 0) { - ZVAL_NEW_STR(result, STR_SAFE_ALLOC(char_count, to_len - 1, len, 0)); + ZVAL_NEW_STR(result, zend_string_safe_alloc(char_count, to_len - 1, len, 0)); } else { - ZVAL_NEW_STR(result, STR_ALLOC(len - char_count, 0)); + ZVAL_NEW_STR(result, zend_string_alloc(len - char_count, 0)); } target = Z_STRVAL_P(result); @@ -3514,7 +3514,7 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, char *e, *s, *p, *r; if (needle_len == str_len) { - new_str = STR_INIT(haystack, length, 0); + new_str = zend_string_init(haystack, length, 0); if (case_sensitivity) { end = new_str->val + length; @@ -3549,7 +3549,7 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, } if (str_len < needle_len) { - new_str = STR_ALLOC(length, 0); + new_str = zend_string_alloc(length, 0); } else { php_size_t count = 0; char *o, *n, *endp; @@ -3575,10 +3575,10 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, if (needle_dup) { efree(needle_dup); } - new_str = STR_INIT(haystack, length, 0); + new_str = zend_string_init(haystack, length, 0); return new_str; } else { - new_str = STR_ALLOC(count * (str_len - needle_len) + length, 0); + new_str = zend_string_alloc(count * (str_len - needle_len) + length, 0); } } @@ -3628,12 +3628,12 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, *e = '\0'; - new_str = STR_REALLOC(new_str, e - s, 0); + new_str = zend_string_realloc(new_str, e - s, 0); return new_str; } } else if (needle_len > length) { nothing_todo: - new_str = STR_INIT(haystack, length, 0); + new_str = zend_string_init(haystack, length, 0); return new_str; } else { if (case_sensitivity && memcmp(haystack, needle, length)) { @@ -3656,7 +3656,7 @@ nothing_todo: efree(l_needle); } - new_str = STR_INIT(str, str_len, 0); + new_str = zend_string_init(str, str_len, 0); if (replace_count) { (*replace_count)++; @@ -3697,7 +3697,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec convert_to_string_ex(&tmp_subject); subject = &tmp_subject; } - if (Z_STRSIZE_P(subject) == 0) { + if (Z_STRLEN_P(subject) == 0) { zval_ptr_dtor(&tmp_subject); ZVAL_EMPTY_STRING(result); return; @@ -3714,7 +3714,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } else { /* Set replacement value to the passed one */ replace_value = Z_STRVAL_P(replace); - replace_len = Z_STRSIZE_P(replace); + replace_len = Z_STRLEN_P(replace); } /* For each entry in the search array, get the entry */ @@ -3722,7 +3722,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); convert_to_string(search_entry); - if (Z_STRSIZE_P(search_entry) == 0) { + if (Z_STRLEN_P(search_entry) == 0) { if (Z_TYPE_P(replace) == IS_ARRAY) { zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } @@ -3738,7 +3738,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Set replacement value to the one we got from array */ replace_value = Z_STRVAL_P(replace_entry); - replace_len = Z_STRSIZE_P(replace_entry); + replace_len = Z_STRLEN_P(replace_entry); zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } else { @@ -3748,44 +3748,44 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } } - if (Z_STRSIZE_P(search_entry) == 1) { + if (Z_STRLEN_P(search_entry) == 1) { php_char_to_str_ex(Z_STRVAL_P(result), - Z_STRSIZE_P(result), + Z_STRLEN_P(result), Z_STRVAL_P(search_entry)[0], replace_value, replace_len, &temp_result, case_sensitivity, replace_count); - } else if (Z_STRSIZE_P(search_entry) > 1) { - ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result), - Z_STRVAL_P(search_entry), Z_STRSIZE_P(search_entry), + } else if (Z_STRLEN_P(search_entry) > 1) { + ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), + Z_STRVAL_P(search_entry), Z_STRLEN_P(search_entry), replace_value, replace_len, case_sensitivity, replace_count)); } - STR_FREE(Z_STR_P(result)); + zend_string_free(Z_STR_P(result)); Z_STR_P(result) = Z_STR(temp_result); Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result); - if (Z_STRSIZE_P(result) == 0) { + if (Z_STRLEN_P(result) == 0) { zval_ptr_dtor(&tmp_subject); return; } } ZEND_HASH_FOREACH_END(); } else { - if (Z_STRSIZE_P(search) == 1) { + if (Z_STRLEN_P(search) == 1) { php_char_to_str_ex(Z_STRVAL_P(subject), - Z_STRSIZE_P(subject), + Z_STRLEN_P(subject), Z_STRVAL_P(search)[0], Z_STRVAL_P(replace), - Z_STRSIZE_P(replace), + Z_STRLEN_P(replace), result, case_sensitivity, replace_count); - } else if (Z_STRSIZE_P(search) > 1) { - ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRSIZE_P(subject), - Z_STRVAL_P(search), Z_STRSIZE_P(search), - Z_STRVAL_P(replace), Z_STRSIZE_P(replace), case_sensitivity, replace_count)); + } else if (Z_STRLEN_P(search) > 1) { + ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRLEN_P(subject), + Z_STRVAL_P(search), Z_STRLEN_P(search), + Z_STRVAL_P(replace), Z_STRLEN_P(replace), case_sensitivity, replace_count)); } else { ZVAL_DUP(result, subject); } @@ -3801,8 +3801,8 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zval *subject, *search, *replace, *subject_entry, *zcount = NULL; zval result; zend_string *string_key; - php_uint_t num_key; - php_int_t count = 0; + zend_ulong num_key; + zend_long count = 0; int argc = ZEND_NUM_ARGS(); #ifndef FAST_ZPP @@ -3856,7 +3856,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit } if (argc > 3) { zval_dtor(zcount); - ZVAL_INT(zcount, count); + ZVAL_LONG(zcount, count); } } /* }}} */ @@ -3887,12 +3887,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) char *str; char *heb_str, *tmp, *target; int block_start, block_end, block_type, block_length, i; - php_int_t max_chars=0; + zend_long max_chars=0; int begin, end, char_count, orig_begin; int str_len; zend_string *broken_str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &max_chars) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) { return; } @@ -3982,7 +3982,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } while (block_end < str_len-1); - broken_str = STR_ALLOC(str_len, 0); + broken_str = zend_string_alloc(str_len, 0); begin = end = str_len-1; target = broken_str->val; @@ -4042,7 +4042,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) if (convert_newlines) { php_char_to_str(broken_str->val, broken_str->len,'\n', "<br />\n", 7, return_value); - STR_FREE(broken_str); + zend_string_free(broken_str); } else { RETURN_NEW_STR(broken_str); } @@ -4109,7 +4109,7 @@ PHP_FUNCTION(nl2br) { size_t repl_len = is_xhtml ? (sizeof("<br />") - 1) : (sizeof("<br>") - 1); - result = STR_ALLOC(repl_cnt * repl_len + str->len, 0); + result = zend_string_alloc(repl_cnt * repl_len + str->len, 0); target = result->val; } @@ -4165,15 +4165,15 @@ PHP_FUNCTION(strip_tags) convert_to_string_ex(allow); // TODO: reimplement to avoid reallocation ??? if (IS_INTERNED(Z_STR_P(allow))) { - allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRSIZE_P(allow)); - allowed_tags_len = Z_STRSIZE_P(allow); + allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow)); + allowed_tags_len = Z_STRLEN_P(allow); } else { allowed_tags = Z_STRVAL_P(allow); - allowed_tags_len = Z_STRSIZE_P(allow); + allowed_tags_len = Z_STRLEN_P(allow); } } - buf = STR_INIT(str->val, str->len, 0); + buf = zend_string_init(str->val, str->len, 0); buf->len = php_strip_tags_ex(buf->val, str->len, NULL, allowed_tags, allowed_tags_len, 0); // TODO: reimplement to avoid reallocation ??? @@ -4199,8 +4199,8 @@ PHP_FUNCTION(setlocale) } #ifdef HAVE_SETLOCALE - if (Z_TYPE_P(pcategory) == IS_INT) { - cat = Z_IVAL_P(pcategory); + if (Z_TYPE_P(pcategory) == IS_LONG) { + cat = Z_LVAL_P(pcategory); } else { /* FIXME: The following behaviour should be removed. */ char *category; @@ -4261,7 +4261,7 @@ PHP_FUNCTION(setlocale) loc = NULL; } else { loc = Z_STRVAL(tmp); - if (Z_STRSIZE(tmp) >= 255) { + if (Z_STRLEN(tmp) >= 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); zval_dtor(&tmp); break; @@ -4273,7 +4273,7 @@ PHP_FUNCTION(setlocale) if (retval) { /* Remember if locale was changed */ if (loc) { -//??? STR_FREE(BG(locale_string)); +//??? zend_string_free(BG(locale_string)); if (BG(locale_string)) { efree(BG(locale_string)); } @@ -4723,11 +4723,11 @@ PHP_FUNCTION(str_getcsv) PHP_FUNCTION(str_repeat) { zend_string *input_str; /* Input string */ - php_int_t mult; /* Multiplier */ + zend_long mult; /* Multiplier */ zend_string *result; /* Resulting string */ size_t result_len; /* Length of the resulting string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si", &input_str, &mult) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl", &input_str, &mult) == FAILURE) { return; } @@ -4742,7 +4742,7 @@ PHP_FUNCTION(str_repeat) RETURN_EMPTY_STRING(); /* Initialize the result string */ - result = STR_SAFE_ALLOC(input_str->len, mult, 0, 0); + result = zend_string_safe_alloc(input_str->len, mult, 0, 0); result_len = input_str->len * mult; /* Heavy optimization for situations where input string is 1 byte long */ @@ -4775,14 +4775,14 @@ PHP_FUNCTION(count_chars) { zend_string *input; int chars[256]; - php_int_t mymode=0; + zend_long mymode=0; unsigned char *buf; int inx; char retstr[256]; php_size_t retlen=0; php_size_t tmp = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &input, &mymode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &input, &mymode) == FAILURE) { return; } @@ -4807,16 +4807,16 @@ PHP_FUNCTION(count_chars) for (inx = 0; inx < 256; inx++) { switch (mymode) { case 0: - add_index_int(return_value, inx, chars[inx]); + add_index_long(return_value, inx, chars[inx]); break; case 1: if (chars[inx] != 0) { - add_index_int(return_value, inx, chars[inx]); + add_index_long(return_value, inx, chars[inx]); } break; case 2: if (chars[inx] == 0) { - add_index_int(return_value, inx, chars[inx]); + add_index_long(return_value, inx, chars[inx]); } break; case 3: @@ -4848,7 +4848,7 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) return; } - RETURN_INT(strnatcmp_ex(s1->val, s1->len, + RETURN_LONG(strnatcmp_ex(s1->val, s1->len, s2->val, s2->len, fold_case)); } @@ -4859,10 +4859,10 @@ PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2 zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_INT(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); + ZVAL_LONG(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); - STR_RELEASE(str1); - STR_RELEASE(str2); + zend_string_release(str1); + zend_string_release(str2); return SUCCESS; } /* }}} */ @@ -4913,14 +4913,14 @@ PHP_FUNCTION(localeconv) len = strlen(currlocdata.grouping); for (i = 0; i < len; i++) { - add_index_int(&grouping, i, currlocdata.grouping[i]); + add_index_long(&grouping, i, currlocdata.grouping[i]); } /* Grab the monetary grouping data out of the array */ len = strlen(currlocdata.mon_grouping); for (i = 0; i < len; i++) { - add_index_int(&mon_grouping, i, currlocdata.mon_grouping[i]); + add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]); } add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point); @@ -4931,21 +4931,21 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep); add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign); add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign); - add_assoc_int( return_value, "int_frac_digits", currlocdata.int_frac_digits); - add_assoc_int( return_value, "frac_digits", currlocdata.frac_digits); - add_assoc_int( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); - add_assoc_int( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); - add_assoc_int( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); - add_assoc_int( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); - add_assoc_int( return_value, "p_sign_posn", currlocdata.p_sign_posn); - add_assoc_int( return_value, "n_sign_posn", currlocdata.n_sign_posn); + add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits); + add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits); + add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); + add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); + add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); + add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); + add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn); + add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn); } #else /* Ok, it doesn't look like we have locale info floating around, so I guess it wouldn't hurt to just go ahead and return the POSIX locale information? */ - add_index_int(&grouping, 0, -1); - add_index_int(&mon_grouping, 0, -1); + add_index_long(&grouping, 0, -1); + add_index_long(&mon_grouping, 0, -1); add_assoc_string(return_value, "decimal_point", "\x2E"); add_assoc_string(return_value, "thousands_sep", ""); @@ -4955,14 +4955,14 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", ""); add_assoc_string(return_value, "positive_sign", ""); add_assoc_string(return_value, "negative_sign", ""); - add_assoc_int( return_value, "int_frac_digits", CHAR_MAX); - add_assoc_int( return_value, "frac_digits", CHAR_MAX); - add_assoc_int( return_value, "p_cs_precedes", CHAR_MAX); - add_assoc_int( return_value, "p_sep_by_space", CHAR_MAX); - add_assoc_int( return_value, "n_cs_precedes", CHAR_MAX); - add_assoc_int( return_value, "n_sep_by_space", CHAR_MAX); - add_assoc_int( return_value, "p_sign_posn", CHAR_MAX); - add_assoc_int( return_value, "n_sign_posn", CHAR_MAX); + add_assoc_long( return_value, "int_frac_digits", CHAR_MAX); + add_assoc_long( return_value, "frac_digits", CHAR_MAX); + add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX); + add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX); + add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX); + add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX); + add_assoc_long( return_value, "p_sign_posn", CHAR_MAX); + add_assoc_long( return_value, "n_sign_posn", CHAR_MAX); #endif zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping); @@ -4983,13 +4983,13 @@ PHP_FUNCTION(strnatcasecmp) PHP_FUNCTION(substr_count) { char *haystack, *needle; - php_int_t offset = 0, length = 0; + zend_long offset = 0, length = 0; int ac = ZEND_NUM_ARGS(); int count = 0; int haystack_len, needle_len; char *p, *endp, cmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ii", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { return; } @@ -5039,7 +5039,7 @@ PHP_FUNCTION(substr_count) } } - RETURN_INT(count); + RETURN_LONG(count); } /* }}} */ @@ -5049,27 +5049,27 @@ PHP_FUNCTION(str_pad) { /* Input arguments */ zend_string *input; /* Input string */ - php_int_t pad_length; /* Length to pad to */ + zend_long pad_length; /* Length to pad to */ /* Helper variables */ size_t num_pad_chars; /* Number of padding characters (total - input size) */ zend_string *pad_str, *pad_str_save; /* Pointer to padding string */ - php_int_t pad_type_val = STR_PAD_RIGHT; /* The padding type value */ + zend_long pad_type_val = STR_PAD_RIGHT; /* The padding type value */ int i, left_pad=0, right_pad=0; zend_string *result = NULL; /* Resulting string */ - pad_str = pad_str_save = STR_INIT(" ", 1, 1); + pad_str = pad_str_save = zend_string_init(" ", 1, 1); if (!pad_str) { return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|Si", &input, &pad_length, &pad_str, &pad_type_val) == FAILURE) { - STR_FREE(pad_str); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|Sl", &input, &pad_length, &pad_str, &pad_type_val) == FAILURE) { + zend_string_free(pad_str); return; } if (pad_str != pad_str_save) { - STR_FREE(pad_str_save); + zend_string_free(pad_str_save); } /* If resulting string turns out to be shorter than input string, @@ -5094,7 +5094,7 @@ PHP_FUNCTION(str_pad) return; } - result = STR_ALLOC(input->len + num_pad_chars, 0); + result = zend_string_alloc(input->len + num_pad_chars, 0); result->len = 0; /* We need to figure out the left/right padding lengths. */ @@ -5169,13 +5169,13 @@ PHP_FUNCTION(str_rot13) RETVAL_STRINGL(arg->val, arg->len); - php_strtr(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), rot13_from, rot13_to, 52); + php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52); } /* }}} */ -static void php_string_shuffle(char *str, php_int_t len TSRMLS_DC) /* {{{ */ +static void php_string_shuffle(char *str, zend_long len TSRMLS_DC) /* {{{ */ { - php_int_t n_elems, rnd_idx, n_left; + zend_long n_elems, rnd_idx, n_left; char temp; /* The implementation is stolen from array_data_shuffle */ /* Thus the characteristics of the randomization are the same */ @@ -5210,8 +5210,8 @@ PHP_FUNCTION(str_shuffle) } RETVAL_STRINGL(arg->val, arg->len); - if (Z_STRSIZE_P(return_value) > 1) { - php_string_shuffle(Z_STRVAL_P(return_value), (php_int_t) Z_STRSIZE_P(return_value) TSRMLS_CC); + if (Z_STRLEN_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (zend_long) Z_STRLEN_P(return_value) TSRMLS_CC); } } /* }}} */ @@ -5232,9 +5232,9 @@ PHP_FUNCTION(str_word_count) zend_string *str; char *char_list = NULL, *p, *e, *s, ch[256]; int char_list_len = 0, word_count = 0; - php_int_t type = 0; + zend_long type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &type, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ls", &str, &type, &char_list, &char_list_len) == FAILURE) { return; } @@ -5248,7 +5248,7 @@ PHP_FUNCTION(str_word_count) break; case 0: if (!str->len) { - RETURN_INT(0); + RETURN_LONG(0); } /* nothing to be done */ break; @@ -5296,7 +5296,7 @@ PHP_FUNCTION(str_word_count) } if (!type) { - RETURN_INT(word_count); + RETURN_LONG(word_count); } } @@ -5331,14 +5331,14 @@ PHP_FUNCTION(money_format) } } - str = STR_ALLOC(format_len + 1024, 0); + str = zend_string_alloc(format_len + 1024, 0); if ((str->len = strfmon(str->val, str->len, format, value)) < 0) { - STR_FREE(str); + zend_string_free(str); RETURN_FALSE; } str->val[str->len] = '\0'; - RETURN_NEW_STR(STR_REALLOC(str, str->len, 0)); + RETURN_NEW_STR(zend_string_realloc(str, str->len, 0)); } /* }}} */ #endif @@ -5348,11 +5348,11 @@ PHP_FUNCTION(money_format) PHP_FUNCTION(str_split) { zend_string *str; - php_int_t split_length = 1; + zend_long split_length = 1; char *p; php_size_t n_reg_segments; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &split_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &split_length) == FAILURE) { return; } @@ -5417,17 +5417,17 @@ PHP_FUNCTION(strpbrk) PHP_FUNCTION(substr_compare) { zend_string *s1, *s2; - php_int_t offset, len=0; + zend_long offset, len=0; zend_bool cs=0; php_size_t cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi|ib", &s1, &s2, &offset, &len, &cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl|lb", &s1, &s2, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() >= 4 && len <= 0) { if (len == 0) { - RETURN_INT(0L); + RETURN_LONG(0L); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero"); RETURN_FALSE; @@ -5447,9 +5447,9 @@ PHP_FUNCTION(substr_compare) cmp_len = (php_size_t) (len ? len : MAX(s2->len, (s1->len - offset))); if (!cs) { - RETURN_INT(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); + RETURN_LONG(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); } else { - RETURN_INT(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); + RETURN_LONG(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); } } /* }}} */ diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index 65dda069d5..046393b6bb 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -41,59 +41,59 @@ PHP_MINIT_FUNCTION(syslog) { /* error levels */ - REGISTER_INT_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ - REGISTER_INT_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ - REGISTER_INT_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ - REGISTER_INT_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ + REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ + REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ + REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); /* facility: type of program logging the message */ - REGISTER_INT_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ - REGISTER_INT_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ - REGISTER_INT_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ - REGISTER_INT_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ + REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ + REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ + REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NEWS /* No LOG_NEWS on HP-UX */ - REGISTER_INT_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ + REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ #endif #ifdef LOG_UUCP /* No LOG_UUCP on HP-UX */ - REGISTER_INT_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_CRON /* apparently some systems don't have this one */ - REGISTER_INT_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_AUTHPRIV /* AIX doesn't have LOG_AUTHPRIV */ - REGISTER_INT_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); #endif #ifndef PHP_WIN32 - REGISTER_INT_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); #endif /* options */ - REGISTER_INT_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NOWAIT - REGISTER_INT_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_PERROR /* AIX doesn't have LOG_PERROR */ - REGISTER_INT_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ + REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ #endif BG(syslog_device)=NULL; @@ -135,10 +135,10 @@ PHP_MSHUTDOWN_FUNCTION(syslog) PHP_FUNCTION(openlog) { char *ident; - php_int_t option, facility; + zend_long option, facility; int ident_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii", &ident, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident, &ident_len, &option, &facility) == FAILURE) { return; } @@ -175,11 +175,11 @@ PHP_FUNCTION(closelog) Generate a system log message */ PHP_FUNCTION(syslog) { - php_int_t priority; + zend_long priority; char *message; int message_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &priority, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &priority, &message, &message_len) == FAILURE) { return; } diff --git a/ext/standard/type.c b/ext/standard/type.c index 574744d9ba..0ac849d81e 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -41,7 +41,7 @@ PHP_FUNCTION(gettype) RETVAL_STRING("boolean"); break; - case IS_INT: + case IS_LONG: RETVAL_STRING("integer"); break; @@ -138,20 +138,20 @@ PHP_FUNCTION(settype) PHP_FUNCTION(intval) { zval *num; - php_int_t base = 10; + zend_long base = 10; if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 2) { WRONG_PARAM_COUNT; } #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &num, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &num, &base) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(num) Z_PARAM_OPTIONAL - Z_PARAM_INT(base) + Z_PARAM_LONG(base) ZEND_PARSE_PARAMETERS_END(); #endif @@ -277,7 +277,7 @@ PHP_FUNCTION(is_bool) Returns true if variable is a long (integer) */ PHP_FUNCTION(is_long) { - php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_INT); + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); } /* }}} */ @@ -324,13 +324,13 @@ PHP_FUNCTION(is_numeric) } switch (Z_TYPE_P(arg)) { - case IS_INT: + case IS_LONG: case IS_DOUBLE: RETURN_TRUE; break; case IS_STRING: - if (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), NULL, NULL, 0)) { + if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 0)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -364,7 +364,7 @@ PHP_FUNCTION(is_scalar) case IS_FALSE: case IS_TRUE: case IS_DOUBLE: - case IS_INT: + case IS_LONG: case IS_STRING: RETURN_TRUE; break; @@ -401,7 +401,7 @@ PHP_FUNCTION(is_callable) //??? is it necessary to be consistent with old PHP ("\0" support) if (UNEXPECTED(name->len) != strlen(name->val)) { ZVAL_STRINGL(callable_name, name->val, strlen(name->val)); - STR_RELEASE(name); + zend_string_release(name); } else { ZVAL_STR(callable_name, name); } diff --git a/ext/standard/url.c b/ext/standard/url.c index f0f199c00b..47b3a793d9 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -186,7 +186,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { - php_int_t port; + zend_long port; memcpy(port_buf, p, (pp - p)); port_buf[pp - p] = '\0'; port = ZEND_STRTOI(port_buf, NULL, 10); @@ -280,7 +280,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) efree(ret); return NULL; } else if (e - p > 0) { - php_int_t port; + zend_long port; memcpy(port_buf, p, (e - p)); port_buf[e - p] = '\0'; port = ZEND_STRTOI(port_buf, NULL, 10); @@ -377,9 +377,9 @@ PHP_FUNCTION(parse_url) char *str; int str_len; php_url *resource; - php_int_t key = -1; + zend_long key = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) { return; } @@ -398,7 +398,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) RETVAL_STRING(resource->host); break; case PHP_URL_PORT: - if (resource->port != 0) RETVAL_INT(resource->port); + if (resource->port != 0) RETVAL_LONG(resource->port); break; case PHP_URL_USER: if (resource->user != NULL) RETVAL_STRING(resource->user); @@ -431,7 +431,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) add_assoc_string(return_value, "host", resource->host); if (resource->port != 0) - add_assoc_int(return_value, "port", resource->port); + add_assoc_long(return_value, "port", resource->port); if (resource->user != NULL) add_assoc_string(return_value, "user", resource->user); if (resource->pass != NULL) @@ -494,7 +494,7 @@ PHPAPI zend_string *php_url_encode(char const *s, int len) from = (unsigned char *)s; end = (unsigned char *)s + len; - start = STR_ALLOC(3 * len, 0); + start = zend_string_alloc(3 * len, 0); to = (unsigned char*)start->val; while (from < end) { @@ -525,7 +525,7 @@ PHPAPI zend_string *php_url_encode(char const *s, int len) } *to = '\0'; - start = STR_REALLOC(start, to - (unsigned char*)start->val, 0); + start = zend_string_realloc(start, to - (unsigned char*)start->val, 0); return start; } @@ -567,7 +567,7 @@ PHP_FUNCTION(urldecode) ZEND_PARSE_PARAMETERS_END(); #endif - out_str = STR_INIT(in_str->val, in_str->len, 0); + out_str = zend_string_init(in_str->val, in_str->len, 0); out_str->len = php_url_decode(out_str->val, out_str->len); RETURN_NEW_STR(out_str); @@ -612,7 +612,7 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, int len) register int x, y; zend_string *str; - str = STR_ALLOC(3 * len, 0); + str = zend_string_alloc(3 * len, 0); for (x = 0, y = 0; len--; x++, y++) { str->val[y] = (unsigned char) s[x]; #ifndef CHARSET_EBCDIC @@ -632,7 +632,7 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, int len) } } str->val[y] = '\0'; - str = STR_REALLOC(str, y, 0); + str = zend_string_realloc(str, y, 0); return str; } @@ -674,7 +674,7 @@ PHP_FUNCTION(rawurldecode) ZEND_PARSE_PARAMETERS_END(); #endif - out_str = STR_INIT(in_str->val, in_str->len, 0); + out_str = zend_string_init(in_str->val, in_str->len, 0); out_str->len = php_raw_url_decode(out_str->val, out_str->len); RETURN_NEW_STR(out_str); @@ -719,9 +719,9 @@ PHP_FUNCTION(get_headers) php_stream *stream; zval *prev_val, *hdr = NULL, *h; HashTable *hashT; - php_int_t format = 0; + zend_long format = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &url, &url_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { return; } context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); @@ -755,7 +755,7 @@ PHP_FUNCTION(get_headers) } if (!format) { no_name_header: - add_next_index_str(return_value, STR_COPY(Z_STR_P(hdr))); + add_next_index_str(return_value, zend_string_copy(Z_STR_P(hdr))); } else { char c; char *s, *p; @@ -769,10 +769,10 @@ no_name_header: } if ((prev_val = zend_hash_str_find(HASH_OF(return_value), Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr)))) == NULL) { - add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(prev_val); - add_next_index_stringl(prev_val, s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); } *p = c; diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index fc865b64a7..48910515f7 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1057,7 +1057,7 @@ PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int va smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />"); if (urlencode) { - STR_FREE(encoded); + zend_string_free(encoded); } smart_str_free(&val); diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 240e504d6d..cfee6c31a7 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -509,7 +509,7 @@ PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int va smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />"); if (urlencode) { - STR_FREE(encoded); + zend_string_free(encoded); } smart_str_free(&val); diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index f9c94186f1..560fd9b910 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -113,13 +113,13 @@ PHP_MINIT_FUNCTION(user_filters) return FAILURE; } - REGISTER_INT_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -203,7 +203,7 @@ php_stream_filter_status_t userfilter_filter( ZEND_REGISTER_RESOURCE(&args[1], buckets_out, le_bucket_brigade); if (bytes_consumed) { - ZVAL_INT(&args[2], *bytes_consumed); + ZVAL_LONG(&args[2], *bytes_consumed); } else { ZVAL_NULL(&args[2]); } @@ -221,13 +221,13 @@ php_stream_filter_status_t userfilter_filter( if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_int(&retval); - ret = Z_IVAL(retval); + ret = Z_LVAL(retval); } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function"); } if (bytes_consumed) { - *bytes_consumed = Z_IVAL_P(&args[2]); + *bytes_consumed = Z_LVAL_P(&args[2]); } if (buckets_in->head) { @@ -397,7 +397,7 @@ static php_stream_filter_factory user_filter_factory = { static void filter_item_dtor(zval *zv) { struct php_user_filter_data *fdat = Z_PTR_P(zv); - STR_RELEASE(fdat->classname); + zend_string_release(fdat->classname); efree(fdat); } @@ -424,7 +424,7 @@ PHP_FUNCTION(stream_bucket_make_writeable) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_int(return_value, "datalen", bucket->buflen); + add_property_long(return_value, "datalen", bucket->buflen); } } /* }}} */ @@ -453,9 +453,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRSIZE_P(pzdata)) { - bucket->buf = perealloc(bucket->buf, Z_STRSIZE_P(pzdata), bucket->is_persistent); - bucket->buflen = Z_STRSIZE_P(pzdata); + if ((int)bucket->buflen != Z_STRLEN_P(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRLEN_P(pzdata); } memcpy(bucket->buf, Z_STRVAL_P(pzdata), bucket->buflen); } @@ -525,7 +525,7 @@ PHP_FUNCTION(stream_bucket_new) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_int(return_value, "datalen", bucket->buflen); + add_property_long(return_value, "datalen", bucket->buflen); } /* }}} */ @@ -547,7 +547,7 @@ PHP_FUNCTION(stream_get_filters) if (filters_hash) { ZEND_HASH_FOREACH_STR_KEY(filters_hash, filter_name) { if (filter_name) { - add_next_index_str(return_value, STR_COPY(filter_name)); + add_next_index_str(return_value, zend_string_copy(filter_name)); } } ZEND_HASH_FOREACH_END(); } @@ -584,13 +584,13 @@ PHP_FUNCTION(stream_filter_register) } fdat = ecalloc(1, sizeof(struct php_user_filter_data)); - fdat->classname = STR_COPY(classname); + fdat->classname = zend_string_copy(classname); if (zend_hash_add_ptr(BG(user_filter_map), filtername, fdat) != NULL && php_stream_filter_register_factory_volatile(filtername->val, &user_filter_factory TSRMLS_CC) == SUCCESS) { RETVAL_TRUE; } else { - STR_RELEASE(classname); + zend_string_release(classname); efree(fdat); } } diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 5e2ad73c72..d296df360e 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -72,7 +72,7 @@ PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */ zend_string *dest; /* encoded length is ~ 38% greater than the original */ - dest = STR_ALLOC((size_t)ceil(src_len * 1.38) + 46, 0); + dest = zend_string_alloc((size_t)ceil(src_len * 1.38) + 46, 0); p = dest->val; s = src; e = src + src_len; @@ -122,7 +122,7 @@ PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */ *p++ = '\n'; *p = '\0'; - dest = STR_REALLOC(dest, p - dest->val, 0); + dest = zend_string_realloc(dest, p - dest->val, 0); return dest; } /* }}} */ @@ -133,7 +133,7 @@ PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */ char *s, *e, *p, *ee; zend_string *dest; - dest = STR_ALLOC((size_t) ceil(src_len * 0.75), 0); + dest = zend_string_alloc((size_t) ceil(src_len * 0.75), 0); p = dest->val; s = src; e = src + src_len; @@ -189,7 +189,7 @@ PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */ return dest; err: - STR_FREE(dest); + zend_string_free(dest); return NULL; } diff --git a/ext/standard/var.c b/ext/standard/var.c index 02c1cc4bd0..b8d498fc8e 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -54,7 +54,7 @@ static uint zend_obj_num_elements(HashTable *ht) return num; } -static void php_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void php_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); @@ -67,7 +67,7 @@ static void php_array_element_dump(zval *zv, php_uint_t index, zend_string *key, } /* }}} */ -static void php_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void php_object_property_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { const char *prop_name, *class_name; @@ -100,7 +100,7 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */ zend_string *class_name; int is_temp; int is_ref = 0; - php_uint_t num; + zend_ulong num; zend_string *key; zval *val; @@ -119,15 +119,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_INT: - php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc)); + case IS_LONG: + php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); PUTS("\"\n"); break; case IS_ARRAY: @@ -166,12 +166,12 @@ again: if (Z_OBJ_HANDLER_P(struc, get_class_name)) { class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC); php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0); - STR_RELEASE(class_name); + zend_string_release(class_name); } else { php_printf("%sobject(unknown class)#%d (%d) {\n", COMMON, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0); } if (myht) { - php_uint_t num; + zend_ulong num; zend_string *key; zval *val; @@ -227,7 +227,7 @@ PHP_FUNCTION(var_dump) } /* }}} */ -static void zval_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void zval_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); @@ -240,7 +240,7 @@ static void zval_array_element_dump(zval *zv, php_uint_t index, zend_string *key } /* }}} */ -static void zval_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void zval_object_property_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { const char *prop_name, *class_name; @@ -271,7 +271,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */ zend_string *class_name; int is_temp = 0; int is_ref = 0; - php_uint_t index; + zend_ulong index; zend_string *key; zval *val; @@ -290,15 +290,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_INT: - php_printf("%slong(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc)); + case IS_LONG: + php_printf("%slong(" ZEND_INT_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sdouble(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); php_printf("\" refcount(%u)\n", IS_INTERNED(Z_STR_P(struc)) ? 1 : Z_REFCOUNT_P(struc)); break; case IS_ARRAY: @@ -336,7 +336,7 @@ again: } class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC); php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name->val, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0, Z_REFCOUNT_P(struc)); - STR_RELEASE(class_name); + zend_string_release(class_name); if (myht) { ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) { zval_object_property_dump(val, index, key, level TSRMLS_CC); @@ -398,11 +398,11 @@ PHP_FUNCTION(debug_zval_dump) efree(tmp_spaces); \ } while(0); -static void php_array_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ +static void php_array_element_export(zval *zv, zend_ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ buffer_append_spaces(buf, level+1); - smart_str_append_int(buf, (php_int_t) index); + smart_str_append_long(buf, (zend_long) index); smart_str_appendl(buf, " => ", 4); } else { /* string key */ @@ -416,8 +416,8 @@ static void php_array_element_export(zval *zv, php_uint_t index, zend_string *ke smart_str_appendl(buf, tmp_str->val, tmp_str->len); smart_str_appendl(buf, "' => ", 5); - STR_FREE(ckey); - STR_FREE(tmp_str); + zend_string_free(ckey); + zend_string_free(tmp_str); } php_var_export_ex(zv, level + 2, buf TSRMLS_CC); @@ -426,7 +426,7 @@ static void php_array_element_export(zval *zv, php_uint_t index, zend_string *ke } /* }}} */ -static void php_object_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ +static void php_object_element_export(zval *zv, zend_ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ { buffer_append_spaces(buf, level + 2); if (key != NULL) { @@ -441,9 +441,9 @@ static void php_object_element_export(zval *zv, php_uint_t index, zend_string *k smart_str_appendc(buf, '\''); smart_str_appendl(buf, pname_esc->val, pname_esc->len); smart_str_appendc(buf, '\''); - STR_RELEASE(pname_esc); + zend_string_release(pname_esc); } else { - smart_str_append_int(buf, (php_int_t) index); + smart_str_append_long(buf, (zend_long) index); } smart_str_appendl(buf, " => ", 4); php_var_export_ex(zv, level + 2, buf TSRMLS_CC); @@ -459,7 +459,7 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC) php_size_t tmp_len; zend_string *class_name; zend_string *ztmp, *ztmp2; - php_uint_t index; + zend_ulong index; zend_string *key; zval *val; @@ -474,8 +474,8 @@ again: case IS_NULL: smart_str_appendl(buf, "NULL", 4); break; - case IS_INT: - smart_str_append_int(buf, Z_IVAL_P(struc)); + case IS_LONG: + smart_str_append_long(buf, Z_LVAL_P(struc)); break; case IS_DOUBLE: tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_P(struc)); @@ -483,15 +483,15 @@ again: efree(tmp_str); break; case IS_STRING: - ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRSIZE_P(struc), 0, "'\\", 2 TSRMLS_CC); + ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRLEN_P(struc), 0, "'\\", 2 TSRMLS_CC); ztmp2 = php_str_to_str_ex(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12, 0, NULL); smart_str_appendc(buf, '\''); smart_str_appendl(buf, ztmp2->val, ztmp2->len); smart_str_appendc(buf, '\''); - STR_FREE(ztmp); - STR_FREE(ztmp2); + zend_string_free(ztmp); + zend_string_free(ztmp2); break; case IS_ARRAY: myht = Z_ARRVAL_P(struc); @@ -539,7 +539,7 @@ again: smart_str_appendl(buf, class_name->val, class_name->len); smart_str_appendl(buf, "::__set_state(array(\n", 21); - STR_RELEASE(class_name); + zend_string_release(class_name); if (myht) { ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) { php_object_element_export(val, index, key, level, buf TSRMLS_CC); @@ -613,16 +613,16 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var } if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { p = smart_str_print_long(id + sizeof(id) - 1, - (php_int_t) Z_OBJ_P(var)); + (zend_long) Z_OBJ_P(var)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else if (var_ptr != var) { p = smart_str_print_long(id + sizeof(id) - 1, - (php_int_t) Z_REF_P(var_ptr)); + (zend_long) Z_REF_P(var_ptr)); *(--p) = 'R'; len = id + sizeof(id) - 1 - p; } else { - p = smart_str_print_long(id + sizeof(id) - 1, (php_int_t) var); + p = smart_str_print_long(id + sizeof(id) - 1, (zend_long) var); len = id + sizeof(id) - 1 - p; } @@ -631,29 +631,29 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var if (var == var_ptr) { /* we still need to bump up the counter, since non-refs will * be counted separately by unserializer */ - ZVAL_INT(&var_no, -1); + ZVAL_LONG(&var_no, -1); zend_hash_next_index_insert(var_hash, &var_no); } #if 0 - fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(php_uint_t**)var_old); + fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(zend_ulong**)var_old); #endif return FAILURE; } /* +1 because otherwise hash will think we are trying to store NULL pointer */ - ZVAL_INT(&var_no, zend_hash_num_elements(var_hash) + 1); + ZVAL_LONG(&var_no, zend_hash_num_elements(var_hash) + 1); zend_hash_str_add(var_hash, p, len, &var_no); #if 0 - fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_IVAL(var_no)); + fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_LVAL(var_no)); #endif return SUCCESS; } /* }}} */ -static inline void php_var_serialize_long(smart_str *buf, php_int_t val) /* {{{ */ +static inline void php_var_serialize_long(smart_str *buf, zend_long val) /* {{{ */ { smart_str_appendl(buf, "i:", 2); - smart_str_append_int(buf, val); + smart_str_append_long(buf, val); smart_str_appendc(buf, ';'); } /* }}} */ @@ -661,7 +661,7 @@ static inline void php_var_serialize_long(smart_str *buf, php_int_t val) /* {{{ static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); - smart_str_append_int(buf, len); + smart_str_append_long(buf, len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, str, len); smart_str_appendl(buf, "\";", 2); @@ -674,7 +674,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_int(buf, (int)class_name->len); + smart_str_append_long(buf, (int)class_name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name->val, class_name->len); smart_str_appendl(buf, "\":", 2); @@ -695,7 +695,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt if (incomplete_class) { --count; } - smart_str_append_int(buf, count); + smart_str_append_long(buf, count); smart_str_appendl(buf, ":{", 2); if (count > 0) { @@ -728,7 +728,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt continue; } } - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); } else { zend_class_entry *ce; @@ -737,7 +737,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt zend_string *prot_name, *priv_name; do { - priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); + priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, priv_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); @@ -746,32 +746,32 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt } } php_var_serialize_string(buf, priv_name->val, priv_name->len); - STR_FREE(priv_name); + zend_string_free(priv_name); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); break; } - STR_FREE(priv_name); - prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); + zend_string_free(priv_name); + prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, prot_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); if (Z_TYPE_P(d) == IS_UNDEF) { - STR_FREE(prot_name); + zend_string_free(prot_name); break; } } php_var_serialize_string(buf, prot_name->val, prot_name->len); - STR_FREE(prot_name); + zend_string_free(prot_name); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); break; } - STR_FREE(prot_name); - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + zend_string_free(prot_name); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_P(name)); } while (0); } else { - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); } } @@ -797,12 +797,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var php_add_var_hash(var_hash, struc, &var_already TSRMLS_CC) == FAILURE) { if (Z_ISREF_P(struc)) { smart_str_appendl(buf, "R:", 2); - smart_str_append_int(buf, Z_IVAL(var_already)); + smart_str_append_long(buf, Z_LVAL(var_already)); smart_str_appendc(buf, ';'); return; } else if (Z_TYPE_P(struc) == IS_OBJECT) { smart_str_appendl(buf, "r:", 2); - smart_str_append_int(buf, Z_IVAL(var_already)); + smart_str_append_long(buf, Z_LVAL(var_already)); smart_str_appendc(buf, ';'); return; } @@ -822,8 +822,8 @@ again: smart_str_appendl(buf, "N;", 2); return; - case IS_INT: - php_var_serialize_long(buf, Z_IVAL_P(struc)); + case IS_LONG: + php_var_serialize_long(buf, Z_LVAL_P(struc)); return; case IS_DOUBLE: { @@ -839,7 +839,7 @@ again: } case IS_STRING: - php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); return; case IS_OBJECT: { @@ -859,12 +859,12 @@ again: if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_int(buf, (int)Z_OBJCE_P(struc)->name->len); + smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name->val, Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, "\":", 2); - smart_str_append_int(buf, (int)serialized_length); + smart_str_append_long(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); @@ -923,12 +923,12 @@ again: if (i > 0 && incomplete_class) { --i; } - smart_str_append_int(buf, i); + smart_str_append_long(buf, i); smart_str_appendl(buf, ":{", 2); if (i > 0) { zend_string *key; zval *data; - php_uint_t index; + zend_ulong index; ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) { @@ -1031,7 +1031,7 @@ PHP_FUNCTION(unserialize) PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_dtor(return_value); if (!EG(exception)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_INT_FMT " of %d bytes", (php_int_t)((char*)p - buf), buf_len); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_INT_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len); } RETURN_FALSE; } @@ -1048,7 +1048,7 @@ PHP_FUNCTION(memory_get_usage) { RETURN_FALSE; } - RETURN_INT(zend_memory_usage(real_usage TSRMLS_CC)); + RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC)); } /* }}} */ @@ -1061,7 +1061,7 @@ PHP_FUNCTION(memory_get_peak_usage) { RETURN_FALSE; } - RETURN_INT(zend_memory_peak_usage(real_usage TSRMLS_CC)); + RETURN_LONG(zend_memory_peak_usage(real_usage TSRMLS_CC)); } /* }}} */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index b4be2cc26d..3ae0aaf633 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -30,13 +30,13 @@ typedef struct { zval *data[VAR_ENTRIES_MAX]; - php_int_t used_slots; + zend_long used_slots; void *next; } var_entries; typedef struct { zval data[VAR_ENTRIES_MAX]; - php_int_t used_slots; + zend_long used_slots; void *next; } var_dtor_entries; @@ -119,7 +119,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval) { - php_int_t i; + zend_long i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); @@ -136,7 +136,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz } } -static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) +static zval *var_access(php_unserialize_data_t *var_hashx, zend_long id) { var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG @@ -158,7 +158,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; - php_int_t i; + zend_long i; var_entries *var_hash = (*var_hashx)->first; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; #if VAR_ENTRIES_DBG @@ -186,17 +186,17 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen) { size_t i, j; - zend_string *str = STR_ALLOC(len, 0); + zend_string *str = zend_string_alloc(len, 0); unsigned char *end = *(unsigned char **)p+maxlen; if (end < *p) { - STR_FREE(str); + zend_string_free(str); return NULL; } for (i = 0; i < len; i++) { if (*p >= end) { - STR_FREE(str); + zend_string_free(str); return NULL; } if (**p != '\\') { @@ -213,7 +213,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t } else if (**p >= 'A' && **p <= 'F') { ch = (ch << 4) + (**p -'A'+10); } else { - STR_FREE(str); + zend_string_free(str); return NULL; } } @@ -238,10 +238,10 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t -static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q) +static inline zend_long parse_iv2(const unsigned char *p, const unsigned char **q) { char cursor; - php_int_t result = 0; + zend_long result = 0; int neg = 0; switch (*p) { @@ -266,7 +266,7 @@ static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char ** return result; } -static inline php_int_t parse_iv(const unsigned char *p) +static inline zend_long parse_iv(const unsigned char *p) { return parse_iv2(p, NULL); } @@ -296,7 +296,7 @@ static inline size_t parse_uiv(const unsigned char *p) #define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC #define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC -static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops) +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { while (elements-- > 0) { zval key, *data, d, *old_data; @@ -307,7 +307,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_ return 0; } - if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) { + if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) { zval_dtor(&key); return 0; } @@ -317,12 +317,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_ if (!objprops) { switch (Z_TYPE(key)) { - case IS_INT: - if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) { + case IS_LONG: + if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) { //??? update hash var_push_dtor(var_hash, old_data); } - data = zend_hash_index_update(ht, Z_IVAL(key), &d); + data = zend_hash_index_update(ht, Z_LVAL(key), &d); break; case IS_STRING: if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) { @@ -380,14 +380,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER) static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - php_int_t datalen; + zend_long datalen; datalen = parse_iv2((*p) + 2, p); (*p) += 2; if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (php_int_t)(max - (*p))); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (zend_long)(max - (*p))); return 0; } @@ -403,9 +403,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) return finish_nested_data(UNSERIALIZE_PASSTHRU); } -static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +static inline zend_long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - php_int_t elements; + zend_long elements; elements = parse_iv2((*p) + 2, p); @@ -426,7 +426,7 @@ static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry * #ifdef PHP_WIN32 # pragma optimize("", off) #endif -static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements) +static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) { zval retval; zval fname; @@ -625,7 +625,7 @@ yy20: #line 681 "ext/standard/var_unserializer.re" { size_t len, len2, len3, maxlen; - php_int_t elements; + zend_long elements; char *str; zend_string *class_name; zend_class_entry *ce; @@ -669,7 +669,7 @@ yy20: return 0; } - class_name = STR_INIT(str, len, 0); + class_name = zend_string_init(str, len, 0); do { /* Try to find class directly */ @@ -678,7 +678,7 @@ yy20: if (ce) { BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); return 0; } break; @@ -686,7 +686,7 @@ yy20: BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); return 0; } @@ -700,12 +700,12 @@ yy20: /* Call unserialize callback */ ZVAL_STRING(&user_func, PG(unserialize_callback_func)); - ZVAL_STR(&args[0], STR_COPY(class_name)); + ZVAL_STR(&args[0], zend_string_copy(class_name)); BG(serialize_lock)++; if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -720,7 +720,7 @@ yy20: BG(serialize_lock)--; zval_ptr_dtor(&retval); if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -748,7 +748,7 @@ yy20: if (ret && incomplete_class) { php_store_class_name(rval, class_name->val, len2); } - STR_RELEASE(class_name); + zend_string_release(class_name); return ret; } @@ -757,7 +757,7 @@ yy20: if (incomplete_class) { php_store_class_name(rval, class_name->val, len2); } - STR_RELEASE(class_name); + zend_string_release(class_name); return object_common2(UNSERIALIZE_PASSTHRU, elements); } @@ -817,7 +817,7 @@ yy34: ++YYCURSOR; #line 652 "ext/standard/var_unserializer.re" { - php_int_t elements = parse_iv(start + 2); + zend_long elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ *p = YYCURSOR; @@ -874,7 +874,7 @@ yy41: } if (*(YYCURSOR) != '"') { - STR_FREE(str); + zend_string_free(str); *p = YYCURSOR; return 0; } @@ -1141,10 +1141,10 @@ yy79: digits--; } - /* Use double for large php_int_t values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) { - if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1); + /* Use double for large zend_long values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_LONG - 1) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { goto use_double; @@ -1155,7 +1155,7 @@ yy79: } #endif *p = YYCURSOR; - ZVAL_INT(rval, parse_iv(start + 2)); + ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } #line 1162 "ext/standard/var_unserializer.c" @@ -1206,7 +1206,7 @@ yy91: ++YYCURSOR; #line 511 "ext/standard/var_unserializer.re" { - php_int_t id; + zend_long id; *p = YYCURSOR; if (!var_hash) return 0; @@ -1252,7 +1252,7 @@ yy97: ++YYCURSOR; #line 489 "ext/standard/var_unserializer.re" { - php_int_t id; + zend_long id; *p = YYCURSOR; if (!var_hash) return 0; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 57570ab7f9..054580ac41 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -28,13 +28,13 @@ typedef struct { zval *data[VAR_ENTRIES_MAX]; - php_int_t used_slots; + zend_long used_slots; void *next; } var_entries; typedef struct { zval data[VAR_ENTRIES_MAX]; - php_int_t used_slots; + zend_long used_slots; void *next; } var_dtor_entries; @@ -117,7 +117,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval) { - php_int_t i; + zend_long i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); @@ -134,7 +134,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz } } -static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) +static zval *var_access(php_unserialize_data_t *var_hashx, zend_long id) { var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG @@ -156,7 +156,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; - php_int_t i; + zend_long i; var_entries *var_hash = (*var_hashx)->first; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; #if VAR_ENTRIES_DBG @@ -184,17 +184,17 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen) { size_t i, j; - zend_string *str = STR_ALLOC(len, 0); + zend_string *str = zend_string_alloc(len, 0); unsigned char *end = *(unsigned char **)p+maxlen; if (end < *p) { - STR_FREE(str); + zend_string_free(str); return NULL; } for (i = 0; i < len; i++) { if (*p >= end) { - STR_FREE(str); + zend_string_free(str); return NULL; } if (**p != '\\') { @@ -211,7 +211,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t } else if (**p >= 'A' && **p <= 'F') { ch = (ch << 4) + (**p -'A'+10); } else { - STR_FREE(str); + zend_string_free(str); return NULL; } } @@ -242,10 +242,10 @@ object = [OC]; -static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q) +static inline zend_long parse_iv2(const unsigned char *p, const unsigned char **q) { char cursor; - php_int_t result = 0; + zend_long result = 0; int neg = 0; switch (*p) { @@ -270,7 +270,7 @@ static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char ** return result; } -static inline php_int_t parse_iv(const unsigned char *p) +static inline zend_long parse_iv(const unsigned char *p) { return parse_iv2(p, NULL); } @@ -300,7 +300,7 @@ static inline size_t parse_uiv(const unsigned char *p) #define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC #define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC -static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops) +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { while (elements-- > 0) { zval key, *data, d, *old_data; @@ -311,7 +311,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_ return 0; } - if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) { + if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) { zval_dtor(&key); return 0; } @@ -321,12 +321,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_ if (!objprops) { switch (Z_TYPE(key)) { - case IS_INT: - if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) { + case IS_LONG: + if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) { //??? update hash var_push_dtor(var_hash, old_data); } - data = zend_hash_index_update(ht, Z_IVAL(key), &d); + data = zend_hash_index_update(ht, Z_LVAL(key), &d); break; case IS_STRING: if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) { @@ -384,14 +384,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER) static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - php_int_t datalen; + zend_long datalen; datalen = parse_iv2((*p) + 2, p); (*p) += 2; if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (php_int_t)(max - (*p))); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %pd present", datalen, (zend_long)(max - (*p))); return 0; } @@ -407,9 +407,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) return finish_nested_data(UNSERIALIZE_PASSTHRU); } -static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +static inline zend_long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - php_int_t elements; + zend_long elements; elements = parse_iv2((*p) + 2, p); @@ -430,7 +430,7 @@ static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry * #ifdef PHP_WIN32 # pragma optimize("", off) #endif -static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements) +static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) { zval retval; zval fname; @@ -487,7 +487,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) /*!re2c "R:" iv ";" { - php_int_t id; + zend_long id; *p = YYCURSOR; if (!var_hash) return 0; @@ -509,7 +509,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } "r:" iv ";" { - php_int_t id; + zend_long id; *p = YYCURSOR; if (!var_hash) return 0; @@ -551,10 +551,10 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) digits--; } - /* Use double for large php_int_t values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) { - if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1); + /* Use double for large zend_long values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_LONG - 1) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { goto use_double; @@ -565,7 +565,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } #endif *p = YYCURSOR; - ZVAL_INT(rval, parse_iv(start + 2)); + ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } @@ -637,7 +637,7 @@ use_double: } if (*(YYCURSOR) != '"') { - STR_FREE(str); + zend_string_free(str); *p = YYCURSOR; return 0; } @@ -650,7 +650,7 @@ use_double: } "a:" uiv ":" "{" { - php_int_t elements = parse_iv(start + 2); + zend_long elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ *p = YYCURSOR; @@ -680,7 +680,7 @@ use_double: object ":" uiv ":" ["] { size_t len, len2, len3, maxlen; - php_int_t elements; + zend_long elements; char *str; zend_string *class_name; zend_class_entry *ce; @@ -724,7 +724,7 @@ object ":" uiv ":" ["] { return 0; } - class_name = STR_INIT(str, len, 0); + class_name = zend_string_init(str, len, 0); do { /* Try to find class directly */ @@ -733,7 +733,7 @@ object ":" uiv ":" ["] { if (ce) { BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); return 0; } break; @@ -741,7 +741,7 @@ object ":" uiv ":" ["] { BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); return 0; } @@ -755,12 +755,12 @@ object ":" uiv ":" ["] { /* Call unserialize callback */ ZVAL_STRING(&user_func, PG(unserialize_callback_func)); - ZVAL_STR(&args[0], STR_COPY(class_name)); + ZVAL_STR(&args[0], zend_string_copy(class_name)); BG(serialize_lock)++; if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) { BG(serialize_lock)--; if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -775,7 +775,7 @@ object ":" uiv ":" ["] { BG(serialize_lock)--; zval_ptr_dtor(&retval); if (EG(exception)) { - STR_RELEASE(class_name); + zend_string_release(class_name); zval_ptr_dtor(&user_func); zval_ptr_dtor(&args[0]); return 0; @@ -803,7 +803,7 @@ object ":" uiv ":" ["] { if (ret && incomplete_class) { php_store_class_name(rval, class_name->val, len2); } - STR_RELEASE(class_name); + zend_string_release(class_name); return ret; } @@ -812,7 +812,7 @@ object ":" uiv ":" ["] { if (incomplete_class) { php_store_class_name(rval, class_name->val, len2); } - STR_RELEASE(class_name); + zend_string_release(class_name); return object_common2(UNSERIALIZE_PASSTHRU, elements); } diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index 85085b0b97..9eb3829a08 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -221,7 +221,7 @@ PHP_FUNCTION(version_compare) } compare = php_version_compare(v1, v2); if (argc == 2) { - RETURN_INT(compare); + RETURN_LONG(compare); } if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { RETURN_BOOL(compare == -1); diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 56244ec343..e6bb6a0a23 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -281,8 +281,8 @@ static void _free_sybase_result(sybase_result *result) if (result->fields) { for (i=0; i<result->num_fields; i++) { - STR_FREE(result->fields[i].name); - STR_FREE(result->fields[i].column_source); + zend_string_free(result->fields[i].name); + zend_string_free(result->fields[i].column_source); } efree(result->fields); } @@ -390,7 +390,7 @@ static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONN if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Client message: %s (severity %ld)", errmsg->msgstring, (long)CS_SEVERITY(errmsg->msgnumber)); } - STR_FREE(SybCtG(server_message)); + zend_string_free(SybCtG(server_message)); SybCtG(server_message) = estrdup(errmsg->msgstring); @@ -419,19 +419,19 @@ static int _call_message_handler(zval *callback_name, CS_SERVERMSG *srvmsg TSRML /* Build arguments */ MAKE_STD_ZVAL(msgnumber); - ZVAL_INT(msgnumber, srvmsg->msgnumber); + ZVAL_LONG(msgnumber, srvmsg->msgnumber); args[0] = &msgnumber; MAKE_STD_ZVAL(severity); - ZVAL_INT(severity, srvmsg->severity); + ZVAL_LONG(severity, srvmsg->severity); args[1] = &severity; MAKE_STD_ZVAL(state); - ZVAL_INT(state, srvmsg->state); + ZVAL_LONG(state, srvmsg->state); args[2] = &state; MAKE_STD_ZVAL(line); - ZVAL_INT(line, srvmsg->line); + ZVAL_LONG(line, srvmsg->line); args[3] = &line; MAKE_STD_ZVAL(text); @@ -470,7 +470,7 @@ static CS_RETCODE CS_PUBLIC _server_message_handler(CS_CONTEXT *context, CS_CONN TSRMLS_FETCH(); /* Remember the last server message in any case */ - STR_FREE(SybCtG(server_message)); + zend_string_free(SybCtG(server_message)); SybCtG(server_message) = estrdup(srvmsg->text); /* Retrieve sybase link */ @@ -559,7 +559,7 @@ static PHP_GINIT_FUNCTION(sybase) * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. */ - if (cfg_get_int("sybct.timeout", &opt)==SUCCESS) { + if (cfg_get_long("sybct.timeout", &opt)==SUCCESS) { CS_INT cs_timeout = opt; if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update the timeout"); @@ -620,7 +620,7 @@ PHP_RSHUTDOWN_FUNCTION(sybase) zval_ptr_dtor(&SybCtG(callback_name)); SybCtG(callback_name)= NULL; } - STR_FREE(SybCtG(server_message)); + zend_string_free(SybCtG(server_message)); SybCtG(server_message) = NULL; return SUCCESS; } @@ -678,7 +678,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } } - if (cfg_get_int("sybct.packet_size", &packetsize) == SUCCESS) { + if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize"); } @@ -864,7 +864,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link, &type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_IVAL_P(return_value) = SybCtG(default_link) = link; + Z_LVAL_P(return_value) = SybCtG(default_link) = link; Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; @@ -889,7 +889,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { ct_close(sybase_ptr->connection, CS_UNUSED); @@ -901,7 +901,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) SybCtG(num_links)++; } efree(hashed_details); - SybCtG(default_link)=Z_IVAL_P(return_value); + SybCtG(default_link)=Z_LVAL_P(return_value); zend_list_addref(SybCtG(default_link)); } @@ -1225,7 +1225,7 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS switch (result->numerics[j]) { case 1: { /* This indicates a long */ - ZVAL_INT(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); + ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); break; } @@ -1238,14 +1238,14 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS case 3: { /* This indicates either a long or a float, which ever fits */ errno = 0; - Z_IVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); + Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); if (errno == ERANGE) { /* An overflow occurred, so try to fit it into a double */ RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); break; } - Z_TYPE(result->data[i][j]) = IS_INT; + Z_TYPE(result->data[i][j]) = IS_LONG; break; } @@ -1469,7 +1469,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) /* Get the resultset and free it */ ALLOC_ZVAL(tmp); - Z_IVAL_P(tmp)= sybase_ptr->active_result_index; + Z_LVAL_P(tmp)= sybase_ptr->active_result_index; Z_TYPE_P(tmp)= IS_RESOURCE; INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); @@ -1701,7 +1701,7 @@ PHP_FUNCTION(sybase_free_result) php_sybase_finish_results(result TSRMLS_CC); } - zend_list_delete(Z_IVAL_P(sybase_result_index)); + zend_list_delete(Z_LVAL_P(sybase_result_index)); RETURN_TRUE; } @@ -1727,8 +1727,8 @@ PHP_FUNCTION(sybase_num_rows) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_IVAL_P(return_value) = result->num_rows; - Z_TYPE_P(return_value) = IS_INT; + Z_LVAL_P(return_value) = result->num_rows; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1745,8 +1745,8 @@ PHP_FUNCTION(sybase_num_fields) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_IVAL_P(return_value) = result->num_fields; - Z_TYPE_P(return_value) = IS_INT; + Z_LVAL_P(return_value) = result->num_fields; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ @@ -1867,7 +1867,7 @@ PHP_FUNCTION(sybase_fetch_object) zend_class_entry **pce = NULL; convert_to_string(object); - if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Class %s has not been declared", Z_STRVAL_P(object)); /* Use default (ZEND_STANDARD_CLASS_DEF_PTR) */ } else { @@ -2002,9 +2002,9 @@ PHP_FUNCTION(sybase_fetch_field) object_init(return_value); add_property_string(return_value, "name", result->fields[field_offset].name); - add_property_int(return_value, "max_length", result->fields[field_offset].max_length); + add_property_long(return_value, "max_length", result->fields[field_offset].max_length); add_property_string(return_value, "column_source", result->fields[field_offset].column_source); - add_property_int(return_value, "numeric", result->fields[field_offset].numeric); + add_property_long(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -2077,7 +2077,7 @@ PHP_FUNCTION(sybase_result) } default: convert_to_int(field); - field_offset = Z_IVAL_P(field); + field_offset = Z_LVAL_P(field); if (field_offset < 0 || field_offset >= result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset specified"); RETURN_FALSE; @@ -2110,8 +2110,8 @@ PHP_FUNCTION(sybase_affected_rows) ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink); - Z_IVAL_P(return_value) = sybase_ptr->affected_rows; - Z_TYPE_P(return_value) = IS_INT; + Z_LVAL_P(return_value) = sybase_ptr->affected_rows; + Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h index 033a89cfb6..53ac7fc0ee 100644 --- a/ext/sysvmsg/php_sysvmsg.h +++ b/ext/sysvmsg/php_sysvmsg.h @@ -52,11 +52,11 @@ PHP_FUNCTION(msg_queue_exists); typedef struct { key_t key; - php_int_t id; + zend_long id; } sysvmsg_queue_t; struct php_msgbuf { - php_int_t mtype; + zend_long mtype; char mtext[1]; }; diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index afeffcc092..4c63d1902d 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -130,11 +130,11 @@ static void sysvmsg_release(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(sysvmsg) { le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg queue", module_number); - REGISTER_INT_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); - REGISTER_INT_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); + REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); return SUCCESS; } /* }}} */ @@ -172,19 +172,19 @@ PHP_FUNCTION(msg_set_queue) /* now pull out members of data and set them in the stat buffer */ if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid") - 1)) != NULL) { convert_to_int_ex(item); - stat.msg_perm.uid = Z_IVAL_P(item); + stat.msg_perm.uid = Z_LVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid") - 1)) != NULL) { convert_to_int_ex(item); - stat.msg_perm.gid = Z_IVAL_P(item); + stat.msg_perm.gid = Z_LVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode") - 1)) != NULL) { convert_to_int_ex(item); - stat.msg_perm.mode = Z_IVAL_P(item); + stat.msg_perm.mode = Z_LVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes") - 1)) != NULL) { convert_to_int_ex(item); - stat.msg_qbytes = Z_IVAL_P(item); + stat.msg_qbytes = Z_LVAL_P(item); } if (msgctl(mq->id, IPC_SET, &stat) == 0) { RETVAL_TRUE; @@ -212,16 +212,16 @@ PHP_FUNCTION(msg_stat_queue) if (msgctl(mq->id, IPC_STAT, &stat) == 0) { array_init(return_value); - add_assoc_int(return_value, "msg_perm.uid", stat.msg_perm.uid); - add_assoc_int(return_value, "msg_perm.gid", stat.msg_perm.gid); - add_assoc_int(return_value, "msg_perm.mode", stat.msg_perm.mode); - add_assoc_int(return_value, "msg_stime", stat.msg_stime); - add_assoc_int(return_value, "msg_rtime", stat.msg_rtime); - add_assoc_int(return_value, "msg_ctime", stat.msg_ctime); - add_assoc_int(return_value, "msg_qnum", stat.msg_qnum); - add_assoc_int(return_value, "msg_qbytes", stat.msg_qbytes); - add_assoc_int(return_value, "msg_lspid", stat.msg_lspid); - add_assoc_int(return_value, "msg_lrpid", stat.msg_lrpid); + add_assoc_long(return_value, "msg_perm.uid", stat.msg_perm.uid); + add_assoc_long(return_value, "msg_perm.gid", stat.msg_perm.gid); + add_assoc_long(return_value, "msg_perm.mode", stat.msg_perm.mode); + add_assoc_long(return_value, "msg_stime", stat.msg_stime); + add_assoc_long(return_value, "msg_rtime", stat.msg_rtime); + add_assoc_long(return_value, "msg_ctime", stat.msg_ctime); + add_assoc_long(return_value, "msg_qnum", stat.msg_qnum); + add_assoc_long(return_value, "msg_qbytes", stat.msg_qbytes); + add_assoc_long(return_value, "msg_lspid", stat.msg_lspid); + add_assoc_long(return_value, "msg_lrpid", stat.msg_lrpid); } } /* }}} */ @@ -230,9 +230,9 @@ PHP_FUNCTION(msg_stat_queue) Check whether a message queue exists */ PHP_FUNCTION(msg_queue_exists) { - php_int_t key; + zend_long key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &key) == FAILURE) { return; } @@ -248,11 +248,11 @@ PHP_FUNCTION(msg_queue_exists) Attach to a message queue */ PHP_FUNCTION(msg_get_queue) { - php_int_t key; - php_int_t perms = 0666; + zend_long key; + zend_long perms = 0666; sysvmsg_queue_t *mq; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &key, &perms) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &key, &perms) == FAILURE) { return; } @@ -299,8 +299,8 @@ PHP_FUNCTION(msg_remove_queue) PHP_FUNCTION(msg_receive) { zval *out_message, *queue, *out_msgtype, *zerrcode = NULL; - php_int_t desiredmsgtype, maxsize, flags = 0; - php_int_t realflags = 0; + zend_long desiredmsgtype, maxsize, flags = 0; + zend_long realflags = 0; zend_bool do_unserialize = 1; sysvmsg_queue_t *mq = NULL; struct php_msgbuf *messagebuffer = NULL; /* buffer to transmit */ @@ -308,7 +308,7 @@ PHP_FUNCTION(msg_receive) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/iz/|biz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/lz/|blz/", &queue, &desiredmsgtype, &out_msgtype, &maxsize, &out_message, &do_unserialize, &flags, &zerrcode) == FAILURE) { return; @@ -344,18 +344,18 @@ PHP_FUNCTION(msg_receive) zval_dtor(out_msgtype); zval_dtor(out_message); - ZVAL_INT(out_msgtype, 0); + ZVAL_LONG(out_msgtype, 0); ZVAL_FALSE(out_message); if (zerrcode) { ZVAL_DEREF(zerrcode); zval_dtor(zerrcode); - ZVAL_INT(zerrcode, 0); + ZVAL_LONG(zerrcode, 0); } if (result >= 0) { /* got it! */ - ZVAL_INT(out_msgtype, messagebuffer->mtype); + ZVAL_LONG(out_msgtype, messagebuffer->mtype); RETVAL_TRUE; if (do_unserialize) { @@ -375,7 +375,7 @@ PHP_FUNCTION(msg_receive) ZVAL_STRINGL(out_message, messagebuffer->mtext, result); } } else if (zerrcode) { - ZVAL_INT(zerrcode, errno); + ZVAL_LONG(zerrcode, errno); } efree(messagebuffer); } @@ -386,7 +386,7 @@ PHP_FUNCTION(msg_receive) PHP_FUNCTION(msg_send) { zval *message, *queue, *zerror=NULL; - php_int_t msgtype; + zend_long msgtype; zend_bool do_serialize = 1, blocking = 1; sysvmsg_queue_t * mq = NULL; struct php_msgbuf * messagebuffer = NULL; /* buffer to transmit */ @@ -395,7 +395,7 @@ PHP_FUNCTION(msg_send) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz|bbz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz|bbz/", &queue, &msgtype, &message, &do_serialize, &blocking, &zerror) == FAILURE) { return; } @@ -421,11 +421,11 @@ PHP_FUNCTION(msg_send) switch (Z_TYPE_P(message)) { case IS_STRING: p = Z_STRVAL_P(message); - message_len = Z_STRSIZE_P(message); + message_len = Z_STRLEN_P(message); break; - case IS_INT: - message_len = spprintf(&p, 0, "%pd", Z_IVAL_P(message)); + case IS_LONG: + message_len = spprintf(&p, 0, "%pd", Z_LVAL_P(message)); break; case IS_FALSE: message_len = spprintf(&p, 0, "0"); @@ -459,7 +459,7 @@ PHP_FUNCTION(msg_send) if (result == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "msgsnd failed: %s", strerror(errno)); if (zerror) { - ZVAL_INT(zerror, errno); + ZVAL_LONG(zerror, errno); } } else { RETVAL_TRUE; diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index cdf596acc0..6f7948519e 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -187,13 +187,13 @@ PHP_MINIT_FUNCTION(sysvsem) Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */ PHP_FUNCTION(sem_get) { - php_int_t key, max_acquire = 1, perm = 0666, auto_release = 1; + zend_long key, max_acquire = 1, perm = 0666, auto_release = 1; int semid; struct sembuf sop[3]; int count; sysvsem_sem *sem_ptr; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|iii", &key, &max_acquire, &perm, &auto_release)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) { RETURN_FALSE; } @@ -309,7 +309,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire) ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semaphore", php_sysvsem_module.le_sem); if (!acquire && sem_ptr->count == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_IVAL_P(arg_id), sem_ptr->key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key); RETURN_FALSE; } @@ -374,7 +374,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_IVAL_P(arg_id)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_LVAL_P(arg_id)); RETURN_FALSE; } @@ -383,7 +383,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_IVAL_P(arg_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_LVAL_P(arg_id), strerror(errno)); RETURN_FALSE; } diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h index 359c9f7ae2..0d174002b1 100644 --- a/ext/sysvshm/php_sysvshm.h +++ b/ext/sysvshm/php_sysvshm.h @@ -34,27 +34,27 @@ extern zend_module_entry sysvshm_module_entry; typedef struct { int le_shm; - php_int_t init_mem; + zend_long init_mem; } sysvshm_module; typedef struct { - php_int_t key; - php_int_t length; - php_int_t next; + zend_long key; + zend_long length; + zend_long next; char mem; } sysvshm_chunk; typedef struct { char magic[8]; - php_int_t start; - php_int_t end; - php_int_t free; - php_int_t total; + zend_long start; + zend_long end; + zend_long free; + zend_long total; } sysvshm_chunk_head; typedef struct { key_t key; /* key set by user */ - php_int_t id; /* returned by shmget */ + zend_long id; /* returned by shmget */ sysvshm_chunk_head *ptr; /* memory address of shared memory */ } sysvshm_shm; diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index 97fa4df8d7..2a0d0e8246 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -116,9 +116,9 @@ ZEND_GET_MODULE(sysvshm) THREAD_LS sysvshm_module php_sysvshm; -static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len); -static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key); -static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos); +static int php_put_shm_data(sysvshm_chunk_head *ptr, zend_long key, const char *data, zend_long len); +static zend_long php_check_shm_data(sysvshm_chunk_head *ptr, zend_long key); +static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos); /* {{{ php_release_sysvshm */ @@ -136,7 +136,7 @@ PHP_MINIT_FUNCTION(sysvshm) { php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, PHP_SHM_RSRC_NAME, module_number); - if (cfg_get_int("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { + if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { php_sysvshm.init_mem=10000; } return SUCCESS; @@ -150,9 +150,9 @@ PHP_FUNCTION(shm_attach) sysvshm_shm *shm_list_ptr; char *shm_ptr; sysvshm_chunk_head *chunk_ptr; - php_int_t shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666; + zend_long shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &shm_key, &shm_size, &shm_flag)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &shm_key, &shm_size, &shm_flag)) { return; } @@ -229,7 +229,7 @@ PHP_FUNCTION(shm_remove) SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_IVAL_P(shm_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno)); RETURN_FALSE; } @@ -243,12 +243,12 @@ PHP_FUNCTION(shm_put_var) { zval *shm_id, *arg_var; int ret; - php_int_t shm_key; + zend_long shm_key; sysvshm_shm *shm_list_ptr; smart_str shm_var = {0}; php_serialize_data_t var_hash; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &shm_id, &shm_key, &arg_var)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &shm_id, &shm_key, &arg_var)) { return; } @@ -282,14 +282,14 @@ PHP_FUNCTION(shm_put_var) PHP_FUNCTION(shm_get_var) { zval *shm_id; - php_int_t shm_key; + zend_long shm_key; sysvshm_shm *shm_list_ptr; char *shm_data; - php_int_t shm_varpos; + zend_long shm_varpos; sysvshm_chunk *shm_var; php_unserialize_data_t var_hash; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -319,10 +319,10 @@ PHP_FUNCTION(shm_get_var) PHP_FUNCTION(shm_has_var) { zval *shm_id; - php_int_t shm_key; + zend_long shm_key; sysvshm_shm *shm_list_ptr; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -335,10 +335,10 @@ PHP_FUNCTION(shm_has_var) PHP_FUNCTION(shm_remove_var) { zval *shm_id; - php_int_t shm_key, shm_varpos; + zend_long shm_key, shm_varpos; sysvshm_shm *shm_list_ptr; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -356,13 +356,13 @@ PHP_FUNCTION(shm_remove_var) /* {{{ php_put_shm_data * inserts an ascii-string into shared memory */ -static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len) +static int php_put_shm_data(sysvshm_chunk_head *ptr, zend_long key, const char *data, zend_long len) { sysvshm_chunk *shm_var; - php_int_t total_size; - php_int_t shm_varpos; + zend_long total_size; + zend_long shm_varpos; - total_size = ((php_int_t) (len + sizeof(sysvshm_chunk) - 1) / sizeof(php_int_t)) * sizeof(php_int_t) + sizeof(php_int_t); /* php_int_t alligment */ + total_size = ((zend_long) (len + sizeof(sysvshm_chunk) - 1) / sizeof(zend_long)) * sizeof(zend_long) + sizeof(zend_long); /* zend_long alligment */ if ((shm_varpos = php_check_shm_data(ptr, key)) > 0) { php_remove_shm_data(ptr, shm_varpos); @@ -385,9 +385,9 @@ static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char * /* {{{ php_check_shm_data */ -static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key) +static zend_long php_check_shm_data(sysvshm_chunk_head *ptr, zend_long key) { - php_int_t pos; + zend_long pos; sysvshm_chunk *shm_var; pos = ptr->start; @@ -412,10 +412,10 @@ static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key) /* {{{ php_remove_shm_data */ -static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos) +static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos) { sysvshm_chunk *chunk_ptr, *next_chunk_ptr; - php_int_t memcpy_len; + zend_long memcpy_len; chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos); next_chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos + chunk_ptr->next); diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 84425950a8..ed7f00715b 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -98,8 +98,8 @@ tidy_object_handlers_ ## name.clone_obj = NULL; \ } -#define TIDY_TAG_CONST(tag) REGISTER_INT_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) -#define TIDY_NODE_CONST(name, type) REGISTER_INT_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) +#define TIDY_TAG_CONST(tag) REGISTER_LONG_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) +#define TIDY_NODE_CONST(name, type) REGISTER_LONG_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) #ifndef TRUE #define TRUE 1 @@ -134,7 +134,7 @@ #define ADD_PROPERTY_LONG(_table, _key, _long) \ { \ zval tmp; \ - ZVAL_INT(&tmp, _long); \ + ZVAL_LONG(&tmp, _long); \ zend_hash_str_update(_table, #_key, sizeof(#_key) - 1, &tmp); \ } @@ -524,21 +524,21 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS break; case TidyInteger: - if (Z_TYPE(conv) != IS_INT) { + if (Z_TYPE(conv) != IS_LONG) { zval_copy_ctor(&conv); convert_to_int(&conv); } - if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_IVAL(conv))) { + if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) { return SUCCESS; } break; case TidyBoolean: - if (Z_TYPE(conv) != IS_INT) { + if (Z_TYPE(conv) != IS_LONG) { zval_copy_ctor(&conv); convert_to_int(&conv); } - if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_IVAL(conv))) { + if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_LVAL(conv))) { return SUCCESS; } break; @@ -627,7 +627,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil } if (is_file) { - STR_RELEASE(data); + zend_string_release(data); } tidyBufFree(errbuf); @@ -734,8 +734,8 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch (type) { - case IS_INT: - ZVAL_INT(out, 0); + case IS_LONG: + ZVAL_LONG(out, 0); break; case IS_DOUBLE: @@ -767,8 +767,8 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch(type) { - case IS_INT: - ZVAL_INT(out, 0); + case IS_LONG: + ZVAL_LONG(out, 0); break; case IS_DOUBLE: @@ -1264,7 +1264,7 @@ static PHP_FUNCTION(tidy_parse_file) RETVAL_FALSE; } - STR_RELEASE(contents); + zend_string_release(contents); } /* }}} */ @@ -1396,7 +1396,7 @@ static PHP_FUNCTION(tidy_get_config) break; case TidyInteger: - add_assoc_int(return_value, opt_name, (long)opt_value); + add_assoc_long(return_value, opt_name, (long)opt_value); break; case TidyBoolean: @@ -1415,7 +1415,7 @@ static PHP_FUNCTION(tidy_get_status) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyStatus(obj->ptdoc->doc)); + RETURN_LONG(tidyStatus(obj->ptdoc->doc)); } /* }}} */ @@ -1425,7 +1425,7 @@ static PHP_FUNCTION(tidy_get_html_ver) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyDetectedHtmlVersion(obj->ptdoc->doc)); + RETURN_LONG(tidyDetectedHtmlVersion(obj->ptdoc->doc)); } /* }}} */ @@ -1455,7 +1455,7 @@ static PHP_FUNCTION(tidy_error_count) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyErrorCount(obj->ptdoc->doc)); + RETURN_LONG(tidyErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1465,7 +1465,7 @@ static PHP_FUNCTION(tidy_warning_count) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyWarningCount(obj->ptdoc->doc)); + RETURN_LONG(tidyWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1475,7 +1475,7 @@ static PHP_FUNCTION(tidy_access_count) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyAccessWarningCount(obj->ptdoc->doc)); + RETURN_LONG(tidyAccessWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1485,7 +1485,7 @@ static PHP_FUNCTION(tidy_config_count) { TIDY_FETCH_OBJECT; - RETURN_INT(tidyConfigErrorCount(obj->ptdoc->doc)); + RETURN_LONG(tidyConfigErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1529,7 +1529,7 @@ static PHP_FUNCTION(tidy_getopt) return; case TidyInteger: - RETURN_INT((long)optval); + RETURN_LONG((long)optval); break; case TidyBoolean: @@ -1577,7 +1577,7 @@ static TIDY_DOC_METHOD(__construct) php_tidy_parse_string(obj, contents->val, contents->len, enc TSRMLS_CC); - STR_RELEASE(contents); + zend_string_release(contents); } } @@ -1612,7 +1612,7 @@ static TIDY_DOC_METHOD(parseFile) RETVAL_TRUE; } - STR_RELEASE(contents); + zend_string_release(contents); } static TIDY_DOC_METHOD(parseString) diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index be0b6a302a..1847b0537d 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -131,7 +131,7 @@ static void tokenize(zval *return_value TSRMLS_DC) if (token_type >= 256) { array_init(&keyword); - add_next_index_int(&keyword, token_type); + add_next_index_long(&keyword, token_type); if (token_type == T_END_HEREDOC) { if (CG(increment_lineno)) { token_line = ++CG(zend_lineno); @@ -139,7 +139,7 @@ static void tokenize(zval *return_value TSRMLS_DC) } } add_next_index_stringl(&keyword, (char *)zendtext, zendleng); - add_next_index_int(&keyword, token_line); + add_next_index_long(&keyword, token_line); add_next_index_zval(return_value, &keyword); } else { add_next_index_stringl(return_value, (char *)zendtext, zendleng); @@ -158,9 +158,9 @@ static void tokenize(zval *return_value TSRMLS_DC) // fetch the rest into a T_INLINE_HTML if (zendcursor != zendlimit) { array_init(&keyword); - add_next_index_int(&keyword, T_INLINE_HTML); + add_next_index_long(&keyword, T_INLINE_HTML); add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor); - add_next_index_int(&keyword, token_line); + add_next_index_long(&keyword, token_line); add_next_index_zval(return_value, &keyword); } break; @@ -185,7 +185,7 @@ PHP_FUNCTION(token_get_all) return; } - ZVAL_STR(&source_zval, STR_COPY(source)); + ZVAL_STR(&source_zval, zend_string_copy(source)); zend_save_lexical_state(&original_lex_state TSRMLS_CC); if (zend_prepare_string_for_scanning(&source_zval, "" TSRMLS_CC) == FAILURE) { @@ -206,9 +206,9 @@ PHP_FUNCTION(token_get_all) */ PHP_FUNCTION(token_name) { - php_int_t type; + zend_long type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { return; } diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index b797518ed7..beb9ea8e5b 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -29,139 +29,139 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { - REGISTER_INT_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); } char *get_token_type_name(int token_type) diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index e0cde68cc1..e141a02688 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -275,7 +275,7 @@ PS_SERIALIZER_ENCODE_FUNC(wddx) php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); php_wddx_packet_end(packet); smart_str_0(packet); - str = STR_COPY(packet->s); + str = zend_string_copy(packet->s); php_wddx_destructor(packet); return str; @@ -300,15 +300,15 @@ PS_SERIALIZER_DECODE_FUNC(wddx) if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { if (key == NULL) { - key = zend_int_to_str(idx); + key = zend_longo_str(idx); } else { - STR_ADDREF(key); + zend_string_addref(key); } if (php_set_session_var(key, ent, NULL TSRMLS_CC)) { if (Z_REFCOUNTED_P(ent)) Z_ADDREF_P(ent); } PS_ADD_VAR(key); - STR_RELEASE(key); + zend_string_release(key); } ZEND_HASH_FOREACH_END(); } @@ -389,14 +389,14 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC) { php_wddx_add_chunk_static(packet, WDDX_STRING_S); - if (Z_STRSIZE_P(var) > 0) { + if (Z_STRLEN_P(var) > 0) { zend_string *buf; - buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); + buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); php_wddx_add_chunk_ex(packet, buf->val, buf->len); - STR_RELEASE(buf); + zend_string_release(buf); } php_wddx_add_chunk_static(packet, WDDX_STRING_E); } @@ -508,13 +508,13 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) zend_string *tmp; zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name); - tmp = STR_INIT(prop_name, strlen(prop_name), 0); + tmp = zend_string_init(prop_name, strlen(prop_name), 0); php_wddx_serialize_var(packet, ent, tmp TSRMLS_CC); - STR_RELEASE(tmp); + zend_string_release(tmp); } else { - key = zend_int_to_str(idx); + key = zend_longo_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); } } ZEND_HASH_FOREACH_END(); php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); @@ -568,9 +568,9 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) if (key) { php_wddx_serialize_var(packet, ent, key TSRMLS_CC); } else { - key = zend_int_to_str(idx); + key = zend_longo_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); } } else { php_wddx_serialize_var(packet, ent, NULL TSRMLS_CC); @@ -600,7 +600,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS snprintf(tmp_buf, name_esc->len + sizeof(WDDX_VAR_S), WDDX_VAR_S, name_esc->val); php_wddx_add_chunk(packet, tmp_buf); efree(tmp_buf); - STR_RELEASE(name_esc); + zend_string_release(name_esc); } if (Z_TYPE_P(var) == IS_INDIRECT) { @@ -612,7 +612,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS php_wddx_serialize_string(packet, var TSRMLS_CC); break; - case IS_INT: + case IS_LONG: case IS_DOUBLE: php_wddx_serialize_number(packet, var); break; @@ -750,7 +750,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_NUMBER; SET_STACK_VARNAME; - ZVAL_INT(&ent.data, 0); + ZVAL_LONG(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp((char *)name, EL_BOOLEAN)) { int i; @@ -854,7 +854,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_DATETIME; SET_STACK_VARNAME; - ZVAL_INT(&ent.data, 0); + ZVAL_LONG(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } } @@ -886,7 +886,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (!strcmp((char *)name, EL_BINARY)) { zend_string *new_str; - new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); + new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); zval_ptr_dtor(&ent1->data); ZVAL_STR(&ent1->data, new_str); } @@ -919,11 +919,11 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (ent1->varname) { if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) && - Z_TYPE(ent1->data) == IS_STRING && Z_STRSIZE(ent1->data)) { + Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data)) { zend_bool incomplete_class = 0; - zend_str_tolower(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); - STR_FORGET_HASH_VAL(Z_STR(ent1->data)); + zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + zend_string_forget_hash_val(Z_STR(ent1->data)); if ((pce = zend_hash_find_ptr(EG(class_table), Z_STR(ent1->data))) == NULL) { incomplete_class = 1; pce = PHP_IC_ENTRY; @@ -938,7 +938,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) zval_add_ref, 0); if (incomplete_class) { - php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); + php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); } /* Clean up old array entry */ @@ -992,13 +992,13 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) switch (ent->type) { case ST_BINARY: case ST_STRING: - if (Z_STRSIZE(ent->data) == 0) { + if (Z_STRLEN(ent->data) == 0) { zval_ptr_dtor(&ent->data); ZVAL_STRINGL(&ent->data, (char *)s, len); } else { - Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRSIZE(ent->data) + len, 0); - memcpy(Z_STRVAL(ent->data) + Z_STRSIZE(ent->data) - len, (char *)s, len); - Z_STRVAL(ent->data)[Z_STRSIZE(ent->data)] = '\0'; + Z_STR(ent->data) = zend_string_realloc(Z_STR(ent->data), Z_STRLEN(ent->data) + len, 0); + memcpy(Z_STRVAL(ent->data) + Z_STRLEN(ent->data) - len, (char *)s, len); + Z_STRVAL(ent->data)[Z_STRLEN(ent->data)] = '\0'; } break; case ST_NUMBER: @@ -1008,9 +1008,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) case ST_BOOLEAN: if (!strcmp((char *)s, "true")) { - Z_IVAL(ent->data) = 1; + Z_LVAL(ent->data) = 1; } else if (!strcmp((char *)s, "false")) { - Z_IVAL(ent->data) = 0; + Z_LVAL(ent->data) = 0; } else { stack->top--; zval_ptr_dtor(&ent->data); @@ -1027,9 +1027,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) memcpy(tmp, (char *)s, len); tmp[len] = '\0'; - Z_IVAL(ent->data) = php_parse_date(tmp, NULL); + Z_LVAL(ent->data) = php_parse_date(tmp, NULL); /* date out of range < 1969 or > 2038 */ - if (Z_IVAL(ent->data) == -1) { + if (Z_LVAL(ent->data) == -1) { ZVAL_STRINGL(&ent->data, (char *)s, len); } efree(tmp); @@ -1097,7 +1097,7 @@ PHP_FUNCTION(wddx_serialize_value) php_wddx_packet_end(packet); smart_str_0(packet); - RETVAL_STR(STR_COPY(packet->s)); + RETVAL_STR(zend_string_copy(packet->s)); php_wddx_destructor(packet); } /* }}} */ @@ -1136,7 +1136,7 @@ PHP_FUNCTION(wddx_serialize_vars) php_wddx_packet_end(packet); smart_str_0(packet); - RETVAL_STR(STR_COPY(packet->s)); + RETVAL_STR(zend_string_copy(packet->s)); php_wddx_destructor(packet); } /* }}} */ @@ -1203,7 +1203,7 @@ PHP_FUNCTION(wddx_packet_end) php_wddx_packet_end(packet); smart_str_0(packet); - RETVAL_STR(STR_COPY(packet->s)); + RETVAL_STR(zend_string_copy(packet->s)); zend_list_close(Z_RES_P(packet_id)); } diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 1ae1f02889..a2bcb105f9 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -314,33 +314,33 @@ PHP_MINIT_FUNCTION(xml) { le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number); - REGISTER_INT_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); /* this object should not be pre-initialised at compile time, as the order of members may vary */ @@ -456,7 +456,7 @@ static void xml_set_handler(zval *handler, zval *data) /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */ if (Z_TYPE_P(data) != IS_ARRAY && Z_TYPE_P(data) != IS_OBJECT) { convert_to_string_ex(data); - if (Z_STRSIZE_P(data) == 0) { + if (Z_STRLEN_P(data) == 0) { ZVAL_UNDEF(handler); return; } @@ -571,12 +571,12 @@ PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *enco if (encoder == NULL) { /* If no encoder function was specified, return the data as-is. */ - str = STR_INIT(s, len, 0); + str = zend_string_init(s, len, 0); return str; } /* This is the theoretical max (will never get beyond len * 2 as long * as we are converting from single-byte characters, though) */ - str = STR_ALLOC(len * 4, 0); + str = zend_string_alloc(len * 4, 0); str->len = 0; while (pos > 0) { c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s); @@ -599,7 +599,7 @@ PHPAPI zend_string *xml_utf8_encode(const char *s, int len, const XML_Char *enco s++; } str->val[str->len] = '\0'; - str = STR_REALLOC(str, str->len, 0); + str = zend_string_realloc(str, str->len, 0); return str; } /* }}} */ @@ -621,11 +621,11 @@ PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char * /* If the target encoding was unknown, or no decoder function * was specified, return the UTF-8-encoded data as-is. */ - str = STR_INIT((char *)s, len, 0); + str = zend_string_init((char *)s, len, 0); return str; } - str = STR_ALLOC(len, 0); + str = zend_string_alloc(len, 0); str->len = 0; while (pos < (size_t)len) { int status = FAILURE; @@ -639,7 +639,7 @@ PHPAPI zend_string *xml_utf8_decode(const XML_Char *s, int len, const XML_Char * } str->val[str->len] = '\0'; if (str->len < len) { - str = STR_REALLOC(str, str->len, 0); + str = zend_string_realloc(str, str->len, 0); } return str; @@ -663,9 +663,9 @@ static int _xml_xmlcharlen(const XML_Char *s) PHPAPI char *_xml_zval_strdup(zval *val) { if (Z_TYPE_P(val) == IS_STRING) { - char *buf = emalloc(Z_STRSIZE_P(val) + 1); - memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)); - buf[Z_STRSIZE_P(val)] = '\0'; + char *buf = emalloc(Z_STRLEN_P(val) + 1); + memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)); + buf[Z_STRLEN_P(val)] = '\0'; return buf; } return NULL; @@ -687,7 +687,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values); } - add_next_index_int(element, parser->curtag); + add_next_index_long(element, parser->curtag); parser->curtag++; } @@ -737,7 +737,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch attributes += 2; - STR_RELEASE(att); + zend_string_release(att); } xml_call_handler(parser, &parser->startElementHandler, parser->startElementPtr, 3, args, &retval); @@ -756,7 +756,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "open"); - add_assoc_int(&tag, "level", parser->level); + add_assoc_long(&tag, "level", parser->level); parser->ltags[parser->level-1] = estrdup(tag_name->val); parser->lastwasopen = 1; @@ -775,7 +775,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch atcnt++; attributes += 2; - STR_RELEASE(att); + zend_string_release(att); } if (atcnt) { @@ -791,7 +791,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch } } - STR_RELEASE(tag_name); + zend_string_release(tag_name); } } /* }}} */ @@ -827,7 +827,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "close"); - add_assoc_int(&tag, "level", parser->level); + add_assoc_long(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } @@ -835,7 +835,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) parser->lastwasopen = 0; } - STR_RELEASE(tag_name); + zend_string_release(tag_name); if ((parser->ltags) && (parser->level <= XML_MAXLEVEL)) { efree(parser->ltags[parser->level-1]); @@ -887,11 +887,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) /* check if the current tag already has a value - if yes append to that! */ if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) { - int newlen = Z_STRSIZE_P(myval) + decoded_value->len; - Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, + int newlen = Z_STRLEN_P(myval) + decoded_value->len; + Z_STR_P(myval) = zend_string_realloc(Z_STR_P(myval), newlen, 0); + strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); - STR_RELEASE(decoded_value); + zend_string_release(decoded_value); } else { add_assoc_str(parser->ctag, "value", decoded_value); } @@ -904,11 +904,11 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) { if (!strcmp(Z_STRVAL_P(mytype), "cdata")) { if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) { - int newlen = Z_STRSIZE_P(myval) + decoded_value->len; - Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, + int newlen = Z_STRLEN_P(myval) + decoded_value->len; + Z_STR_P(myval) = zend_string_realloc(Z_STR_P(myval), newlen, 0); + strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); - STR_RELEASE(decoded_value); + zend_string_release(decoded_value); return; } } @@ -924,7 +924,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) add_assoc_string(&tag, "tag", parser->ltags[parser->level-1] + parser->toffset); add_assoc_str(&tag, "value", decoded_value); add_assoc_string(&tag, "type", "cdata"); - add_assoc_int(&tag, "level", parser->level); + add_assoc_long(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } else if (parser->level == (XML_MAXLEVEL + 1)) { @@ -933,7 +933,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } } } else { - STR_RELEASE(decoded_value); + zend_string_release(decoded_value); } } } @@ -1042,7 +1042,7 @@ int _xml_externalEntityRefHandler(XML_Parser parserPtr, xml_call_handler(parser, &parser->externalEntityRefHandler, parser->externalEntityRefPtr, 5, args, &retval); if (!Z_ISUNDEF(retval)) { convert_to_int(&retval); - ret = Z_IVAL(retval); + ret = Z_LVAL(retval); } else { ret = 0; } @@ -1366,9 +1366,9 @@ PHP_FUNCTION(xml_parse) zval *pind; char *data; int data_len, ret; - php_int_t isFinal = 0; + zend_long isFinal = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pind, &data, &data_len, &isFinal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pind, &data, &data_len, &isFinal) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); @@ -1376,7 +1376,7 @@ PHP_FUNCTION(xml_parse) parser->isparsing = 1; ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal); parser->isparsing = 0; - RETVAL_INT(ret); + RETVAL_LONG(ret); } /* }}} */ @@ -1422,7 +1422,7 @@ PHP_FUNCTION(xml_parse_into_struct) ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, 1); parser->isparsing = 0; - RETVAL_INT(ret); + RETVAL_LONG(ret); } /* }}} */ @@ -1439,7 +1439,7 @@ PHP_FUNCTION(xml_get_error_code) ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETURN_INT((long)XML_GetErrorCode(parser->parser)); + RETURN_LONG((long)XML_GetErrorCode(parser->parser)); } /* }}} */ @@ -1447,10 +1447,10 @@ PHP_FUNCTION(xml_get_error_code) Get XML parser error string */ PHP_FUNCTION(xml_error_string) { - php_int_t code; + zend_long code; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { return; } @@ -1474,7 +1474,7 @@ PHP_FUNCTION(xml_get_current_line_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_INT(XML_GetCurrentLineNumber(parser->parser)); + RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser)); } /* }}} */ @@ -1491,7 +1491,7 @@ PHP_FUNCTION(xml_get_current_column_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_INT(XML_GetCurrentColumnNumber(parser->parser)); + RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser)); } /* }}} */ @@ -1508,7 +1508,7 @@ PHP_FUNCTION(xml_get_current_byte_index) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_INT(XML_GetCurrentByteIndex(parser->parser)); + RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser)); } /* }}} */ @@ -1544,9 +1544,9 @@ PHP_FUNCTION(xml_parser_set_option) { xml_parser *parser; zval *pind, *val; - php_int_t opt; + zend_long opt; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &pind, &opt, &val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &pind, &opt, &val) == FAILURE) { return; } @@ -1555,15 +1555,15 @@ PHP_FUNCTION(xml_parser_set_option) switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: convert_to_int_ex(val); - parser->case_folding = Z_IVAL_P(val); + parser->case_folding = Z_LVAL_P(val); break; case PHP_XML_OPTION_SKIP_TAGSTART: convert_to_int_ex(val); - parser->toffset = Z_IVAL_P(val); + parser->toffset = Z_LVAL_P(val); break; case PHP_XML_OPTION_SKIP_WHITE: convert_to_int_ex(val); - parser->skipwhite = Z_IVAL_P(val); + parser->skipwhite = Z_LVAL_P(val); break; case PHP_XML_OPTION_TARGET_ENCODING: { xml_encoding *enc; @@ -1591,16 +1591,16 @@ PHP_FUNCTION(xml_parser_get_option) { xml_parser *parser; zval *pind; - php_int_t opt; + zend_long opt; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pind, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pind, &opt) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: - RETURN_INT(parser->case_folding); + RETURN_LONG(parser->case_folding); break; case PHP_XML_OPTION_TARGET_ENCODING: RETURN_STRING((char *)parser->target_encoding); diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 79d41065cf..0b55caa357 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -100,8 +100,8 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl case IS_FALSE: ZVAL_BOOL(rv, retint); break; - case IS_INT: - ZVAL_INT(rv, retint); + case IS_LONG: + ZVAL_LONG(rv, retint); break; default: ZVAL_NULL(rv); @@ -561,11 +561,11 @@ Get value of an attribute at index from current element */ PHP_METHOD(xmlreader, getAttributeNo) { zval *id; - php_int_t attr_pos; + zend_long attr_pos; char *retchar = NULL; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) { return; } @@ -618,11 +618,11 @@ Indicates whether given property (one of the parser option constants) is set or PHP_METHOD(xmlreader, getParserProperty) { zval *id; - php_int_t property; + zend_long property; int retval = -1; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &property) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) { return; } @@ -697,11 +697,11 @@ Returns TRUE on success and FALSE on failure */ PHP_METHOD(xmlreader, moveToAttributeNo) { zval *id; - php_int_t attr_pos; + zend_long attr_pos; int retval; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) { return; } @@ -847,14 +847,14 @@ PHP_METHOD(xmlreader, open) { zval *id; int source_len = 0, encoding_len = 0; - php_int_t options = 0; + zend_long options = 0; xmlreader_object *intern = NULL; char *source, *valid_file = NULL; char *encoding = NULL; char resolved_path[MAXPATHLEN + 1]; xmlTextReaderPtr reader = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { return; } @@ -978,12 +978,12 @@ Properties must be set after open() or XML() and before the first read() is call PHP_METHOD(xmlreader, setParserProperty) { zval *id; - php_int_t property; + zend_long property; int retval = -1; zend_bool value; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &property, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) { return; } @@ -1030,7 +1030,7 @@ PHP_METHOD(xmlreader, XML) { zval *id; int source_len = 0, encoding_len = 0; - php_int_t options = 0; + zend_long options = 0; xmlreader_object *intern = NULL; char *source, *uri = NULL, *encoding = NULL; int resolved_path_len, ret = 0; @@ -1038,7 +1038,7 @@ PHP_METHOD(xmlreader, XML) xmlParserInputBufferPtr inputbfr; xmlTextReaderPtr reader; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { return; } @@ -1313,9 +1313,9 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&xmlreader_prop_handlers, 0, NULL, php_xmlreader_free_prop_handler, 1); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_INT TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderConstBaseUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_INT TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_LONG TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasAttributes", xmlTextReaderHasAttributes, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasValue", xmlTextReaderHasValue, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isDefault", xmlTextReaderIsDefault, NULL, IS_FALSE TSRMLS_CC); @@ -1323,43 +1323,43 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_register_prop_handler(&xmlreader_prop_handlers, "localName", NULL, xmlTextReaderConstLocalName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "name", NULL, xmlTextReaderConstName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "namespaceURI", NULL, xmlTextReaderConstNamespaceUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_INT TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_LONG TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "prefix", NULL, xmlTextReaderConstPrefix, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "value", NULL, xmlTextReaderConstValue, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "xmlLang", NULL, xmlTextReaderConstXmlLang, IS_STRING TSRMLS_CC); /* Constants for NodeType - cannot define common types to share with dom as there are differences in these types */ - REGISTER_XMLREADER_CLASS_CONST_INT("NONE", XML_READER_TYPE_NONE); - REGISTER_XMLREADER_CLASS_CONST_INT("ELEMENT", XML_READER_TYPE_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_INT("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); - REGISTER_XMLREADER_CLASS_CONST_INT("TEXT", XML_READER_TYPE_TEXT); - REGISTER_XMLREADER_CLASS_CONST_INT("CDATA", XML_READER_TYPE_CDATA); - REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); - REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY", XML_READER_TYPE_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_INT("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); - REGISTER_XMLREADER_CLASS_CONST_INT("COMMENT", XML_READER_TYPE_COMMENT); - REGISTER_XMLREADER_CLASS_CONST_INT("DOC", XML_READER_TYPE_DOCUMENT); - REGISTER_XMLREADER_CLASS_CONST_INT("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); - REGISTER_XMLREADER_CLASS_CONST_INT("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); - REGISTER_XMLREADER_CLASS_CONST_INT("NOTATION", XML_READER_TYPE_NOTATION); - REGISTER_XMLREADER_CLASS_CONST_INT("WHITESPACE", XML_READER_TYPE_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_INT("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_INT("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_INT("END_ENTITY", XML_READER_TYPE_END_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_INT("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); + REGISTER_XMLREADER_CLASS_CONST_LONG("NONE", XML_READER_TYPE_NONE); + REGISTER_XMLREADER_CLASS_CONST_LONG("ELEMENT", XML_READER_TYPE_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); + REGISTER_XMLREADER_CLASS_CONST_LONG("TEXT", XML_READER_TYPE_TEXT); + REGISTER_XMLREADER_CLASS_CONST_LONG("CDATA", XML_READER_TYPE_CDATA); + REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); + REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY", XML_READER_TYPE_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_LONG("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); + REGISTER_XMLREADER_CLASS_CONST_LONG("COMMENT", XML_READER_TYPE_COMMENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("DOC", XML_READER_TYPE_DOCUMENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); + REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("NOTATION", XML_READER_TYPE_NOTATION); + REGISTER_XMLREADER_CLASS_CONST_LONG("WHITESPACE", XML_READER_TYPE_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_LONG("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_LONG("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("END_ENTITY", XML_READER_TYPE_END_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_LONG("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); /* Constants for Parser options */ - REGISTER_XMLREADER_CLASS_CONST_INT("LOADDTD", XML_PARSER_LOADDTD); - REGISTER_XMLREADER_CLASS_CONST_INT("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); - REGISTER_XMLREADER_CLASS_CONST_INT("VALIDATE", XML_PARSER_VALIDATE); - REGISTER_XMLREADER_CLASS_CONST_INT("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); + REGISTER_XMLREADER_CLASS_CONST_LONG("LOADDTD", XML_PARSER_LOADDTD); + REGISTER_XMLREADER_CLASS_CONST_LONG("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); + REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDATE", XML_PARSER_VALIDATE); + REGISTER_XMLREADER_CLASS_CONST_LONG("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); /* Constants for Errors when loading - not yet used until we implement custom error handling - REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_INT("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_INT("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_LONG("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); */ return SUCCESS; diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h index 1ceb2e1e61..63653213fe 100644 --- a/ext/xmlreader/php_xmlreader.h +++ b/ext/xmlreader/php_xmlreader.h @@ -50,8 +50,8 @@ PHP_MINIT_FUNCTION(xmlreader); PHP_MSHUTDOWN_FUNCTION(xmlreader); PHP_MINFO_FUNCTION(xmlreader); -#define REGISTER_XMLREADER_CLASS_CONST_INT(const_name, value) \ - zend_declare_class_constant_int(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_XMLREADER_CLASS_CONST_LONG(const_name, value) \ + zend_declare_class_constant_long(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #ifdef ZTS #define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v) diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index fe0c794d1d..42430b13df 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -316,8 +316,8 @@ PHP_MINFO_FUNCTION(xmlrpc) */ #if 0 static int add_long(zval* list, char* id, int num) { - if(id) return add_assoc_int(list, id, num); - else return add_next_index_int(list, num); + if(id) return add_assoc_long(list, id, num); + else return add_next_index_long(list, num); } static int add_double(zval* list, char* id, double num) { @@ -342,7 +342,7 @@ static void add_zval(zval* list, const char* id, zval* val) if (list && val) { if (id) { int id_len = strlen(id); - if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_INT) { + if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) { long index = strtol(id, NULL, 0); zend_hash_index_update(Z_ARRVAL_P(list), index, val); } else { @@ -516,7 +516,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep xReturn = XMLRPC_CreateValueEmpty(); XMLRPC_SetValueID(xReturn, key, 0); } else { - xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRSIZE(val)); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val)); } break; case xmlrpc_datetime: @@ -529,7 +529,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep break; case xmlrpc_int: convert_to_int(&val); - xReturn = XMLRPC_CreateValueInt(key, Z_IVAL(val)); + xReturn = XMLRPC_CreateValueInt(key, Z_LVAL(val)); break; case xmlrpc_double: convert_to_double(&val); @@ -537,7 +537,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep break; case xmlrpc_string: convert_to_string(&val); - xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRSIZE(val)); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val)); break; case xmlrpc_vector: { @@ -618,7 +618,7 @@ static void XMLRPC_to_PHP(XMLRPC_VALUE el, zval *elem) } break; case xmlrpc_int: - ZVAL_INT(elem, XMLRPC_GetValueInt(el)); + ZVAL_LONG(elem, XMLRPC_GetValueInt(el)); break; case xmlrpc_boolean: ZVAL_BOOL(elem, XMLRPC_GetValueBoolean(el)); @@ -945,7 +945,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data) } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid callback '%s' passed", php_function_name->val); } - STR_RELEASE(php_function_name); + zend_string_release(php_function_name); } ZEND_HASH_FOREACH_END(); /* so we don't call the same callbacks ever again */ @@ -1130,9 +1130,9 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) if (xDesc) { int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc); XMLRPC_CleanupValue(xDesc); - RETURN_INT(retval); + RETURN_LONG(retval); } - RETURN_INT(0); + RETURN_LONG(0); } /* }}} */ @@ -1276,7 +1276,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ if (timestamp != -1) { zval ztimestamp; - ZVAL_INT(&ztimestamp, timestamp); + ZVAL_LONG(&ztimestamp, timestamp); convert_to_object(value); if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) { @@ -1321,7 +1321,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ #else case IS_BOOL: #endif - case IS_INT: + case IS_LONG: case IS_RESOURCE: type = xmlrpc_int; break; diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index a3d9b59f6e..1520b66947 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -1756,7 +1756,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) xmlBufferEmpty(buffer); } } else { - RETVAL_INT(output_bytes); + RETVAL_LONG(output_bytes); } return; } diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 2b08a8a49b..bda02498ed 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -161,23 +161,23 @@ PHP_MINIT_FUNCTION(xsl) xsl_ext_function_object_php); xsltSetGenericErrorFunc(NULL, php_libxml_error_handler); - REGISTER_INT_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXSLT_DOTTED_VERSION", LIBXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #if HAVE_XSL_EXSLT - REGISTER_INT_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBEXSLT_DOTTED_VERSION", LIBEXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h index e1702ebaa8..375cb32fb0 100644 --- a/ext/xsl/php_xsl.h +++ b/ext/xsl/php_xsl.h @@ -64,7 +64,7 @@ typedef struct _xsl_object { HashTable *node_list; php_libxml_node_object *doc; char *profiling; - php_int_t securityPrefs; + zend_long securityPrefs; int securityPrefsSet; zend_object std; } xsl_object; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 2bf3269b3f..04aef6083e 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -138,7 +138,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS zval *value; char *xpath_expr; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; char **params = NULL; int i = 0; @@ -160,7 +160,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS if (!xpath_params) { xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_P(value) TSRMLS_CC); } else { - xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); + xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); } if (xpath_expr) { params[i++] = estrndup(string_key->val, string_key->len); @@ -351,7 +351,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t nodep = dom_object_get_node(obj); valuePush(ctxt, xmlXPathNewNodeSet(nodep)); } else if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) { - valuePush(ctxt, xmlXPathNewBoolean(Z_IVAL(retval))); + valuePush(ctxt, xmlXPathNewBoolean(Z_LVAL(retval))); } else if (Z_TYPE(retval) == IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string"); valuePush(ctxt, xmlXPathNewString("")); @@ -362,7 +362,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t zval_ptr_dtor(&retval); } } - STR_RELEASE(callable); + zend_string_release(callable); zval_ptr_dtor(&handler); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { @@ -438,7 +438,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) cloneDocu = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(cloneDocu) != IS_NULL) { convert_to_int(cloneDocu); - clone_docu = Z_IVAL_P(cloneDocu); + clone_docu = Z_LVAL_P(cloneDocu); } zval_ptr_dtor(&member); if (clone_docu == 0) { @@ -537,7 +537,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl doXInclude = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(doXInclude) != IS_NULL) { convert_to_int(doXInclude); - ctxt->xinclude = Z_IVAL_P(doXInclude); + ctxt->xinclude = Z_LVAL_P(doXInclude); } zval_ptr_dtor(&member); @@ -715,7 +715,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) xmlFreeDoc(newdocp); } - RETVAL_INT(ret); + RETVAL_LONG(ret); } /* }}} end xsl_xsltprocessor_transform_to_uri */ @@ -765,7 +765,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) zval *id; zval *array_value, *entry, new_string; xsl_object *intern; - php_uint_t idx; + zend_ulong idx; char *namespace; int namespace_len; zend_string *string_key, *name, *value; @@ -790,7 +790,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) intern = Z_XSL_P(id); - ZVAL_STR(&new_string, STR_COPY(value)); + ZVAL_STR(&new_string, zend_string_copy(value)); zend_hash_update(intern->parameter, name, &new_string); RETURN_TRUE; @@ -820,7 +820,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) intern = Z_XSL_P(id); if ((value = zend_hash_find(intern->parameter, name)) != NULL) { convert_to_string_ex(value); - RETURN_STR(STR_COPY(Z_STR_P(value))); + RETURN_STR(zend_string_copy(Z_STR_P(value))); } else { RETURN_FALSE; } @@ -868,7 +868,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); - ZVAL_INT(&new_string ,1); + ZVAL_LONG(&new_string ,1); zend_hash_update(intern->registered_phpfunctions, Z_STR_P(entry), &new_string); } ZEND_HASH_FOREACH_END(); @@ -876,7 +876,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XSL_P(id); - ZVAL_INT(&new_string,1); + ZVAL_LONG(&new_string,1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; @@ -919,10 +919,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) { zval *id; xsl_object *intern; - php_int_t securityPrefs, oldSecurityPrefs; + zend_long securityPrefs, oldSecurityPrefs; DOM_GET_THIS(id); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &securityPrefs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) { return; } intern = Z_XSL_P(id); @@ -930,7 +930,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) intern->securityPrefs = securityPrefs; /* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */ intern->securityPrefsSet = 1; - RETURN_INT(oldSecurityPrefs); + RETURN_LONG(oldSecurityPrefs); } /* }}} end xsl_xsltprocessor_set_security_prefs */ @@ -943,7 +943,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "") == SUCCESS) { intern = Z_XSL_P(id); - RETURN_INT(intern->securityPrefs); + RETURN_LONG(intern->securityPrefs); } else { WRONG_PARAM_COUNT; } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 9fd3e8ce4a..4af78340c4 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -90,7 +90,7 @@ static int le_zip_entry; /* }}} */ # define add_ascii_assoc_string add_assoc_string -# define add_ascii_assoc_long add_assoc_int +# define add_ascii_assoc_long add_assoc_long /* Flatten a path by making a relative path (to .)*/ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ @@ -187,7 +187,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) { efree(file_dirname_fullpath); - STR_RELEASE(file_basename); + zend_string_release(file_basename); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -199,7 +199,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil if (!ret) { efree(file_dirname_fullpath); if (!is_dir_only) { - STR_RELEASE(file_basename); + zend_string_release(file_basename); CWD_STATE_FREE(new_state.cwd); } return 0; @@ -216,13 +216,13 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil len = spprintf(&fullpath, 0, "%s/%s", file_dirname_fullpath, file_basename->val); if (!len) { efree(file_dirname_fullpath); - STR_RELEASE(file_basename); + zend_string_release(file_basename); CWD_STATE_FREE(new_state.cwd); return 0; } else if (len > MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); efree(file_dirname_fullpath); - STR_RELEASE(file_basename); + zend_string_release(file_basename); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -234,7 +234,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil if (ZIP_OPENBASEDIR_CHECKPATH(fullpath)) { efree(fullpath); efree(file_dirname_fullpath); - STR_RELEASE(file_basename); + zend_string_release(file_basename); CWD_STATE_FREE(new_state.cwd); return 0; } @@ -264,7 +264,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil done: efree(fullpath); - STR_RELEASE(file_basename); + zend_string_release(file_basename); efree(file_dirname_fullpath); CWD_STATE_FREE(new_state.cwd); @@ -311,18 +311,18 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam } /* }}} */ -static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */ +static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */ { zval *option; if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) { - php_int_t opt; - if (Z_TYPE_P(option) != IS_INT) { + zend_long opt; + if (Z_TYPE_P(option) != IS_LONG) { zval tmp; ZVAL_DUP(&tmp, option); convert_to_int(&tmp); - opt = Z_IVAL(tmp); + opt = Z_LVAL(tmp); } else { - opt = Z_IVAL_P(option); + opt = Z_LVAL_P(option); } *remove_all_path = opt; } @@ -334,17 +334,17 @@ static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char return -1; } - if (Z_STRSIZE_P(option) < 1) { + if (Z_STRLEN_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as remove_path option"); return -1; } - if (Z_STRSIZE_P(option) >= MAXPATHLEN) { + if (Z_STRLEN_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "remove_path string is too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRSIZE_P(option)); + MAXPATHLEN - 1, Z_STRLEN_P(option)); return -1; } - *remove_path_len = Z_STRSIZE_P(option); + *remove_path_len = Z_STRLEN_P(option); *remove_path = Z_STRVAL_P(option); } @@ -354,26 +354,26 @@ static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char return -1; } - if (Z_STRSIZE_P(option) < 1) { + if (Z_STRLEN_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as the add_path option"); return -1; } - if (Z_STRSIZE_P(option) >= MAXPATHLEN) { + if (Z_STRLEN_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRSIZE_P(option)); + MAXPATHLEN - 1, Z_STRLEN_P(option)); return -1; } - *add_path_len = Z_STRSIZE_P(option); + *add_path_len = Z_STRLEN_P(option); *add_path = Z_STRVAL_P(option); } return 1; } /* }}} */ -/* {{{ REGISTER_ZIP_CLASS_CONST_INT */ -#define REGISTER_ZIP_CLASS_CONST_INT(const_name, value) \ - zend_declare_class_constant_int(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +/* {{{ REGISTER_ZIP_CLASS_CONST_LONG */ +#define REGISTER_ZIP_CLASS_CONST_LONG(const_name, value) \ + zend_declare_class_constant_long(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* }}} */ /* {{{ ZIP_FROM_OBJECT */ @@ -481,7 +481,7 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len TSRMLS_DC) /* #endif /* }}} */ -int php_zip_glob(char *pattern, int pattern_len, php_int_t flags, zval *return_value TSRMLS_DC) /* {{{ */ +int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value TSRMLS_DC) /* {{{ */ { #ifdef HAVE_GLOB char cwd[MAXPATHLEN]; @@ -645,14 +645,14 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val if ((namelist_len == 1 && namelist[i]->val[0] == '.') || (namelist_len == 2 && namelist[i]->val[0] == '.' && namelist[i]->val[1] == '.')) { - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); continue; } if ((path_len + namelist_len + 1) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)", MAXPATHLEN - 1, (path_len + namelist_len + 1)); - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); break; } @@ -660,24 +660,24 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val if (0 != VCWD_STAT(fullpath, &s)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot read <%s>", fullpath); - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); continue; } if (S_IFDIR == (s.st_mode & S_IFMT)) { - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); continue; } matches = pcre_exec(re, NULL, namelist[i]->val, namelist[i]->len, 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); continue; } add_next_index_string(return_value, fullpath); - STR_RELEASE(namelist[i]); + zend_string_release(namelist[i]); } efree(namelist); } @@ -818,8 +818,8 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, case IS_FALSE: ZVAL_BOOL(rv, (long)retint); break; - case IS_INT: - ZVAL_INT(rv, (long)retint); + case IS_LONG: + ZVAL_LONG(rv, (long)retint); break; default: ZVAL_NULL(rv); @@ -1124,7 +1124,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) rsrc_int->za = zip_open(resolved_path, 0, &err); if (rsrc_int->za == NULL) { efree(rsrc_int); - RETURN_INT((long)err); + RETURN_LONG((long)err); } rsrc_int->index_current = 0; @@ -1244,12 +1244,12 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close) static PHP_NAMED_FUNCTION(zif_zip_entry_read) { zval * zip_entry; - php_int_t len = 0; + zend_long len = 0; zip_read_rsrc * zr_rsrc; zend_string *buffer; int n = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zip_entry, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zip_entry, &len) == FAILURE) { return; } @@ -1260,14 +1260,14 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read) } if (zr_rsrc->zf) { - buffer = STR_ALLOC(len, 0); + buffer = zend_string_alloc(len, 0); n = zip_fread(zr_rsrc->zf, buffer->val, buffer->len); if (n > 0) { buffer->val[n] = '\0'; buffer->len = n; RETURN_STR(buffer); } else { - STR_FREE(buffer); + zend_string_free(buffer); RETURN_EMPTY_STRING() } } else { @@ -1296,10 +1296,10 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ RETURN_STRING((char *)zr_rsrc->sb.name); break; case 1: - RETURN_INT((php_int_t) (zr_rsrc->sb.comp_size)); + RETURN_LONG((zend_long) (zr_rsrc->sb.comp_size)); break; case 2: - RETURN_INT((php_int_t) (zr_rsrc->sb.size)); + RETURN_LONG((zend_long) (zr_rsrc->sb.size)); break; case 3: switch (zr_rsrc->sb.comp_method) { @@ -1333,7 +1333,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ default: RETURN_FALSE; } - RETURN_INT((php_int_t) (zr_rsrc->sb.comp_method)); + RETURN_LONG((zend_long) (zr_rsrc->sb.comp_method)); break; } @@ -1378,13 +1378,13 @@ static ZIPARCHIVE_METHOD(open) { struct zip *intern; int err = 0; - php_int_t flags = 0; + zend_long flags = 0; char *resolved_path; zend_string *filename; zval *self = getThis(); ze_zip_object *ze_obj = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &filename, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &filename, &flags) == FAILURE) { return; } @@ -1423,7 +1423,7 @@ static ZIPARCHIVE_METHOD(open) intern = zip_open(resolved_path, flags, &err); if (!intern || err) { efree(resolved_path); - RETURN_INT((php_int_t)err); + RETURN_LONG((zend_long)err); } ze_obj->filename = resolved_path; ze_obj->filename_len = strlen(resolved_path); @@ -1576,8 +1576,8 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* char *remove_path = NULL; char *add_path = NULL; int add_path_len, remove_path_len = 0, path_len = 0; - php_int_t remove_all_path = 0; - php_int_t flags = 0; + zend_long remove_all_path = 0; + zend_long flags = 0; zval *options = NULL; int found; zend_string *pattern; @@ -1589,7 +1589,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* ZIP_FROM_OBJECT(intern, self); /* 1 == glob, 2 == pcre */ if (type == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ia", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|la", &pattern, &flags, &options) == FAILURE) { return; } @@ -1632,15 +1632,15 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(return_value), i)) != NULL) { if (remove_all_path) { - basename = php_basename(Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), NULL, 0 TSRMLS_CC); + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0 TSRMLS_CC); file_stripped = basename->val; file_stripped_len = basename->len; } else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) { file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1; - file_stripped_len = Z_STRSIZE_P(zval_file) - remove_path_len - 1; + file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1; } else { file_stripped = Z_STRVAL_P(zval_file); - file_stripped_len = Z_STRSIZE_P(zval_file); + file_stripped_len = Z_STRLEN_P(zval_file); } if (add_path) { @@ -1656,13 +1656,13 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* entry_name_len = strlen(entry_name); } else { entry_name = Z_STRVAL_P(zval_file); - entry_name_len = Z_STRSIZE_P(zval_file); + entry_name_len = Z_STRLEN_P(zval_file); } if (basename) { - STR_RELEASE(basename); + zend_string_release(basename); basename = NULL; } - if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), + if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), entry_name, entry_name_len, 0, 0 TSRMLS_CC) < 0) { zval_dtor(return_value); RETURN_FALSE; @@ -1697,7 +1697,7 @@ static ZIPARCHIVE_METHOD(addFile) zval *self = getThis(); char *entry_name = NULL; int entry_name_len = 0; - php_int_t offset_start = 0, offset_len = 0; + zend_long offset_start = 0, offset_len = 0; zend_string *filename; if (!self) { @@ -1706,7 +1706,7 @@ static ZIPARCHIVE_METHOD(addFile) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sii", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sll", &filename, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) { return; } @@ -1797,7 +1797,7 @@ static ZIPARCHIVE_METHOD(statName) { struct zip *intern; zval *self = getThis(); - php_int_t flags = 0; + zend_long flags = 0; struct zip_stat sb; zend_string *name; @@ -1807,7 +1807,7 @@ static ZIPARCHIVE_METHOD(statName) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) { return; } @@ -1823,7 +1823,7 @@ static ZIPARCHIVE_METHOD(statIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index, flags = 0; + zend_long index, flags = 0; struct zip_stat sb; @@ -1833,7 +1833,7 @@ static ZIPARCHIVE_METHOD(statIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &index, &flags) == FAILURE) { return; } @@ -1851,8 +1851,8 @@ static ZIPARCHIVE_METHOD(locateName) { struct zip *intern; zval *self = getThis(); - php_int_t flags = 0; - php_int_t idx = -1; + zend_long flags = 0; + zend_long idx = -1; zend_string *name; if (!self) { @@ -1861,7 +1861,7 @@ static ZIPARCHIVE_METHOD(locateName) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) { return; } @@ -1869,10 +1869,10 @@ static ZIPARCHIVE_METHOD(locateName) RETURN_FALSE; } - idx = (php_int_t)zip_name_locate(intern, (const char *)name->val, flags); + idx = (zend_long)zip_name_locate(intern, (const char *)name->val, flags); if (idx >= 0) { - RETURN_INT(idx); + RETURN_LONG(idx); } else { RETURN_FALSE; } @@ -1886,7 +1886,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) struct zip *intern; zval *self = getThis(); const char *name; - php_int_t flags = 0, index = 0; + zend_long flags = 0, index = 0; if (!self) { RETURN_FALSE; @@ -1894,7 +1894,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &index, &flags) == FAILURE) { return; } @@ -1941,7 +1941,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) { struct zip *intern; zval *self = getThis(); - php_int_t flags = 0; + zend_long flags = 0; const char * comment; int comment_len = 0; @@ -1951,7 +1951,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) { return; } @@ -1959,7 +1959,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) if(comment==NULL) { RETURN_FALSE; } - RETURN_STRINGL((char *)comment, (php_int_t)comment_len); + RETURN_STRINGL((char *)comment, (zend_long)comment_len); } /* }}} */ @@ -2002,7 +2002,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index; + zend_long index; int comment_len; char * comment; struct zip_stat sb; @@ -2013,7 +2013,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &index, &comment, &comment_len) == FAILURE) { return; } @@ -2034,7 +2034,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName) zval *self = getThis(); int name_len; char *name; - php_int_t flags=0, opsys, attr; + zend_long flags=0, opsys, attr; zip_int64_t idx; if (!self) { @@ -2043,7 +2043,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|l", &name, &name_len, &opsys, &attr, &flags) == FAILURE) { return; } @@ -2070,7 +2070,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index, flags=0, opsys, attr; + zend_long index, flags=0, opsys, attr; struct zip_stat sb; if (!self) { @@ -2079,7 +2079,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &index, &opsys, &attr, &flags) == FAILURE) { return; } @@ -2101,7 +2101,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) zval *self = getThis(), *z_opsys, *z_attr; int name_len; char *name; - php_int_t flags=0; + zend_long flags=0; zip_uint8_t opsys; zip_uint32_t attr; zip_int64_t idx; @@ -2112,7 +2112,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|l", &name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) { return; } @@ -2130,9 +2130,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) RETURN_FALSE; } zval_ptr_dtor(z_opsys); - ZVAL_INT(z_opsys, opsys); + ZVAL_LONG(z_opsys, opsys); zval_ptr_dtor(z_attr); - ZVAL_INT(z_attr, attr); + ZVAL_LONG(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2143,7 +2143,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) { struct zip *intern; zval *self = getThis(), *z_opsys, *z_attr; - php_int_t index, flags=0; + zend_long index, flags=0; zip_uint8_t opsys; zip_uint32_t attr; struct zip_stat sb; @@ -2154,7 +2154,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/z/|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/z/|l", &index, &z_opsys, &z_attr, &flags) == FAILURE) { return; } @@ -2165,9 +2165,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) RETURN_FALSE; } zval_dtor(z_opsys); - ZVAL_INT(z_opsys, opsys); + ZVAL_LONG(z_opsys, opsys); zval_dtor(z_attr); - ZVAL_INT(z_attr, attr); + ZVAL_LONG(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2180,7 +2180,7 @@ static ZIPARCHIVE_METHOD(getCommentName) struct zip *intern; zval *self = getThis(); int name_len, idx; - php_int_t flags = 0; + zend_long flags = 0; int comment_len = 0; const char * comment; char *name; @@ -2191,7 +2191,7 @@ static ZIPARCHIVE_METHOD(getCommentName) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &name, &name_len, &flags) == FAILURE) { return; } @@ -2206,7 +2206,7 @@ static ZIPARCHIVE_METHOD(getCommentName) } comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags); - RETURN_STRINGL((char *)comment, (php_int_t)comment_len); + RETURN_STRINGL((char *)comment, (zend_long)comment_len); } /* }}} */ @@ -2216,7 +2216,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index, flags = 0; + zend_long index, flags = 0; const char * comment; int comment_len = 0; struct zip_stat sb; @@ -2227,14 +2227,14 @@ static ZIPARCHIVE_METHOD(getCommentIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &index, &flags) == FAILURE) { return; } PHP_ZIP_STAT_INDEX(intern, index, 0, sb); comment = zip_get_file_comment(intern, index, &comment_len, (int)flags); - RETURN_STRINGL((char *)comment, (php_int_t)comment_len); + RETURN_STRINGL((char *)comment, (zend_long)comment_len); } /* }}} */ @@ -2244,7 +2244,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index; + zend_long index; if (!self) { RETURN_FALSE; @@ -2252,7 +2252,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { return; } @@ -2308,7 +2308,7 @@ static ZIPARCHIVE_METHOD(renameIndex) char *new_name; int new_name_len; - php_int_t index; + zend_long index; if (!self) { RETURN_FALSE; @@ -2316,7 +2316,7 @@ static ZIPARCHIVE_METHOD(renameIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &index, &new_name, &new_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &index, &new_name, &new_name_len) == FAILURE) { return; } @@ -2375,7 +2375,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) { struct zip *intern; zval *self = getThis(); - php_int_t index; + zend_long index; if (!self) { RETURN_FALSE; @@ -2383,7 +2383,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) ZIP_FROM_OBJECT(intern, self); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { return; } @@ -2519,7 +2519,7 @@ static ZIPARCHIVE_METHOD(extractTo) if (zval_files && (Z_TYPE_P(zval_files) != IS_NULL)) { switch (Z_TYPE_P(zval_files)) { case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRSIZE_P(zval_files) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2531,10 +2531,10 @@ static ZIPARCHIVE_METHOD(extractTo) for (i = 0; i < nelems; i++) { if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) { switch (Z_TYPE_P(zval_file)) { - case IS_INT: + case IS_LONG: break; case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2542,7 +2542,7 @@ static ZIPARCHIVE_METHOD(extractTo) } } break; - case IS_INT: + case IS_LONG: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -2575,9 +2575,9 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ struct zip_stat sb; struct zip_file *zf; - php_int_t index = -1; - php_int_t flags = 0; - php_int_t len = 0; + zend_long index = -1; + zend_long flags = 0; + zend_long len = 0; zend_string *filename; zend_string *buffer; @@ -2591,12 +2591,12 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ ZIP_FROM_OBJECT(intern, self); if (type == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ii", &filename, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ll", &filename, &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_PATH(intern, filename->val, filename->len, flags, sb); } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &index, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &index, &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_INDEX(intern, index, 0, sb); @@ -2619,10 +2619,10 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ RETURN_FALSE; } - buffer = STR_ALLOC(len, 0); + buffer = zend_string_alloc(len, 0); n = zip_fread(zf, buffer->val, buffer->len); if (n < 1) { - STR_FREE(buffer); + zend_string_free(buffer); RETURN_EMPTY_STRING(); } @@ -2898,88 +2898,88 @@ static PHP_MINIT_FUNCTION(zip) zip_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1); - php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_INT TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_INT TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_INT TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "filename", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "comment", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC); - REGISTER_ZIP_CLASS_CONST_INT("CREATE", ZIP_CREATE); - REGISTER_ZIP_CLASS_CONST_INT("EXCL", ZIP_EXCL); - REGISTER_ZIP_CLASS_CONST_INT("CHECKCONS", ZIP_CHECKCONS); - REGISTER_ZIP_CLASS_CONST_INT("OVERWRITE", ZIP_OVERWRITE); - - REGISTER_ZIP_CLASS_CONST_INT("FL_NOCASE", ZIP_FL_NOCASE); - REGISTER_ZIP_CLASS_CONST_INT("FL_NODIR", ZIP_FL_NODIR); - REGISTER_ZIP_CLASS_CONST_INT("FL_COMPRESSED", ZIP_FL_COMPRESSED); - REGISTER_ZIP_CLASS_CONST_INT("FL_UNCHANGED", ZIP_FL_UNCHANGED); - REGISTER_ZIP_CLASS_CONST_INT("CM_DEFAULT", ZIP_CM_DEFAULT); - REGISTER_ZIP_CLASS_CONST_INT("CM_STORE", ZIP_CM_STORE); - REGISTER_ZIP_CLASS_CONST_INT("CM_SHRINK", ZIP_CM_SHRINK); - REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_1", ZIP_CM_REDUCE_1); - REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_2", ZIP_CM_REDUCE_2); - REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_3", ZIP_CM_REDUCE_3); - REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_4", ZIP_CM_REDUCE_4); - REGISTER_ZIP_CLASS_CONST_INT("CM_IMPLODE", ZIP_CM_IMPLODE); - REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE", ZIP_CM_DEFLATE); - REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE64", ZIP_CM_DEFLATE64); - REGISTER_ZIP_CLASS_CONST_INT("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); - REGISTER_ZIP_CLASS_CONST_INT("CM_BZIP2", ZIP_CM_BZIP2); - REGISTER_ZIP_CLASS_CONST_INT("CM_LZMA", ZIP_CM_LZMA); - REGISTER_ZIP_CLASS_CONST_INT("CM_TERSE", ZIP_CM_TERSE); - REGISTER_ZIP_CLASS_CONST_INT("CM_LZ77", ZIP_CM_LZ77); - REGISTER_ZIP_CLASS_CONST_INT("CM_WAVPACK", ZIP_CM_WAVPACK); - REGISTER_ZIP_CLASS_CONST_INT("CM_PPMD", ZIP_CM_PPMD); + REGISTER_ZIP_CLASS_CONST_LONG("CREATE", ZIP_CREATE); + REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL); + REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS); + REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE); + + REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE); + REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR); + REGISTER_ZIP_CLASS_CONST_LONG("FL_COMPRESSED", ZIP_FL_COMPRESSED); + REGISTER_ZIP_CLASS_CONST_LONG("FL_UNCHANGED", ZIP_FL_UNCHANGED); + REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFAULT", ZIP_CM_DEFAULT); + REGISTER_ZIP_CLASS_CONST_LONG("CM_STORE", ZIP_CM_STORE); + REGISTER_ZIP_CLASS_CONST_LONG("CM_SHRINK", ZIP_CM_SHRINK); + REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_1", ZIP_CM_REDUCE_1); + REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_2", ZIP_CM_REDUCE_2); + REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_3", ZIP_CM_REDUCE_3); + REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_4", ZIP_CM_REDUCE_4); + REGISTER_ZIP_CLASS_CONST_LONG("CM_IMPLODE", ZIP_CM_IMPLODE); + REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE", ZIP_CM_DEFLATE); + REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE64", ZIP_CM_DEFLATE64); + REGISTER_ZIP_CLASS_CONST_LONG("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); + REGISTER_ZIP_CLASS_CONST_LONG("CM_BZIP2", ZIP_CM_BZIP2); + REGISTER_ZIP_CLASS_CONST_LONG("CM_LZMA", ZIP_CM_LZMA); + REGISTER_ZIP_CLASS_CONST_LONG("CM_TERSE", ZIP_CM_TERSE); + REGISTER_ZIP_CLASS_CONST_LONG("CM_LZ77", ZIP_CM_LZ77); + REGISTER_ZIP_CLASS_CONST_LONG("CM_WAVPACK", ZIP_CM_WAVPACK); + REGISTER_ZIP_CLASS_CONST_LONG("CM_PPMD", ZIP_CM_PPMD); /* Error code */ - REGISTER_ZIP_CLASS_CONST_INT("ER_OK", ZIP_ER_OK); /* N No error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ - REGISTER_ZIP_CLASS_CONST_INT("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ - REGISTER_ZIP_CLASS_CONST_INT("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ - REGISTER_ZIP_CLASS_CONST_INT("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_READ", ZIP_ER_READ); /* S Read error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_CRC", ZIP_ER_CRC); /* N CRC error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ - REGISTER_ZIP_CLASS_CONST_INT("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ - REGISTER_ZIP_CLASS_CONST_INT("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ - REGISTER_ZIP_CLASS_CONST_INT("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ - REGISTER_ZIP_CLASS_CONST_INT("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ - REGISTER_ZIP_CLASS_CONST_INT("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ - REGISTER_ZIP_CLASS_CONST_INT("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ - REGISTER_ZIP_CLASS_CONST_INT("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ - REGISTER_ZIP_CLASS_CONST_INT("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ - REGISTER_ZIP_CLASS_CONST_INT("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ - REGISTER_ZIP_CLASS_CONST_INT("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ - REGISTER_ZIP_CLASS_CONST_INT("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ - REGISTER_ZIP_CLASS_CONST_INT("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ - REGISTER_ZIP_CLASS_CONST_INT("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ - REGISTER_ZIP_CLASS_CONST_INT("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_OK", ZIP_ER_OK); /* N No error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_READ", ZIP_ER_READ); /* S Read error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_CRC", ZIP_ER_CRC); /* N CRC error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ + REGISTER_ZIP_CLASS_CONST_LONG("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ #ifdef ZIP_OPSYS_DEFAULT - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DOS", ZIP_OPSYS_DOS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_UNIX", ZIP_OPSYS_UNIX); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_2", ZIP_OPSYS_OS_2); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_CPM", ZIP_OPSYS_CPM); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MVS", ZIP_OPSYS_MVS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VSE", ZIP_OPSYS_VSE); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VFAT", ZIP_OPSYS_VFAT); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_BEOS", ZIP_OPSYS_BEOS); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_400", ZIP_OPSYS_OS_400); - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_X", ZIP_OPSYS_OS_X); - - REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DOS", ZIP_OPSYS_DOS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_UNIX", ZIP_OPSYS_UNIX); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_2", ZIP_OPSYS_OS_2); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_CPM", ZIP_OPSYS_CPM); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MVS", ZIP_OPSYS_MVS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VSE", ZIP_OPSYS_VSE); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VFAT", ZIP_OPSYS_VFAT); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_BEOS", ZIP_OPSYS_BEOS); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_400", ZIP_OPSYS_OS_400); + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_X", ZIP_OPSYS_OS_X); + + REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); #endif /* ifdef ZIP_OPSYS_DEFAULT */ php_register_url_stream_wrapper("zip", &php_stream_zip_wrapper TSRMLS_CC); diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 29ec3d022a..44d5507b77 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -152,7 +152,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - STR_RELEASE(file_basename); + zend_string_release(file_basename); return -1; } @@ -160,7 +160,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D if (za) { memset(ssb, 0, sizeof(php_stream_statbuf)); if (zip_stat(za, fragment, ZIP_FL_NOCASE, &sb) != 0) { - STR_RELEASE(file_basename); + zend_string_release(file_basename); return -1; } zip_close(za); @@ -184,7 +184,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D #endif ssb->sb.st_ino = -1; } - STR_RELEASE(file_basename); + zend_string_release(file_basename); return 0; } /* }}} */ @@ -296,7 +296,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, fragment++; if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) { - STR_RELEASE(file_basename); + zend_string_release(file_basename); return NULL; } @@ -320,7 +320,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, } } - STR_RELEASE(file_basename); + zend_string_release(file_basename); if (!stream) { return NULL; diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 5a2985c11b..f76e4c2266 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -50,11 +50,11 @@ typedef struct _php_zlib_context { ZEND_BEGIN_MODULE_GLOBALS(zlib) /* variables for transparent gzip encoding */ int compression_coding; - php_int_t output_compression; - php_int_t output_compression_level; + zend_long output_compression; + zend_long output_compression_level; char *output_handler; php_zlib_context *ob_gzhandler; - php_int_t output_compression_default; + zend_long output_compression_default; zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 67f575ec9a..be22378052 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -70,9 +70,9 @@ static int php_zlib_output_encoding(TSRMLS_D) zval *enc; if (!ZLIBG(compression_coding)) { - zend_string *name = STR_INIT("_SERVER", sizeof("_SERVER") - 1, 0); + zend_string *name = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0); zend_is_auto_global(name TSRMLS_CC); - STR_RELEASE(name); + zend_string_release(name); if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && (enc = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING") - 1))) { convert_to_string(enc); @@ -315,7 +315,7 @@ static zend_string *php_zlib_encode(const char *in_buf, size_t in_len, int encod Z.zfree = php_zlib_free; if (Z_OK == (status = deflateInit2(&Z, level, Z_DEFLATED, encoding, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))) { - out = STR_ALLOC(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0); + out = zend_string_alloc(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0); Z.next_in = (Bytef *) in_buf; Z.next_out = (Bytef *) out->val; @@ -327,11 +327,11 @@ static zend_string *php_zlib_encode(const char *in_buf, size_t in_len, int encod if (Z_STREAM_END == status) { /* size buffer down to actual length */ - out = STR_REALLOC(out, Z.total_out, 0); + out = zend_string_realloc(out, Z.total_out, 0); out->val[out->len] = '\0'; return out; } else { - STR_FREE(out); + zend_string_free(out); } } @@ -448,7 +448,7 @@ static PHP_FUNCTION(ob_gzhandler) { char *in_str; int in_len; - php_int_t flags = 0; + zend_long flags = 0; php_output_context ctx = {0}; int encoding, rv; @@ -460,7 +460,7 @@ static PHP_FUNCTION(ob_gzhandler) * - OG(running) is not set or set to any other output handler * - we have to mess around with php_output_context */ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &in_str, &in_len, &flags)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &in_str, &in_len, &flags)) { RETURN_FALSE; } @@ -537,10 +537,10 @@ static PHP_FUNCTION(gzfile) int flags = REPORT_ERRORS; char buf[8192] = {0}; register int i = 0; - php_int_t use_include_path = 0; + zend_long use_include_path = 0; php_stream *stream; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &use_include_path)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) { return; } @@ -578,9 +578,9 @@ static PHP_FUNCTION(gzopen) int filename_len, mode_len; int flags = REPORT_ERRORS; php_stream *stream; - php_int_t use_include_path = 0; + zend_long use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) { return; } @@ -606,9 +606,9 @@ static PHP_FUNCTION(readgzfile) int flags = REPORT_ERRORS; php_stream *stream; int size; - php_int_t use_include_path = 0; + zend_long use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &filename, &filename_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) { return; } @@ -623,7 +623,7 @@ static PHP_FUNCTION(readgzfile) } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_INT(size); + RETURN_LONG(size); } /* }}} */ @@ -631,14 +631,14 @@ static PHP_FUNCTION(readgzfile) static PHP_FUNCTION(name) \ { \ zend_string *in, *out; \ - php_int_t level = -1; \ - php_int_t encoding = default_encoding; \ + zend_long level = -1; \ + zend_long encoding = default_encoding; \ if (default_encoding) { \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &in, &level, &encoding)) { \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &in, &level, &encoding)) { \ return; \ } \ } else { \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &in, &encoding, &level)) { \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &in, &encoding, &level)) { \ return; \ } \ } \ @@ -667,8 +667,8 @@ static PHP_FUNCTION(name) \ char *in_buf, *out_buf; \ int in_len; \ size_t out_len; \ - php_int_t max_len = 0; \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &in_buf, &in_len, &max_len)) { \ + zend_long max_len = 0; \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &in_buf, &in_len, &max_len)) { \ return; \ } \ if (max_len < 0) { \ @@ -937,12 +937,12 @@ static PHP_MINIT_FUNCTION(zlib) php_output_handler_conflict_register(ZEND_STRL("ob_gzhandler"), php_zlib_output_conflict_check TSRMLS_CC); php_output_handler_conflict_register(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), php_zlib_output_conflict_check TSRMLS_CC); - REGISTER_INT_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); REGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c index de8340de32..6be0b02962 100644 --- a/ext/zlib/zlib_filter.c +++ b/ext/zlib/zlib_filter.c @@ -333,10 +333,10 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f /* log-2 base of history window (9 - 15) */ ZVAL_DUP(&tmp, tmpzval); convert_to_int(&tmp); - if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 32) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_IVAL(tmp)); + if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 32) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_LVAL(tmp)); } else { - windowBits = Z_IVAL(tmp); + windowBits = Z_LVAL(tmp); } } } @@ -366,10 +366,10 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f convert_to_int(&tmp); /* Memory Level (1 - 9) */ - if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > MAX_MEM_LEVEL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%pd)", Z_IVAL(tmp)); + if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > MAX_MEM_LEVEL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%pd)", Z_LVAL(tmp)); } else { - memLevel = Z_IVAL(tmp); + memLevel = Z_LVAL(tmp); } } @@ -378,10 +378,10 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f convert_to_int(&tmp); /* log-2 base of history window (9 - 15) */ - if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 16) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_IVAL(tmp)); + if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 16) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%pd)", Z_LVAL(tmp)); } else { - windowBits = Z_IVAL(tmp); + windowBits = Z_LVAL(tmp); } } @@ -394,17 +394,17 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f break; case IS_STRING: case IS_DOUBLE: - case IS_INT: + case IS_LONG: ZVAL_COPY_VALUE(&tmp, filterparams); factory_setlevel: zval_copy_ctor(&tmp); convert_to_int(&tmp); /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */ - if (Z_IVAL(tmp) < -1 || Z_IVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%pd)", Z_IVAL(tmp)); + if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%pd)", Z_LVAL(tmp)); } else { - level = Z_IVAL(tmp); + level = Z_LVAL(tmp); } break; default: diff --git a/main/SAPI.c b/main/SAPI.c index a3826b0e1b..fbfca51743 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -789,9 +789,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* Disable possible output compression for images */ if (!strncmp(ptr, "image/", sizeof("image/")-1)) { - zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); + zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } mimetype = estrdup(ptr); @@ -817,10 +817,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) * do disable compression altogether. This contributes to making scripts * portable between setups that have and don't have zlib compression * enabled globally. See req #44164 */ - zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); + zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } else if (!STRCASECMP(header_line, "Location")) { if ((SG(sapi_headers).http_response_code < 300 || SG(sapi_headers).http_response_code > 399) && diff --git a/main/SAPI.h b/main/SAPI.h index 4e67a481c5..0654cd6c7f 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -82,7 +82,7 @@ typedef struct { const char *request_method; char *query_string; char *cookie_data; - zend_int_t content_length; + zend_long content_length; char *path_translated; char *request_uri; @@ -129,7 +129,7 @@ typedef struct _sapi_globals_struct { char *default_mimetype; char *default_charset; HashTable *rfc1867_uploaded_files; - zend_int_t post_max_size; + zend_long post_max_size; int options; zend_bool sapi_started; double global_request_time; @@ -170,7 +170,7 @@ END_EXTERN_C() typedef struct { char *line; /* If you allocated this, you need to free it yourself */ uint line_len; - zend_int_t response_code; /* long due to zend_parse_parameters compatibility */ + zend_long response_code; /* long due to zend_parse_parameters compatibility */ } sapi_header_line; typedef enum { /* Parameter: */ diff --git a/main/main.c b/main/main.c index 8f954706cf..b961bbf5b3 100644 --- a/main/main.c +++ b/main/main.c @@ -160,7 +160,7 @@ static php_win32_disable_functions(TSRMLS_D) */ static PHP_INI_MH(OnSetPrecision) { - php_int_t i; + zend_long i; ZEND_ATOI(i, new_value); if (i >= 0) { @@ -691,7 +691,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) #endif php_ignore_value(write(fd, tmp, len)); efree(tmp); - STR_FREE(error_time_str); + zend_string_free(error_time_str); close(fd); PG(in_error_log) = 0; return; @@ -893,7 +893,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c spprintf(&message, 0, "%s: %s", origin, buffer); } if (replace_origin) { - STR_FREE(replace_origin); + zend_string_free(replace_origin); } else { efree(origin); } @@ -914,7 +914,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c } } if (replace_buffer) { - STR_FREE(replace_buffer); + zend_string_free(replace_buffer); } else { efree(buffer); } @@ -1138,7 +1138,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ if (type == E_ERROR || type == E_PARSE) { zend_string *buf = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL TSRMLS_CC); php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf->val, error_filename, error_lineno, STR_PRINT(append_string)); - STR_FREE(buf); + zend_string_free(buf); } else { php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); } @@ -1328,24 +1328,24 @@ PHPAPI char *php_get_current_user(TSRMLS_D) Sets the maximum time a script can run */ PHP_FUNCTION(set_time_limit) { - php_int_t new_timeout; + zend_long new_timeout; char *new_timeout_str; int new_timeout_strlen; zend_string *key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { return; } new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_INT_FMT, new_timeout); - key = STR_INIT("max_execution_time", sizeof("max_execution_time")-1, 0); + key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0); if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { RETVAL_TRUE; } else { RETVAL_FALSE; } - STR_RELEASE(key); + zend_string_release(key); efree(new_timeout_str); } /* }}} */ @@ -2180,17 +2180,17 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod /* Register constants */ REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTRA_VERSION", PHP_EXTRA_VERSION, sizeof(PHP_EXTRA_VERSION) - 1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS); #ifdef ZTS - REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS); #else - REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_MAIN_INT_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_module.name, strlen(sapi_module.name), CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS); @@ -2210,23 +2210,23 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS); #ifdef PHP_WIN32 - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); #endif php_binary_init(TSRMLS_C); @@ -2374,9 +2374,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod const char **p = directives[i].directives; while(*p) { - php_int_t value; + zend_long value; - if (cfg_get_int((char*)*p, &value) == SUCCESS && value) { + if (cfg_get_long((char*)*p, &value) == SUCCESS && value) { zend_error(directives[i].error_level, directives[i].phrase, *p); } @@ -2653,7 +2653,7 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) SG(request_info).auth_password = estrdup(pass); ret = 0; } - STR_FREE(user); + zend_string_free(user); } } diff --git a/main/network.c b/main/network.c index 5edc74c830..0b018c2e87 100644 --- a/main/network.c +++ b/main/network.c @@ -507,7 +507,7 @@ bound: } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) { char *colon; char *tmp; @@ -563,7 +563,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int if (n == 0) { if (errstr) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val); - STR_RELEASE(errstr); + zend_string_release(errstr); } goto out; } @@ -645,10 +645,10 @@ PHPAPI void php_network_populate_name_from_sockaddr( if (ua->sun_path[0] == '\0') { /* abstract name */ int len = strlen(ua->sun_path + 1) + 1; - *textaddr = STR_INIT((char*)ua->sun_path, len, 0); + *textaddr = zend_string_init((char*)ua->sun_path, len, 0); } else { int len = strlen(ua->sun_path); - *textaddr = STR_INIT((char*)ua->sun_path, len, 0); + *textaddr = zend_string_init((char*)ua->sun_path, len, 0); } } break; @@ -880,7 +880,7 @@ skip_bind: } /* free error string received during previous iteration (if any) */ if (error_string && *error_string) { - STR_RELEASE(*error_string); + zend_string_release(*error_string); *error_string = NULL; } @@ -1050,7 +1050,7 @@ PHPAPI zend_string *php_socket_error_str(long err) char *errstr; errstr = strerror(err); - return STR_INIT(errstr, strlen(errstr), 0); + return zend_string_init(errstr, strlen(errstr), 0); #else zend_string *ret; char *sysbuf; @@ -1070,7 +1070,7 @@ PHPAPI zend_string *php_socket_error_str(long err) sysbuf = "Unknown Error"; } - ret = STR_INIT(sysbuf, strlen(sysbuf), 0); + ret = zend_string_init(sysbuf, strlen(sysbuf), 0); if (free_it) { LocalFree(sysbuf); @@ -1110,7 +1110,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC) { char *res; - php_int_t reslen; + zend_long reslen; php_stream *stream; reslen = spprintf(&res, 0, "tcp://%s:%d", host, port); diff --git a/main/output.c b/main/output.c index 4acdd234f2..1a6f6e5bd8 100644 --- a/main/output.c +++ b/main/output.c @@ -199,20 +199,20 @@ PHPAPI void php_output_deactivate(TSRMLS_D) /* {{{ void php_output_register_constants() */ PHPAPI void php_output_register_constants(TSRMLS_D) { - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -404,7 +404,7 @@ PHPAPI int php_output_get_contents(zval *p TSRMLS_DC) PHPAPI int php_output_get_length(zval *p TSRMLS_DC) { if (OG(active)) { - ZVAL_INT(p, OG(active)->buffer.used); + ZVAL_LONG(p, OG(active)->buffer.used); return SUCCESS; } else { ZVAL_NULL(p); @@ -501,8 +501,8 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); break; case IS_STRING: - if (Z_STRSIZE_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler) TSRMLS_CC))) { - handler = alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler), chunk_size, flags TSRMLS_CC); + if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) { + handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC); break; } default: @@ -519,7 +519,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, efree(error); } if (handler_name) { - STR_RELEASE(handler_name); + zend_string_release(handler_name); } } @@ -532,11 +532,11 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; - zend_string *str = STR_INIT(name, name_len, 1); + zend_string *str = zend_string_init(name, name_len, 1); handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL TSRMLS_CC); handler->func.internal = output_handler; - STR_RELEASE(str); + zend_string_release(str); return handler; } @@ -718,7 +718,7 @@ PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSR PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) { if (handler->name) { - STR_RELEASE(handler->name); + zend_string_release(handler->name); } if (handler->buffer.data) { efree(handler->buffer.data); @@ -885,7 +885,7 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz php_output_handler *handler; handler = ecalloc(1, sizeof(php_output_handler)); - handler->name = STR_COPY(name); + handler->name = zend_string_copy(name); handler->size = chunk_size; handler->flags = flags; handler->buffer.size = PHP_OUTPUT_HANDLER_INITBUF_SIZE(chunk_size); @@ -973,7 +973,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl zval retval, ob_data, ob_mode; ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used); - ZVAL_INT(&ob_mode, (long) context->op); + ZVAL_LONG(&ob_mode, (long) context->op); zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode); #define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_FALSE)) @@ -982,9 +982,9 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl status = PHP_OUTPUT_HANDLER_NO_DATA; if (Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { convert_to_string_ex(&retval); - if (Z_STRSIZE(retval)) { - context->out.data = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); - context->out.used = Z_STRSIZE(retval); + if (Z_STRLEN(retval)) { + context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); + context->out.used = Z_STRLEN(retval); context->out.free = 1; status = PHP_OUTPUT_HANDLER_SUCCESS; } @@ -1172,7 +1172,7 @@ static int php_output_stack_apply_list(void *h, void *z) php_output_handler *handler = *(php_output_handler **) h; zval *array = (zval *) z; - add_next_index_str(array, STR_COPY(handler->name)); + add_next_index_str(array, zend_string_copy(handler->name)); return 0; } /* }}} */ @@ -1196,13 +1196,13 @@ static inline zval *php_output_handler_status(php_output_handler *handler, zval ZEND_ASSERT(entry != NULL); array_init(entry); - add_assoc_str(entry, "name", STR_COPY(handler->name)); - add_assoc_int(entry, "type", (php_int_t) (handler->flags & 0xf)); - add_assoc_int(entry, "flags", (php_int_t) handler->flags); - add_assoc_int(entry, "level", (php_int_t) handler->level); - add_assoc_int(entry, "chunk_size", (php_int_t) handler->size); - add_assoc_int(entry, "buffer_size", (php_int_t) handler->buffer.size); - add_assoc_int(entry, "buffer_used", (php_int_t) handler->buffer.used); + add_assoc_str(entry, "name", zend_string_copy(handler->name)); + add_assoc_long(entry, "type", (zend_long) (handler->flags & 0xf)); + add_assoc_long(entry, "flags", (zend_long) handler->flags); + add_assoc_long(entry, "level", (zend_long) handler->level); + add_assoc_long(entry, "chunk_size", (zend_long) handler->size); + add_assoc_long(entry, "buffer_size", (zend_long) handler->buffer.size); + add_assoc_long(entry, "buffer_used", (zend_long) handler->buffer.used); return entry; } @@ -1316,10 +1316,10 @@ static int php_output_handler_devnull_func(void **handler_context, php_output_co PHP_FUNCTION(ob_start) { zval *output_handler = NULL; - php_int_t chunk_size = 0; - php_int_t flags = PHP_OUTPUT_HANDLER_STDFLAGS; + zend_long chunk_size = 0; + zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ii", &output_handler, &chunk_size, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ll", &output_handler, &chunk_size, &flags) == FAILURE) { return; } @@ -1475,7 +1475,7 @@ PHP_FUNCTION(ob_get_level) return; } - RETURN_INT(php_output_get_level(TSRMLS_C)); + RETURN_LONG(php_output_get_level(TSRMLS_C)); } /* }}} */ @@ -1539,7 +1539,7 @@ PHP_FUNCTION(ob_get_status) Turn implicit flush on/off and is equivalent to calling flush() after every output call */ PHP_FUNCTION(ob_implicit_flush) { - php_int_t flag = 1; + zend_long flag = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { return; diff --git a/main/php.h b/main/php.h index a271f0d5fc..fc105386db 100644 --- a/main/php.h +++ b/main/php.h @@ -66,9 +66,9 @@ # define PHP_EOL "\n" #endif -#define php_size_t zend_size_t -#define php_int_t zend_int_t -#define php_uint_t zend_uint_t +#define php_size_t size_t +#define zend_long zend_long +#define zend_ulong zend_ulong #define php_off_t zend_off_t #define PHP_INT_MAX ZEND_INT_MAX #define PHP_INT_MIN ZEND_INT_MIN diff --git a/main/php_globals.h b/main/php_globals.h index defb220c76..14d0a03868 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -56,7 +56,7 @@ typedef struct _arg_separators { struct _php_core_globals { zend_bool implicit_flush; - zend_int_t output_buffering; + zend_long output_buffering; zend_bool sql_safe_mode; zend_bool enable_dl; @@ -64,16 +64,16 @@ struct _php_core_globals { char *output_handler; char *unserialize_callback_func; - zend_int_t serialize_precision; + zend_long serialize_precision; - zend_int_t memory_limit; - zend_int_t max_input_time; + zend_long memory_limit; + zend_long max_input_time; zend_bool track_errors; zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; - zend_int_t log_errors_max_len; + zend_long log_errors_max_len; zend_bool ignore_repeated_errors; zend_bool ignore_repeated_source; zend_bool report_memleaks; @@ -88,7 +88,7 @@ struct _php_core_globals { char *sys_temp_dir; char *upload_tmp_dir; - zend_int_t upload_max_filesize; + zend_long upload_max_filesize; char *error_append_string; char *error_prepend_string; @@ -126,7 +126,7 @@ struct _php_core_globals { zend_bool html_errors; zend_bool xmlrpc_errors; - zend_int_t xmlrpc_error_number; + zend_long xmlrpc_error_number; zend_bool activated_auto_globals[8]; @@ -149,12 +149,12 @@ struct _php_core_globals { #ifdef PHP_WIN32 zend_bool com_initialized; #endif - zend_int_t max_input_nesting_level; - zend_int_t max_input_vars; + zend_long max_input_nesting_level; + zend_long max_input_vars; zend_bool in_user_include; char *user_ini_filename; - zend_int_t user_ini_cache_ttl; + zend_long user_ini_cache_ttl; char *request_order; diff --git a/main/php_ini.c b/main/php_ini.c index 54944483d2..8621af24d7 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -200,7 +200,7 @@ PHPAPI void config_zval_dtor(zval *zvalue) zend_hash_destroy(Z_ARRVAL_P(zvalue)); free(Z_ARR_P(zvalue)); } else if (Z_TYPE_P(zvalue) == IS_STRING) { - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); } } /* Reset / free active_ini_sectin global */ @@ -233,17 +233,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* PHP and Zend extensions are not added into configuration hash! */ if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.functions, &extension_name); } else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.engine, &extension_name); /* All other entries are added into either configuration_hash or active ini section array */ } else { /* Store in active hash */ entry = zend_hash_update(active_hash, Z_STR_P(arg1), arg2); - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } } break; @@ -267,12 +267,12 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } /* arg3 is possible option offset name */ - if (arg3 && Z_STRSIZE_P(arg3) > 0) { + if (arg3 && Z_STRLEN_P(arg3) > 0) { entry = zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STR_P(arg3), arg2); } else { entry = zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2); } - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } break; @@ -287,7 +287,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -298,7 +298,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("HOST") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; zend_str_tolower(key, key_len); /* host names are case-insensitive. */ @@ -593,12 +593,12 @@ int php_init_config(TSRMLS_D) { zval tmp; - ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1)); + ZVAL_NEW_STR(&tmp, zend_string_init(fh.filename, strlen(fh.filename), 1)); zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp); if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } } @@ -778,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { zend_string *str; zval *data; - zend_uint_t num_index; + zend_ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ for (zend_hash_internal_pointer_reset(source_hash); @@ -786,7 +786,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); - zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -873,9 +873,9 @@ PHPAPI zval *cfg_get_entry(const char *name, uint name_length) } /* }}} */ -/* {{{ cfg_get_int +/* {{{ cfg_get_long */ -PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) +PHPAPI int cfg_get_long(const char *varname, zend_long *result) { zval *tmp, var; @@ -885,7 +885,7 @@ PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) } ZVAL_DUP(&var, tmp); convert_to_int(&var); - *result = Z_IVAL(var); + *result = Z_LVAL(var); return SUCCESS; } /* }}} */ diff --git a/main/php_ini.h b/main/php_ini.h index 491ad1cbd8..5e6f03680a 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -29,7 +29,7 @@ int php_init_config(TSRMLS_D); int php_shutdown_config(void); void php_ini_register_extensions(TSRMLS_D); PHPAPI zval *cfg_get_entry(const char *name, uint name_length); -PHPAPI int cfg_get_int(const char *varname, zend_int_t *result); +PHPAPI int cfg_get_long(const char *varname, zend_long *result); PHPAPI int cfg_get_double(const char *varname, double *result); PHPAPI int cfg_get_string(const char *varname, char **result); PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC); @@ -83,7 +83,7 @@ END_EXTERN_C() #define php_alter_ini_entry zend_alter_ini_entry -#define php_ini_long zend_ini_int +#define php_ini_long zend_ini_long #define php_ini_double zend_ini_double #define php_ini_string zend_ini_string diff --git a/main/php_network.h b/main/php_network.h index cc6e1c54e7..1528447c73 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -306,7 +306,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( TSRMLS_DC); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); END_EXTERN_C() #define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC) diff --git a/main/php_variables.c b/main/php_variables.c index 949bd6c6b0..a455b1b790 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -49,7 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, php_size_t str_l assert(strval != NULL); /* Prepare value */ - ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0)); + ZVAL_NEW_STR(&new_entry, zend_string_init(strval, str_len, 0)); php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); } @@ -358,7 +358,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) zval array; int free_buffer = 0; char *strtok_buf = NULL; - php_int_t count = 0; + zend_long count = 0; ZVAL_UNDEF(&array); switch (arg) { @@ -535,7 +535,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) for (i = 0; i < SG(request_info).argc; i++) { ZVAL_STRING(&tmp, SG(request_info).argv[i]); if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) { - STR_FREE(Z_STR(tmp)); + zend_string_free(Z_STR(tmp)); } } } else if (s && *s) { @@ -549,7 +549,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) ZVAL_STRING(&tmp, ss); count++; if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) { - STR_FREE(Z_STR(tmp)); + zend_string_free(Z_STR(tmp)); } if (space) { *space = '+'; @@ -562,9 +562,9 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* prepare argc */ if (SG(request_info).argc) { - ZVAL_INT(&argc, SG(request_info).argc); + ZVAL_LONG(&argc, SG(request_info).argc); } else { - ZVAL_INT(&argc, count); + ZVAL_LONG(&argc, count); } if (SG(request_info).argc) { @@ -608,7 +608,7 @@ static inline void php_register_server_variables(TSRMLS_D) zval request_time_float, request_time_long; ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C)); php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); - ZVAL_INT(&request_time_long, zend_dval_to_ival(Z_DVAL(request_time_float))); + ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float))); php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); } @@ -621,7 +621,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval *src_entry, *dest_entry; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; int globals_check = (dest == (&EG(symbol_table).ht)); ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) { @@ -816,13 +816,13 @@ static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC) void php_startup_auto_globals(TSRMLS_D) { - zend_register_auto_global(STR_INIT("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC); - zend_register_auto_global(STR_INIT("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC); - zend_register_auto_global(STR_INIT("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC); - zend_register_auto_global(STR_INIT("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC); - zend_register_auto_global(STR_INIT("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC); - zend_register_auto_global(STR_INIT("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC); - zend_register_auto_global(STR_INIT("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC); + zend_register_auto_global(zend_string_init("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC); + zend_register_auto_global(zend_string_init("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC); + zend_register_auto_global(zend_string_init("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC); + zend_register_auto_global(zend_string_init("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC); + zend_register_auto_global(zend_string_init("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC); + zend_register_auto_global(zend_string_init("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC); + zend_register_auto_global(zend_string_init("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC); } /* diff --git a/main/rfc1867.c b/main/rfc1867.c index 2d76d6c975..263c214af3 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -78,14 +78,14 @@ static void safe_php_register_variable(char *var, char *strval, php_size_t val_l void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ { - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -701,7 +701,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ php_rfc1867_getword_t getword; php_rfc1867_getword_conf_t getword_conf; php_rfc1867_basename_t _basename; - php_int_t count = 0; + zend_long count = 0; if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) { getword = php_rfc1867_getword; @@ -1034,12 +1034,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } } - if (PG(upload_max_filesize) > 0 && (php_int_t)(total_bytes+blen) > PG(upload_max_filesize)) { + if (PG(upload_max_filesize) > 0 && (zend_long)(total_bytes+blen) > PG(upload_max_filesize)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename); #endif cancel_upload = UPLOAD_ERROR_A; - } else if (max_file_size && ((php_int_t)(total_bytes+blen) > max_file_size)) { + } else if (max_file_size && ((zend_long)(total_bytes+blen) > max_file_size)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename); #endif @@ -1224,11 +1224,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ int size_overflow = 0; char file_size_buf[65]; - ZVAL_INT(&error_type, cancel_upload); + ZVAL_LONG(&error_type, cancel_upload); /* Add $foo[error] */ if (cancel_upload) { - ZVAL_INT(&file_size, 0); + ZVAL_LONG(&file_size, 0); } else { if (total_bytes > ZEND_INT_MAX) { #ifdef PHP_WIN32 @@ -1245,7 +1245,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ size_overflow = 1; } else { - ZVAL_INT(&file_size, total_bytes); + ZVAL_LONG(&file_size, total_bytes); } } diff --git a/main/snprintf.c b/main/snprintf.c index 7a55034341..8f32f3977d 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -793,7 +793,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; @@ -829,7 +829,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_uint_t); + i_num = (wide_int) va_arg(ap, zend_ulong); break; } /* @@ -874,7 +874,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_int_t); + i_num = (wide_int) va_arg(ap, zend_long); break; } } @@ -923,7 +923,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 3, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); @@ -965,7 +965,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 4, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); diff --git a/main/spprintf.c b/main/spprintf.c index 5c0310fd9d..0194722418 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -407,7 +407,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; @@ -443,7 +443,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_uint_t); + i_num = (wide_int) va_arg(ap, zend_ulong); break; } /* @@ -488,7 +488,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_int_t); + i_num = (wide_int) va_arg(ap, zend_long); break; } } @@ -536,7 +536,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 3, *fmt, @@ -579,7 +579,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 4, *fmt, diff --git a/main/streams/cast.c b/main/streams/cast.c index 4780d46eea..d26ceceeef 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -334,7 +334,7 @@ exit_success: * will be accessing the stream. Emit a warning so that the end-user will * know that they should try something else */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (php_int_t)(stream->writepos - stream->readpos)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); } if (castas == PHP_STREAM_AS_STDIO && ret) { diff --git a/main/streams/memory.c b/main/streams/memory.c index 71e9005fa7..f08c192581 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -741,7 +741,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con ZVAL_COPY_VALUE(&ts->meta, &meta); } if (base64_comma) { - STR_FREE(base64_comma); + zend_string_free(base64_comma); } else { efree(comma); } diff --git a/main/streams/streams.c b/main/streams/streams.c index 1a6c4d24a0..88b6aeada1 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1101,7 +1101,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con } } - ret_buf = STR_ALLOC(tent_ret_len, 0); + ret_buf = zend_string_alloc(tent_ret_len, 0); /* php_stream_read will not call ops->read here because the necessary * data is guaranteedly buffered */ ret_buf->len = php_stream_read(stream, ret_buf->val, tent_ret_len); @@ -1445,7 +1445,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } if (maxlen > 0) { - result = STR_ALLOC(maxlen, persistent); + result = zend_string_alloc(maxlen, persistent); ptr = result->val; while ((len < maxlen) && !php_stream_eof(src)) { ret = php_stream_read(src, ptr, maxlen - len); @@ -1459,7 +1459,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int *ptr = '\0'; result->len = len; } else { - STR_FREE(result); + zend_string_free(result); result = NULL; } return result; @@ -1477,13 +1477,13 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int max_len = step; } - result = STR_ALLOC(max_len, persistent); + result = zend_string_alloc(max_len, persistent); ptr = result->val; while ((ret = php_stream_read(src, ptr, max_len - len))) { len += ret; if (len + min_room >= max_len) { - result = STR_REALLOC(result, max_len + step, persistent); + result = zend_string_realloc(result, max_len + step, persistent); max_len += step; ptr = result->val + len; } else { @@ -1491,10 +1491,10 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } } if (len) { - result = STR_REALLOC(result, len, persistent); + result = zend_string_realloc(result, len, persistent); result->val[len] = '\0'; } else { - STR_FREE(result); + zend_string_free(result); result = NULL; } @@ -2310,7 +2310,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in vector = (zend_string **) safe_erealloc(vector, vector_size, sizeof(char *), 0); } - vector[nfiles] = STR_INIT(sdp.d_name, strlen(sdp.d_name), 0); + vector[nfiles] = zend_string_init(sdp.d_name, strlen(sdp.d_name), 0); nfiles++; if(vector_size < 10 || nfiles == 0) { diff --git a/main/streams/transports.c b/main/streams/transports.c index 7f1d13faaa..a0c8d61aa6 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) #define ERR_RETURN(out_err, local_err, fmt) \ if (out_err) { *out_err = local_err; } \ else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ - if (local_err) { STR_RELEASE(local_err); local_err = NULL; } \ + if (local_err) { zend_string_release(local_err); local_err = NULL; } \ } PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, @@ -164,7 +164,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in zval *ztmp = zbacklog; convert_to_int_ex(ztmp); - backlog = Z_IVAL_P(ztmp); + backlog = Z_LVAL_P(ztmp); if (ztmp != zbacklog) { zval_ptr_dtor(ztmp); } diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 82ff445c4f..6561febec4 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -86,35 +86,35 @@ PHP_MINIT_FUNCTION(user_streams) if (le_protocols == FAILURE) return FAILURE; - REGISTER_INT_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT); return SUCCESS; } @@ -367,7 +367,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* call it's stream_open method - set up params first */ ZVAL_STRING(&args[0], filename); ZVAL_STRING(&args[1], mode); - ZVAL_INT(&args[2], options); + ZVAL_LONG(&args[2], options); ZVAL_NEW_REF(&args[3], &EG(uninitialized_zval)); ZVAL_STRING(&zfuncname, USERSTREAM_OPEN); @@ -385,7 +385,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* if the opened path is set, copy it out */ if (Z_ISREF(args[3]) && Z_TYPE_P(Z_REFVAL(args[3])) == IS_STRING && opened_path) { - *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRSIZE_P(Z_REFVAL(args[3]))); + *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRLEN_P(Z_REFVAL(args[3]))); } /* set wrapper data to be a reference to our object */ @@ -443,7 +443,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char /* call it's dir_open method - set up params first */ ZVAL_STRING(&args[0], filename); - ZVAL_INT(&args[1], options); + ZVAL_LONG(&args[1], options); ZVAL_STRING(&zfuncname, USERSTREAM_DIR_OPEN); @@ -490,7 +490,7 @@ PHP_FUNCTION(stream_wrapper_register) zend_string *protocol, *classname; struct php_user_stream_wrapper * uwrap; zend_resource *rsrc; - php_int_t flags = 0; + zend_long flags = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &classname, &flags) == FAILURE) { RETURN_FALSE; @@ -609,7 +609,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t didwrite = 0; if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_int(&retval); - didwrite = Z_IVAL(retval); + didwrite = Z_LVAL(retval); } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!", us->wrapper->classname); @@ -619,7 +619,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t if (didwrite > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " written, " ZEND_INT_FMT " max)", us->wrapper->classname, - (php_int_t)(didwrite - count), (php_int_t)didwrite, (php_int_t)count); + (zend_long)(didwrite - count), (zend_long)didwrite, (zend_long)count); didwrite = count; } @@ -641,7 +641,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1); - ZVAL_INT(&args[0], count); + ZVAL_LONG(&args[0], count); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, @@ -652,10 +652,10 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_string(&retval); - didread = Z_STRSIZE(retval); + didread = Z_STRLEN(retval); if (didread > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " read, " ZEND_INT_FMT " max) - excess data will be lost", - us->wrapper->classname, (php_int_t)(didread - count), (php_int_t)didread, (php_int_t)count); + us->wrapper->classname, (zend_long)(didread - count), (zend_long)didread, (zend_long)count); didread = count; } if (didread > 0) @@ -763,8 +763,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1); - ZVAL_INT(&args[0], offset); - ZVAL_INT(&args[1], whence); + ZVAL_LONG(&args[0], offset); + ZVAL_LONG(&args[1], whence); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, @@ -807,8 +807,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o &retval, 0, NULL, 0, NULL TSRMLS_CC); - if (call_result == SUCCESS && Z_TYPE(retval) == IS_INT) { - *newoffs = Z_IVAL(retval); + if (call_result == SUCCESS && Z_TYPE(retval) == IS_LONG) { + *newoffs = Z_LVAL(retval); ret = 0; } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); @@ -832,7 +832,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC) if (NULL != (elem = zend_hash_str_find(Z_ARRVAL_P(array), #name, sizeof(#name)-1))) { \ SEPARATE_ZVAL(elem); \ convert_to_int(elem); \ - ssb->sb.st_##name2 = Z_IVAL_P(elem); \ + ssb->sb.st_##name2 = Z_LVAL_P(elem); \ } #define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name) @@ -927,20 +927,20 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value break; case PHP_STREAM_OPTION_LOCKING: - ZVAL_INT(&args[0], 0); + ZVAL_LONG(&args[0], 0); if (value & LOCK_NB) { - Z_IVAL_P(&args[0]) |= PHP_LOCK_NB; + Z_LVAL_P(&args[0]) |= PHP_LOCK_NB; } switch(value & ~LOCK_NB) { case LOCK_SH: - Z_IVAL_P(&args[0]) |= PHP_LOCK_SH; + Z_LVAL_P(&args[0]) |= PHP_LOCK_SH; break; case LOCK_EX: - Z_IVAL_P(&args[0]) |= PHP_LOCK_EX; + Z_LVAL_P(&args[0]) |= PHP_LOCK_EX; break; case LOCK_UN: - Z_IVAL_P(&args[0]) |= PHP_LOCK_UN; + Z_LVAL_P(&args[0]) |= PHP_LOCK_UN; break; } @@ -987,7 +987,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value case PHP_STREAM_TRUNCATE_SET_SIZE: { ptrdiff_t new_size = *(ptrdiff_t*) ptrparam; if (new_size >= 0 && new_size <= (ptrdiff_t)LONG_MAX) { - ZVAL_INT(&args[0], (long)new_size); + ZVAL_LONG(&args[0], (long)new_size); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, @@ -1025,28 +1025,28 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1); - ZVAL_INT(&args[0], option); + ZVAL_LONG(&args[0], option); ZVAL_NULL(&args[1]); ZVAL_NULL(&args[2]); switch(option) { case PHP_STREAM_OPTION_READ_BUFFER: case PHP_STREAM_OPTION_WRITE_BUFFER: - ZVAL_INT(&args[1], value); + ZVAL_LONG(&args[1], value); if (ptrparam) { - ZVAL_INT(&args[2], *(long *)ptrparam); + ZVAL_LONG(&args[2], *(long *)ptrparam); } else { - ZVAL_INT(&args[2], BUFSIZ); + ZVAL_LONG(&args[2], BUFSIZ); } break; case PHP_STREAM_OPTION_READ_TIMEOUT: { struct timeval tv = *(struct timeval*)ptrparam; - ZVAL_INT(&args[1], tv.tv_sec); - ZVAL_INT(&args[2], tv.tv_usec); + ZVAL_LONG(&args[1], tv.tv_sec); + ZVAL_LONG(&args[2], tv.tv_usec); break; } case PHP_STREAM_OPTION_BLOCKING: - ZVAL_INT(&args[1], value); + ZVAL_LONG(&args[1], value); break; default: break; @@ -1189,8 +1189,8 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int /* call the mkdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], mode); - ZVAL_INT(&args[2], options); + ZVAL_LONG(&args[1], mode); + ZVAL_LONG(&args[2], options); ZVAL_STRING(&zfuncname, USERSTREAM_MKDIR); @@ -1237,7 +1237,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, /* call the rmdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], options); + ZVAL_LONG(&args[1], options); ZVAL_STRING(&zfuncname, USERSTREAM_RMDIR); @@ -1280,14 +1280,14 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i array_init(&args[2]); if(value) { struct utimbuf *newtime = (struct utimbuf *)value; - add_index_int(&args[2], 0, newtime->modtime); - add_index_int(&args[2], 1, newtime->actime); + add_index_long(&args[2], 0, newtime->modtime); + add_index_long(&args[2], 1, newtime->actime); } break; case PHP_STREAM_META_GROUP: case PHP_STREAM_META_OWNER: case PHP_STREAM_META_ACCESS: - ZVAL_INT(&args[2], *(long *)value); + ZVAL_LONG(&args[2], *(long *)value); break; case PHP_STREAM_META_GROUP_NAME: case PHP_STREAM_META_OWNER_NAME: @@ -1308,7 +1308,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i /* call the mkdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], option); + ZVAL_LONG(&args[1], option); ZVAL_STRING(&zfuncname, USERSTREAM_METADATA); @@ -1356,7 +1356,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i /* call it's stat_url method - set up params first */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], flags); + ZVAL_LONG(&args[1], flags); ZVAL_STRING(&zfuncname, USERSTREAM_STATURL); @@ -1414,7 +1414,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { convert_to_string(&retval); - PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRSIZE(retval)); + PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval)); didread = sizeof(php_stream_dirent); } else if (call_result == FAILURE) { @@ -1489,10 +1489,10 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T switch(castas) { case PHP_STREAM_AS_FD_FOR_SELECT: - ZVAL_INT(&args[0], PHP_STREAM_AS_FD_FOR_SELECT); + ZVAL_LONG(&args[0], PHP_STREAM_AS_FD_FOR_SELECT); break; default: - ZVAL_INT(&args[0], PHP_STREAM_AS_STDIO); + ZVAL_LONG(&args[0], PHP_STREAM_AS_STDIO); break; } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index d2aaef0bc3..25059afe32 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -103,7 +103,7 @@ retry: } estr = php_socket_strerror(err, NULL, 0); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_INT_FMT " bytes failed with errno=%ld %s", - (php_int_t)count, err, estr); + (zend_long)count, err, estr); efree(estr); } @@ -702,7 +702,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ efree(host); return -1; } - bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); } #ifdef SO_BROADCAST diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 675bb78371..4bc8fe8872 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -109,9 +109,9 @@ PHP_FUNCTION(virtual) /* }}} */ #define ADD_LONG(name) \ - add_property_int(return_value, #name, rr->name) + add_property_long(return_value, #name, rr->name) #define ADD_TIME(name) \ - add_property_int(return_value, #name, apr_time_sec(rr->name)); + add_property_long(return_value, #name, apr_time_sec(rr->name)); #define ADD_STRING(name) \ if (rr->name) add_property_string(return_value, #name, (char *) rr->name) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 9d30b53cfc..ca2c99263a 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -313,7 +313,7 @@ static php_size_t sapi_fcgi_ub_write(const char *str, php_size_t str_length TSRM fcgi_request *request = (fcgi_request*) SG(server_context); while (remaining > 0) { - php_int_t ret = fcgi_write(request, FCGI_STDOUT, ptr, remaining); + zend_long ret = fcgi_write(request, FCGI_STDOUT, ptr, remaining); if (ret <= 0) { php_handle_aborted_connection(); @@ -1587,7 +1587,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ char buf[128]; char **env, *p, *q, *var, *val, *t = buf; size_t alloc_size = sizeof(buf); - php_uint_t var_len; + zend_ulong var_len; for (env = environ; env != NULL && *env != NULL; env++) { val = strchr(*env, '='); diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 45f809f5b3..aaea793133 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -993,7 +993,7 @@ static int fcgi_read_request(fcgi_request *req) if ((value = zend_hash_str_find(&fcgi_mgmt_vars, q->var, q->var_len)) == NULL) { continue; } - zlen = Z_STRSIZE_P(value); + zlen = Z_STRLEN_P(value); if ((p + 4 + 4 + q->var_len + zlen) >= (buf + sizeof(buf))) { break; } @@ -1512,7 +1512,7 @@ void fcgi_impersonate(void) void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len) { zval zvalue; - ZVAL_NEW_STR(&zvalue, STR_INIT(value, value_len, 1)); + ZVAL_NEW_STR(&zvalue, zend_string_init(value, value_len, 1)); zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue); } diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index bdc4629c08..c51e5a8ce2 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -255,7 +255,7 @@ static inline int sapi_cli_select(int fd TSRMLS_DC) PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */ { #ifdef PHP_WRITE_STDOUT - php_int_t ret; + zend_long ret; #else php_size_t ret; #endif @@ -425,7 +425,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */ /* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */ #define INI_DEFAULT(name,value)\ - ZVAL_NEW_STR(&tmp, STR_INIT(value, sizeof(value)-1, 1));\ + ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value)-1, 1));\ zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\ static void sapi_cli_ini_defaults(HashTable *configuration_hash) @@ -581,19 +581,19 @@ static void cli_register_file_handles(TSRMLS_D) /* {{{ */ ZVAL_COPY_VALUE(&ic.value, &zin); ic.flags = CONST_CS; - ic.name = STR_INIT("STDIN", sizeof("STDIN")-1, 1); + ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1); ic.module_number = 0; zend_register_constant(&ic TSRMLS_CC); ZVAL_COPY_VALUE(&oc.value, &zout); oc.flags = CONST_CS; - oc.name = STR_INIT("STDOUT", sizeof("STDOUT")-1, 1); + oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1); oc.module_number = 0; zend_register_constant(&oc TSRMLS_CC); ZVAL_COPY_VALUE(&ec.value, &zerr); ec.flags = CONST_CS; - ec.name = STR_INIT("STDERR", sizeof("STDERR")-1, 1); + ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1); ec.module_number = 0; zend_register_constant(&ec TSRMLS_CC); } @@ -963,9 +963,9 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } } - key = STR_INIT("_SERVER", sizeof("_SERVER")-1, 0); + key = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0); zend_is_auto_global(key TSRMLS_CC); - STR_RELEASE(key); + zend_string_release(key); PG(during_request_startup) = 0; switch (behavior) { @@ -1033,7 +1033,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1 TSRMLS_CC) == FAILURE) { exit_status=254; } - ZVAL_INT(&argi, index); + ZVAL_LONG(&argi, index); zend_hash_str_update(&EG(symbol_table).ht, "argi", sizeof("argi")-1, &argi); while (exit_status == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) { len = strlen(input); @@ -1042,7 +1042,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } ZVAL_STRINGL(&argn, input, len); zend_hash_str_update(&EG(symbol_table).ht, "argn", sizeof("argn")-1, &argn); - Z_IVAL(argi) = ++index; + Z_LVAL(argi) = ++index; if (exec_run) { if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1 TSRMLS_CC) == FAILURE) { exit_status=254; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index f381e4ba2b..889b4f2fd4 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1613,12 +1613,12 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p } { /* strip off the colon */ - zend_string *orig_header_name = STR_INIT(client->current_header_name, client->current_header_name_len, 1); + zend_string *orig_header_name = zend_string_init(client->current_header_name, client->current_header_name_len, 1); char *lc_header_name = zend_str_tolower_dup(client->current_header_name, client->current_header_name_len); zend_hash_str_add_ptr(&client->request.headers, lc_header_name, client->current_header_name_len, value); zend_hash_add_ptr(&client->request.headers_original_case, orig_header_name, value); efree(lc_header_name); - STR_RELEASE(orig_header_name); + zend_string_release(orig_header_name); } if (client->current_header_name_allocated) { @@ -1797,7 +1797,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, NULL, 0 TSRMLS_CC); client->addr_str = pestrndup(addr_str->val, addr_str->len, 1); client->addr_str_len = addr_str->len; - STR_RELEASE(addr_str); + zend_string_release(addr_str); } php_http_parser_init(&client->parser, PHP_HTTP_REQUEST); client->request_read = 0; @@ -1919,14 +1919,14 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server if (errstr) { pefree(errstr, 1); } - STR_FREE(escaped_request_uri); + zend_string_free(escaped_request_uri); return SUCCESS; fail: if (errstr) { pefree(errstr, 1); } - STR_FREE(escaped_request_uri); + zend_string_free(escaped_request_uri); return FAILURE; } /* }}} */ @@ -2233,7 +2233,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c if (server_sock == SOCK_ERR) { php_cli_server_logf("Failed to listen on %s:%d (reason: %s)" TSRMLS_CC, host, port, errstr ? errstr->val : "?"); if (errstr) { - STR_RELEASE(errstr); + zend_string_release(errstr); } retval = FAILURE; goto out; diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index 2f2f31fb85..8f2e9be312 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -47,7 +47,7 @@ static int php_embed_deactivate(TSRMLS_D) static inline size_t php_embed_single_write(const char *str, php_size_t str_length) { #ifdef PHP_WRITE_STDOUT - php_int_t ret; + zend_long ret; ret = write(STDOUT_FILENO, str, str_length); if (ret <= 0) return 0; diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index e5018591ee..39621b839c 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -611,7 +611,7 @@ static int fcgi_read_request(fcgi_request *req) if (!value) { continue; } - zlen = Z_STRSIZE_P(value); + zlen = Z_STRLEN_P(value); if ((p + 4 + 4 + key->len + zlen) >= (buf + sizeof(buf))) { break; } @@ -1064,13 +1064,13 @@ char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val) void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len) { zval zvalue; - ZVAL_STR(&zvalue, STR_INIT(value, value_len, 1)); + ZVAL_STR(&zvalue, zend_string_init(value, value_len, 1)); zend_hash_str_add(&fcgi_mgmt_vars, name, name_len, &zvalue); } void fcgi_free_mgmt_var_cb(zval *zv) { - STR_FREE(Z_STR_P(zv)); + zend_string_free(Z_STR_P(zv)); } char *fcgi_get_last_client_ip() /* {{{ */ diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index e447648462..fa3fc763a5 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -127,7 +127,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ } /* full status ? */ - _GET_str = STR_INIT("_GET", sizeof("_GET")-1, 0); + _GET_str = zend_string_init("_GET", sizeof("_GET")-1, 0); full = (fpm_php_get_string_from_table(_GET_str, "full" TSRMLS_CC) != NULL); short_syntax = short_post = NULL; full_separator = full_pre = full_syntax = full_post = NULL; @@ -378,7 +378,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ PUTS(buffer); efree(buffer); - STR_RELEASE(_GET_str); + zend_string_release(_GET_str); if (short_post) { PUTS(short_post); @@ -463,7 +463,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */ efree(buffer); if (tmp_query_string) { - STR_FREE(tmp_query_string); + zend_string_free(tmp_query_string); } } diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index cf26ba8ad5..3a4ed748e3 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -104,7 +104,7 @@ static int php_lsapi_startup(sapi_module_struct *sapi_module) #define INI_DEFAULT(name,value)\ ZVAL_STRING(tmp, value, 0);\ zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\ - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)) + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)) static void sapi_lsapi_ini_defaults(HashTable *configuration_hash) { @@ -212,7 +212,7 @@ static int add_variable( const char * pKey, int keyLen, const char * pValue, int register char * pKey1 = (char *)pKey; MAKE_STD_ZVAL(gpc_element); - Z_STRSIZE_P( gpc_element ) = valLen; + Z_STRLEN_P( gpc_element ) = valLen; Z_STRVAL_P( gpc_element ) = estrndup(pValue, valLen); Z_TYPE_P( gpc_element ) = IS_STRING; #if PHP_MAJOR_VERSION > 4 @@ -233,8 +233,8 @@ static int add_variable_magic_quote( const char * pKey, int keyLen, const char * register char * pKey1 = (char *)pKey; MAKE_STD_ZVAL(gpc_element); - Z_STRSIZE_P( gpc_element ) = valLen; - Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRSIZE_P( gpc_element ), 0 ); + Z_STRLEN_P( gpc_element ) = valLen; + Z_STRVAL_P( gpc_element ) = php_addslashes((char *)pValue, valLen, &Z_STRLEN_P( gpc_element ), 0 ); Z_TYPE_P( gpc_element ) = IS_STRING; #if PHP_MAJOR_VERSION > 4 zend_symtable_update( symtable1, pKey1, keyLen + 1, &gpc_element, sizeof( zval *), (void **) &gpc_element_p ); diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index aaed7a3a88..1fbd18a423 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -87,14 +87,14 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ REGISTER_STRINGL_CONSTANT("PHPDBG_VERSION", PHPDBG_VERSION, sizeof(PHPDBG_VERSION)-1, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_FILE", FILE_PARAM, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_METHOD", METHOD_PARAM, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("PHPDBG_COLOR_PROMPT", PHPDBG_COLOR_PROMPT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_COLOR_NOTICE", PHPDBG_COLOR_NOTICE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("PHPDBG_COLOR_ERROR", PHPDBG_COLOR_ERROR, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_FILE", FILE_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_METHOD", METHOD_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_LINENO", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("PHPDBG_COLOR_PROMPT", PHPDBG_COLOR_PROMPT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_COLOR_NOTICE", PHPDBG_COLOR_NOTICE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_COLOR_ERROR", PHPDBG_COLOR_ERROR, CONST_CS|CONST_PERSISTENT); return SUCCESS; } /* }}} */ diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 35273554f8..a18316a228 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -721,12 +721,12 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co new_break.code = estrndup(expr, expr_len); new_break.code_len = expr_len; - Z_STRSIZE(pv) = expr_len + sizeof("return ;") - 1; - Z_STRVAL(pv) = emalloc(Z_STRSIZE(pv) + 1); + Z_STRLEN(pv) = expr_len + sizeof("return ;") - 1; + Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1); memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, expr, expr_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'; Z_TYPE(pv) = IS_STRING; new_break.ops = zend_compile_string( diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c index 67fa6a267f..a235fe8cb0 100644 --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@ -114,7 +114,7 @@ static void phpdbg_dump_prototype(zval **tmp TSRMLS_DC) /* {{{ */ (void **)&class); } else { zend_get_object_classname(*class, (const char **)&Z_STRVAL_PP(class), - (zend_uint *)&Z_STRSIZE_PP(class) TSRMLS_CC); + (zend_uint *)&Z_STRLEN_PP(class) TSRMLS_CC); } if (is_class == SUCCESS) { @@ -186,14 +186,14 @@ void phpdbg_dump_backtrace(size_t num TSRMLS_DC) /* {{{ */ if (zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), (void**)&tmp, &position) == FAILURE) { - phpdbg_write("frame #%d: {main} at %s:%ld", i, Z_STRVAL_PP(file), Z_IVAL_PP(line)); + phpdbg_write("frame #%d: {main} at %s:%ld", i, Z_STRVAL_PP(file), Z_LVAL_PP(line)); break; } if (user_defined == SUCCESS) { phpdbg_write("frame #%d: ", i++); phpdbg_dump_prototype(tmp TSRMLS_CC); - phpdbg_writeln(" at %s:%ld", Z_STRVAL_PP(file), Z_IVAL_PP(line)); + phpdbg_writeln(" at %s:%ld", Z_STRVAL_PP(file), Z_LVAL_PP(line)); } else { phpdbg_write(" => "); phpdbg_dump_prototype(tmp TSRMLS_CC); diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c index 851e93b3c7..97f88bfa1e 100644 --- a/sapi/phpdbg/phpdbg_info.c +++ b/sapi/phpdbg/phpdbg_info.c @@ -159,7 +159,7 @@ PHPDBG_INFO(vars) /* {{{ */ switch (Z_TYPE_PP(data)) { case IS_STRING: phpdbg_write("(string)\t"); break; - case IS_INT: phpdbg_write("(integer)\t"); break; + case IS_LONG: phpdbg_write("(integer)\t"); break; case IS_DOUBLE: phpdbg_write("(float)\t"); break; case IS_RESOURCE: phpdbg_write("(resource)\t"); break; case IS_ARRAY: phpdbg_write("(array)\t"); break; diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 69ad49ecc6..d91ef3f3f5 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -118,7 +118,7 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ * break; case NUMERIC_PARAM: - add_next_index_int(¶ms, next->num); + add_next_index_long(¶ms, next->num); break; case METHOD_PARAM: diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h index 83474cd7ad..56bacfc459 100644 --- a/sapi/phpdbg/phpdbg_utils.h +++ b/sapi/phpdbg/phpdbg_utils.h @@ -136,10 +136,10 @@ static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, Ha } else if (p->nKeyLength) { Z_TYPE_P(key) = IS_STRING; Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char*)p->arKey : estrndup(p->arKey, p->nKeyLength - 1); - Z_STRSIZE_P(key) = p->nKeyLength - 1; + Z_STRLEN_P(key) = p->nKeyLength - 1; } else { - Z_TYPE_P(key) = IS_INT; - Z_IVAL_P(key) = p->h; + Z_TYPE_P(key) = IS_LONG; + Z_LVAL_P(key) = p->h; } } #endif diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 10834fa9a6..e88622444b 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -182,11 +182,11 @@ static int phpdbg_create_recursive_watchpoint(phpdbg_watchpoint_t *watch TSRMLS_ zend_hash_get_current_key_zval_ex(ht, &key, &position); if (Z_TYPE(key) == IS_STRING) { - new_watch->name_in_parent = zend_strndup(Z_STRVAL(key), Z_STRSIZE(key)); - new_watch->name_in_parent_len = Z_STRSIZE(key); + new_watch->name_in_parent = zend_strndup(Z_STRVAL(key), Z_STRLEN(key)); + new_watch->name_in_parent_len = Z_STRLEN(key); } else { new_watch->name_in_parent = NULL; - new_watch->name_in_parent_len = asprintf(&new_watch->name_in_parent, "%ld", Z_IVAL(key)); + new_watch->name_in_parent_len = asprintf(&new_watch->name_in_parent, "%ld", Z_LVAL(key)); } new_watch->str = NULL; @@ -238,7 +238,7 @@ static int phpdbg_delete_watchpoint_recursive(phpdbg_watchpoint_t *watch, zend_b if (Z_TYPE(key) == IS_STRING) { str_len = asprintf(&str, "%.*s%s%s%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", phpdbg_get_property_key(Z_STRVAL(key)), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":""); } else { - str_len = asprintf(&str, "%.*s%s%li%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", Z_IVAL(key), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":""); + str_len = asprintf(&str, "%.*s%s%li%s", (int)watch->parent->str_len, watch->parent->str, Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"[":"->", Z_LVAL(key), Z_TYPE_P(watch->parent->addr.zv) == IS_ARRAY?"]":""); } if (zend_hash_find(&PHPDBG_G(watchpoints), str, str_len, (void **) &watchpoint) == SUCCESS) { @@ -338,7 +338,7 @@ static int phpdbg_watchpoint_parse_input(char *input, size_t len, HashTable *par watch->flags = 0; zend_hash_get_current_key_zval_ex(parent, key, &position); convert_to_string(key); - watch->str = malloc(i + Z_STRSIZE_P(key) + 2); + watch->str = malloc(i + Z_STRLEN_P(key) + 2); watch->str_len = sprintf(watch->str, "%.*s%s%s", (int)i, input, phpdbg_get_property_key(Z_STRVAL_P(key)), input[len - 1] == ']'?"]":""); efree(key); watch->name_in_parent = zend_strndup(last_index, index_len); diff --git a/win32/registry.c b/win32/registry.c index 75854910e0..8ed838b1d1 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -240,18 +240,18 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) if (pht != NULL) { HashTable *ht = pht; zend_string *index; - php_uint_t num; + zend_ulong num; zval *data; ZEND_HASH_FOREACH_KEY_VAL(ht, num, index, data) { - zend_alter_ini_entry(index, Z_STRVAL_P(data), Z_STRSIZE_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(index, Z_STRVAL_P(data), Z_STRLEN_P(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } ZEND_HASH_FOREACH_END(); /* for (zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS && zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING; zend_hash_move_forward_ex(ht, &pos)) { - zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRSIZE_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } break; */ diff --git a/win32/sendmail.c b/win32/sendmail.c index 85a2e5b4c5..3d61d8b6b4 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -165,7 +165,7 @@ static zend_string *php_win32_mail_trim_header(char *header TSRMLS_DC) } ZVAL_STRINGL(&replace, PHP_WIN32_MAIL_UNIFY_REPLACE, strlen(PHP_WIN32_MAIL_UNIFY_REPLACE)); - regex = STR_INIT(PHP_WIN32_MAIL_UNIFY_REPLACE, sizeof(PHP_WIN32_MAIL_UNIFY_REPLACE)-1, 0); + regex = zend_string_init(PHP_WIN32_MAIL_UNIFY_REPLACE, sizeof(PHP_WIN32_MAIL_UNIFY_REPLACE)-1, 0); //zend_string *php_pcre_replace(zend_string *regex, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int limit, int *replace_count TSRMLS_DC); @@ -178,12 +178,12 @@ static zend_string *php_win32_mail_trim_header(char *header TSRMLS_DC) if (NULL == result) { zval_ptr_dtor(&replace); - STR_FREE(regex); + zend_string_free(regex); return NULL; } ZVAL_STRING(&replace, PHP_WIN32_MAIL_RMVDBL_PATTERN); - regex = STR_INIT(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0); + regex = zend_string_init(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0); result2 = php_pcre_replace(regex, result->val, result->len, @@ -247,7 +247,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message, /* Create a lowercased header for all the searches so we're finally case * insensitive when searching for a pattern. */ - if (NULL == (headers_lc = STR_COPY(headers_trim))) { + if (NULL == (headers_lc = zend_string_copy(headers_trim))) { *error = OUT_OF_MEMORY; return FAILURE; } @@ -276,7 +276,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message, } } else { if (headers_lc) { - STR_FREE(headers_lc); + zend_string_free(headers_lc); } *error = W32_SM_SENDMAIL_FROM_NOT_SET; return FAILURE; @@ -638,19 +638,19 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char c = *e2; *e2 = '\0'; if ((res = Post(p)) != SUCCESS) { - STR_FREE(data_cln); + zend_string_free(data_cln); return(res); } *e2 = c; p = e2; } if ((res = Post(p)) != SUCCESS) { - STR_FREE(data_cln); + zend_string_free(data_cln); return(res); } } - STR_FREE(data_cln); + zend_string_free(data_cln); /*send termination dot */ if ((res = Post("\r\n.\r\n")) != SUCCESS) @@ -709,7 +709,7 @@ static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders T zend_string *dt = php_format_date("r", 1, tNow, 1 TSRMLS_CC); snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", dt->val); - STR_FREE(dt); + zend_string_free(dt); } if (!headers_lc || !strstr(headers_lc, "from:")) { |