master renames phase 1

This commit is contained in:
Anatol Belski 2014-08-25 19:24:55 +02:00
parent 0cf2dbdf58
commit c3e3c98ec6
486 changed files with 11459 additions and 11541 deletions

View file

@ -130,7 +130,7 @@ int main()
exit(1); 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(yes)
], [ ], [
AC_MSG_RESULT(no) AC_MSG_RESULT(no)

View file

@ -46,7 +46,7 @@
/* true multithread-shared globals */ /* true multithread-shared globals */
ZEND_API zend_class_entry *zend_standard_class_def = NULL; 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 zend_write_func_t zend_write;
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); 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); 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_unblock_interruptions)(void);
ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC); 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_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_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_getenv)(char *name, size_t name_len TSRMLS_DC);
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_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); 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 int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ 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; zval *tmp;
zend_string *string_key; zend_string *string_key;
zend_uint_t num_key; zend_ulong num_key;
int i; int i;
for (i = 0; i < indent; i++) { for (i = 0; i < indent; i++) {
@ -193,7 +193,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
{ {
zval *tmp; zval *tmp;
zend_string *string_key; zend_string *string_key;
zend_uint_t num_key; zend_ulong num_key;
int i = 0; int i = 0;
ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) { ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
@ -226,23 +226,23 @@ again:
break; break;
case IS_TRUE: case IS_TRUE:
if (CG(one_char_string)['1']) { 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 { } else {
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0)); ZVAL_NEW_STR(expr_copy, zend_string_init("1", 1, 0));
} }
break; break;
case IS_RESOURCE: { case IS_RESOURCE: {
char buf[sizeof("Resource id #") + MAX_LENGTH_OF_ZEND_INT]; char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
int len; int len;
len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(expr)); 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; break;
case IS_ARRAY: case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion"); zend_error(E_NOTICE, "Array to string conversion");
// TODO: use interned string ??? // 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; break;
case IS_OBJECT: case IS_OBJECT:
if (Z_OBJ_HANDLER_P(expr, cast_object)) { if (Z_OBJ_HANDLER_P(expr, cast_object)) {
@ -278,7 +278,7 @@ again:
case IS_REFERENCE: case IS_REFERENCE:
expr = Z_REFVAL_P(expr); expr = Z_REFVAL_P(expr);
if (Z_TYPE_P(expr) == IS_STRING) { 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; return 1;
} }
goto again; 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); write_func(str->val, len);
} }
STR_RELEASE(str); zend_string_release(str);
return len; return len;
} }
/* }}} */ /* }}} */
@ -343,7 +343,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
zend_printf("%s Object (", "Unknown Class"); zend_printf("%s Object (", "Unknown Class");
} }
if (class_name) { if (class_name) {
STR_RELEASE(class_name); zend_string_release(class_name);
} }
if (Z_OBJ_HANDLER_P(expr, get_properties)) { if (Z_OBJ_HANDLER_P(expr, get_properties)) {
properties = Z_OBJPROP_P(expr); 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"); ZEND_PUTS_EX(" Object\n");
if (class_name) { if (class_name) {
STR_RELEASE(class_name); zend_string_release(class_name);
} }
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
break; break;
@ -739,7 +739,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
zend_interned_strings_init(TSRMLS_C); zend_interned_strings_init(TSRMLS_C);
zend_startup_builtin_functions(TSRMLS_C); zend_startup_builtin_functions(TSRMLS_C);
zend_register_standard_constants(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 #ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C); zend_init_rsrc_plist(TSRMLS_C);
@ -972,7 +972,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
/* }}} */ /* }}} */
BEGIN_EXTERN_C() 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) { if (zend_message_dispatcher_p) {
zend_message_dispatcher_p(message, data TSRMLS_CC); zend_message_dispatcher_p(message, data TSRMLS_CC);
@ -1152,13 +1152,13 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
#endif #endif
va_copy(usr_copy, args); va_copy(usr_copy, args);
len = zend_vspprintf(&str, 0, format, usr_copy); len = zend_vspprintf(&str, 0, format, usr_copy);
ZVAL_NEW_STR(&params[1], STR_INIT(str, len, 0)); ZVAL_NEW_STR(&params[1], zend_string_init(str, len, 0));
efree(str); efree(str);
#ifdef va_copy #ifdef va_copy
va_end(usr_copy); va_end(usr_copy);
#endif #endif
ZVAL_INT(&params[0], type); ZVAL_LONG(&params[0], type);
if (error_filename) { if (error_filename) {
ZVAL_STRING(&params[2], error_filename); ZVAL_STRING(&params[2], error_filename);
@ -1166,7 +1166,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
ZVAL_NULL(&params[2]); ZVAL_NULL(&params[2]);
} }
ZVAL_INT(&params[3], error_lineno); ZVAL_LONG(&params[3], error_lineno);
symbol_table = zend_rebuild_symbol_table(TSRMLS_C); 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; int i;
zend_file_handle *file_handle; zend_file_handle *file_handle;
zend_op_array *op_array; zend_op_array *op_array;
zend_int_t orig_interactive = CG(interactive); zend_long orig_interactive = CG(interactive);
va_start(files, file_count); va_start(files, file_count);
for (i = 0; i < file_count; i++) { for (i = 0; i < file_count; i++) {
@ -1390,7 +1390,7 @@ void free_estring(char **str_p) /* {{{ */
void free_string_zval(zval *zv) /* {{{ */ void free_string_zval(zval *zv) /* {{{ */
{ {
zend_string *str = Z_PTR_P(zv); zend_string *str = Z_PTR_P(zv);
STR_RELEASE(str); zend_string_release(str);
} }
/* }}} */ /* }}} */

View file

@ -274,11 +274,11 @@ char *alloca ();
#endif #endif
#if SIZEOF_ZEND_INT == 4 #if SIZEOF_ZEND_INT == 4
#define MAX_LENGTH_OF_ZEND_INT 11 #define MAX_LENGTH_OF_LONG 11
static const char int_min_digits[] = "2147483648"; static const char long_min_digits[] = "2147483648";
#elif SIZEOF_ZEND_INT == 8 #elif SIZEOF_ZEND_INT == 8
#define MAX_LENGTH_OF_ZEND_INT 20 #define MAX_LENGTH_OF_LONG 20
static const char int_min_digits[] = "9223372036854775808"; static const char long_min_digits[] = "9223372036854775808";
#else #else
#error "Unknown SIZEOF_ZEND_INT" #error "Unknown SIZEOF_ZEND_INT"
#endif #endif
@ -388,7 +388,7 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore
# else /* ! (CRAY || __arm) */ # else /* ! (CRAY || __arm) */
# define XtOffset(p_type, field) \ # 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 */ # endif /* !CRAY */
@ -534,8 +534,8 @@ struct _zend_class_entry {
#include "zend_stream.h" #include "zend_stream.h"
typedef struct _zend_utility_functions { 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); 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); 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 (*write_function)(const char *str, size_t str_length);
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
void (*message_handler)(long message, const void *data TSRMLS_DC); void (*message_handler)(long message, const void *data TSRMLS_DC);
void (*block_interruptions)(void); void (*block_interruptions)(void);
@ -544,7 +544,7 @@ typedef struct _zend_utility_functions {
void (*ticks_function)(int ticks TSRMLS_DC); void (*ticks_function)(int ticks TSRMLS_DC);
void (*on_timeout)(int seconds TSRMLS_DC); void (*on_timeout)(int seconds TSRMLS_DC);
int (*stream_open_function)(const char *filename, zend_file_handle *handle 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); 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 *(*getenv_function)(char *name, size_t name_len TSRMLS_DC);
char *(*resolve_path_function)(const char *filename, int filename_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) #define ZEND_PUTC(c) zend_write(&(c), 1)
BEGIN_EXTERN_C() 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 zend_write_func_t zend_write;
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
extern ZEND_API void (*zend_block_interruptions)(void); 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_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 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_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 size_t (*zend_vspprintf)(char **pbuf, 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 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_getenv)(char *name, size_t name_len TSRMLS_DC);
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_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 #endif
BEGIN_EXTERN_C() 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); ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
END_EXTERN_C() END_EXTERN_C()

View file

@ -166,7 +166,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
case IS_FALSE: case IS_FALSE:
case IS_TRUE: case IS_TRUE:
return "boolean"; return "boolean";
case IS_INT: case IS_LONG:
return "integer"; return "integer";
case IS_DOUBLE: case IS_DOUBLE:
return "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) { if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type TSRMLS_CC) == SUCCESS) {
zval_ptr_dtor(arg); zval_ptr_dtor(arg);
ZVAL_COPY_VALUE(arg, &obj); ZVAL_COPY_VALUE(arg, &obj);
*pl = Z_STRSIZE_P(arg); *pl = Z_STRLEN_P(arg);
*p = Z_STRVAL_P(arg); *p = Z_STRVAL_P(arg);
return SUCCESS; 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)) { if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) {
SEPARATE_ZVAL_NOREF(arg); SEPARATE_ZVAL_NOREF(arg);
if (zend_std_cast_object_tostring(arg, arg, type TSRMLS_CC) == SUCCESS) { 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); *p = Z_STRVAL_P(arg);
return SUCCESS; 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)) { if (!zend_make_printable_zval(z, arg TSRMLS_CC)) {
ZVAL_ZVAL(arg, z, 1, 1); ZVAL_ZVAL(arg, z, 1, 1);
} }
*pl = Z_STRSIZE_P(arg); *pl = Z_STRLEN_P(arg);
*p = Z_STRVAL_P(arg); *p = Z_STRVAL_P(arg);
return SUCCESS; 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':
case 'L': case 'L':
{ {
long *p = va_arg(*va, long *); zend_long *p = va_arg(*va, zend_long *);
if (check_null) { if (check_null) {
zend_bool *p = va_arg(*va, zend_bool *); 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; double d;
int type; 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"; return "long";
} else if (type == IS_DOUBLE) { } else if (type == IS_DOUBLE) {
if (c == 'L') { 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) { if (d > ZEND_INT_MAX) {
*p = ZEND_INT_MAX; *p = ZEND_INT_MAX;
break; 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; break;
case IS_DOUBLE: case IS_DOUBLE:
if (c == 'I') { if (c == 'L') {
if (Z_DVAL_P(arg) > ZEND_INT_MAX) { if (Z_DVAL_P(arg) > ZEND_INT_MAX) {
*p = ZEND_INT_MAX; *p = ZEND_INT_MAX;
break; 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_NULL:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: case IS_TRUE:
case IS_INT: case IS_LONG:
convert_to_int_ex(arg); convert_to_int_ex(arg);
*p = Z_IVAL_P(arg); *p = Z_LVAL_P(arg);
break; break;
case IS_ARRAY: 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)) { switch (Z_TYPE_P(arg)) {
case IS_STRING: case IS_STRING:
{ {
zend_int_t l; zend_long l;
int type; 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"; return "double";
} else if (type == IS_INT) { } else if (type == IS_LONG) {
*p = (double) l; *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_NULL:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: case IS_TRUE:
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
convert_to_double_ex(arg); convert_to_double_ex(arg);
*p = Z_DVAL_P(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 */ /* break omitted intentionally */
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: case IS_TRUE:
convert_to_string_ex(arg); convert_to_string_ex(arg);
case IS_STRING: case IS_STRING:
*p = Z_STRVAL_P(arg); *p = Z_STRVAL_P(arg);
*pl = Z_STRSIZE_P(arg); *pl = Z_STRLEN_P(arg);
if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) { if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) {
return "a valid path"; 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 */ /* break omitted intentionally */
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: 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)) { switch (Z_TYPE_P(arg)) {
case IS_NULL: case IS_NULL:
case IS_STRING: case IS_STRING:
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: 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 'f': case 'A':
case 'H': case 'p': case 'H': case 'p':
case 'S': case 'P': case 'S': case 'P':
case 'i': case 'L':
max_num_args++; max_num_args++;
break; break;
@ -1205,7 +1144,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC)
if (key) { if (key) {
zval member; 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); obj_ht->write_property(obj, &member, value, NULL TSRMLS_CC);
zval_ptr_dtor(&member); 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 *ret, tmp;
ZVAL_INT(&tmp, n); ZVAL_LONG(&tmp, n);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp); ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE; 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 tmp;
ZVAL_INT(&tmp, n); ZVAL_LONG(&tmp, n);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE; 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; 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; 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; 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; 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; 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; 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; 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; 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 tmp;
ZVAL_INT(&tmp, n); ZVAL_LONG(&tmp, n);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE; 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 tmp;
ZVAL_INT(&tmp, l); ZVAL_LONG(&tmp, l);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp); 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; 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; 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; 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; zval tmp;
@ -1756,11 +1695,11 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
case IS_TRUE: case IS_TRUE:
result = zend_hash_index_update(ht, 1, value); result = zend_hash_index_update(ht, 1, value);
break; break;
case IS_INT: case IS_LONG:
result = zend_hash_index_update(ht, Z_IVAL_P(key), value); result = zend_hash_index_update(ht, Z_LVAL_P(key), value);
break; break;
case IS_DOUBLE: 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; break;
default: default:
zend_error(E_WARNING, "Illegal offset type"); 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 tmp;
zval z_key; zval z_key;
ZVAL_INT(&tmp, n); ZVAL_LONG(&tmp, n);
ZVAL_STRINGL(&z_key, key, key_len); ZVAL_STRINGL(&z_key, key, key_len);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, NULL TSRMLS_CC); 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 */ 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 tmp;
zval z_key; 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; zend_module_entry *req_mod;
name_len = strlen(dep->name); 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); 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) { 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 */ /* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name); zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name);
module->module_started = 0; module->module_started = 0;
return FAILURE; return FAILURE;
} }
STR_FREE(lcname); zend_string_free(lcname);
} }
++dep; ++dep;
} }
@ -2109,31 +2048,31 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS
while (dep->name) { while (dep->name) {
if (dep->type == MODULE_DEP_CONFLICTS) { if (dep->type == MODULE_DEP_CONFLICTS) {
name_len = strlen(dep->name); 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); zend_str_tolower_copy(lcname->val, dep->name, name_len);
if (zend_hash_exists(&module_registry, lcname)) { if (zend_hash_exists(&module_registry, lcname)) {
STR_FREE(lcname); zend_string_free(lcname);
/* TODO: Check version relationship */ /* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name); zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name);
return NULL; return NULL;
} }
STR_FREE(lcname); zend_string_free(lcname);
} }
++dep; ++dep;
} }
} }
name_len = strlen(module->name); 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); 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) { 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); zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
STR_RELEASE(lcname); zend_string_release(lcname);
return NULL; return NULL;
} }
STR_RELEASE(lcname); zend_string_release(lcname);
module = module_ptr; module = module_ptr;
EG(current_module) = module; EG(current_module) = module;
@ -2261,7 +2200,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
while (ptr->fname) { while (ptr->fname) {
fname_len = strlen(ptr->fname); fname_len = strlen(ptr->fname);
internal_function->handler = ptr->handler; 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->scope = scope;
internal_function->prototype = NULL; internal_function->prototype = NULL;
if (ptr->flags) { if (ptr->flags) {
@ -2327,7 +2266,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
return FAILURE; 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); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
reg_function = malloc(sizeof(zend_internal_function)); 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) { if (zend_hash_add_ptr(target_function_table, lowercase_name, reg_function) == NULL) {
unload=1; unload=1;
free(reg_function); free(reg_function);
STR_RELEASE(lowercase_name); zend_string_release(lowercase_name);
break; break;
} }
@ -2392,7 +2331,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
} }
ptr++; ptr++;
count++; count++;
STR_RELEASE(lowercase_name); zend_string_release(lowercase_name);
} }
if (unload) { /* before unloading, display all remaining bad function in the module */ if (unload) { /* before unloading, display all remaining bad function in the module */
if (scope) { if (scope) {
@ -2400,12 +2339,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
} }
while (ptr->fname) { while (ptr->fname) {
fname_len = strlen(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); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
if (zend_hash_exists(target_function_table, lowercase_name)) { 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); 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++; ptr++;
} }
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); 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; break;
} }
fname_len = strlen(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); zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
zend_hash_del(target_function_table, lowercase_name); zend_hash_del(target_function_table, lowercase_name);
STR_FREE(lowercase_name); zend_string_free(lowercase_name);
ptr++; ptr++;
i++; 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) /* {{{ */ 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_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 = *orig_class_entry;
class_entry->type = ZEND_INTERNAL_CLASS; 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); 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); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry); zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
STR_RELEASE(lowercase_name); zend_string_release(lowercase_name);
return class_entry; 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; zend_string *lcname;
if (name[0] == '\\') { 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); zend_str_tolower_copy(lcname->val, name+1, name_len-1);
} else { } else {
lcname = STR_ALLOC(name_len, 1); lcname = zend_string_alloc(name_len, 1);
zend_str_tolower_copy(lcname->val, name, name_len); zend_str_tolower_copy(lcname->val, name, name_len);
} }
ce = zend_hash_add_ptr(CG(class_table), lcname, ce); ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
STR_RELEASE(lcname); zend_string_release(lcname);
if (ce) { if (ce) {
ce->refcount++; ce->refcount++;
return SUCCESS; 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_class_entry *disabled_class;
zend_string *key; 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); zend_str_tolower_copy(key->val, class_name, class_name_length);
disabled_class = zend_hash_find_ptr(CG(class_table), key); disabled_class = zend_hash_find_ptr(CG(class_table), key);
if (!disabled_class) { if (!disabled_class) {
@ -3003,7 +2942,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
/* Skip leading \ */ /* Skip leading \ */
if (UNEXPECTED(Z_STRVAL_P(callable)[0] == '\\')) { 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 { } else {
lmname = Z_STR_P(callable); 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; return 1;
} else { } else {
if (lmname == Z_STR_P(callable)) { 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 { } else {
STR_FORGET_HASH_VAL(lmname); zend_string_forget_hash_val(lmname);
} }
zend_str_tolower(lmname->val, lmname->len); zend_str_tolower(lmname->val, lmname->len);
if ((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL) { 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 */ /* 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 > Z_STRVAL_P(callable) &&
*(colon-1) == ':' *(colon-1) == ':'
) { ) {
colon--; colon--;
clen = colon - Z_STRVAL_P(callable); 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 (colon == Z_STRVAL_P(callable)) {
if (error) zend_spprintf(error, 0, "invalid function name"); 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; 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)) { if (!zend_is_callable_check_class(cname, fcc, &strict_class, error TSRMLS_CC)) {
STR_RELEASE(cname); zend_string_release(cname);
EG(scope) = last_scope; EG(scope) = last_scope;
return 0; return 0;
} }
STR_RELEASE(cname); zend_string_release(cname);
EG(scope) = last_scope; EG(scope) = last_scope;
ftable = &fcc->calling_scope->function_table; 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); 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; 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) { } else if (ce_org) {
/* Try to fetch find static method of given class. */ /* Try to fetch find static method of given class. */
mlen = Z_STRSIZE_P(callable); mlen = Z_STRLEN_P(callable);
mname = Z_STR_P(callable); mname = Z_STR_P(callable);
STR_ADDREF(mname); zend_string_addref(mname);
ftable = &ce_org->function_table; ftable = &ce_org->function_table;
fcc->calling_scope = ce_org; fcc->calling_scope = ce_org;
} else { } else {
@ -3082,7 +3021,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
return 0; return 0;
} }
lmname = STR_ALLOC(mlen, 0); lmname = zend_string_alloc(mlen, 0);
zend_str_tolower_copy(lmname->val, mname->val, mlen); zend_str_tolower_copy(lmname->val, mname->val, mlen);
if (strict_class && if (strict_class &&
fcc->calling_scope && fcc->calling_scope &&
@ -3136,7 +3075,7 @@ get_function_via_handler:
fcc->function_handler->internal_function.scope = ce_org; 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.fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
fcc->function_handler->internal_function.function_name = mname; fcc->function_handler->internal_function.function_name = mname;
STR_ADDREF(mname); zend_string_addref(mname);
call_via_handler = 1; call_via_handler = 1;
retval = 1; retval = 1;
} else if (fcc->object->handlers->get_method) { } 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))) { !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->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
if (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); 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); if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname->val);
} }
} }
STR_FREE(lmname); zend_string_free(lmname);
STR_RELEASE(mname); zend_string_release(mname);
if (fcc->object) { if (fcc->object) {
fcc->called_scope = zend_get_class_entry(fcc->object TSRMLS_CC); 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) { if (callable_name) {
char *ptr; 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; ptr = (*callable_name)->val;
memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len);
ptr += fcc->calling_scope->name->len; ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1); memcpy(ptr, "::", sizeof("::") - 1);
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) { } 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) { if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
fcc->called_scope = fcc->calling_scope; 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_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (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); efree(fcc->function_handler);
} }
@ -3356,13 +3295,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
char *ptr; 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; ptr = (*callable_name)->val;
memcpy(ptr, Z_STRVAL_P(obj), Z_STRSIZE_P(obj)); memcpy(ptr, Z_STRVAL_P(obj), Z_STRLEN_P(obj));
ptr += Z_STRSIZE_P(obj); ptr += Z_STRLEN_P(obj);
memcpy(ptr, "::", sizeof("::") - 1); memcpy(ptr, "::", sizeof("::") - 1);
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) { 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) { if (callable_name) {
char *ptr; 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; ptr = (*callable_name)->val;
memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len);
ptr += fcc->calling_scope->name->len; ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1); memcpy(ptr, "::", sizeof("::") - 1);
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) { 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_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) { fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (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); 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 (error) zend_spprintf(error, 0, "array must have exactly two members");
} }
if (callable_name) { if (callable_name) {
*callable_name = STR_INIT("Array", sizeof("Array")-1, 0); *callable_name = zend_string_init("Array", sizeof("Array")-1, 0);
} }
} }
return 0; return 0;
@ -3441,7 +3380,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint
if (callable_name) { if (callable_name) {
zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */ 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->val, ce->name->len);
memcpy((*callable_name)->val + ce->name->len, "::__invoke", sizeof("::__invoke")); 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) { if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_dtor(callable); zval_dtor(callable);
array_init(callable); array_init(callable);
add_next_index_str(callable, STR_COPY(fcc.calling_scope->name)); add_next_index_str(callable, zend_string_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.function_handler->common.function_name));
} }
if (fcc.function_handler && if (fcc.function_handler &&
((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION && ((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_TEMPORARY ||
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) { fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (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); 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); int name_len = strlen(module_name);
zend_module_entry *module; 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); zend_str_tolower_copy(lname->val, module_name, name_len);
module = zend_hash_find_ptr(&module_registry, lname); module = zend_hash_find_ptr(&module_registry, lname);
STR_FREE(lname); zend_string_free(lname);
return module ? module->version : NULL; 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; break;
case ZEND_ACC_PUBLIC: case ZEND_ACC_PUBLIC:
property_info->name = STR_COPY(name); property_info->name = zend_string_copy(name);
break; 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_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); int ret = zend_declare_property_ex(ce, key, property, access_type, NULL TSRMLS_CC);
STR_RELEASE(key); zend_string_release(key);
return ret; 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; 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 property;
ZVAL_INT(&property, value); ZVAL_LONG(&property, value);
return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC); 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 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); 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 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); 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 constant;
ZVAL_INT(&constant, value); ZVAL_LONG(&constant, value);
return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC); 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 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); 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; 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 tmp;
ZVAL_INT(&tmp, value); ZVAL_LONG(&tmp, value);
zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC); 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; zval *property;
zend_class_entry *old_scope = EG(scope); 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; EG(scope) = scope;
property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC); property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC);
EG(scope) = old_scope; EG(scope) = old_scope;
STR_FREE(key); zend_string_free(key);
if (!property) { if (!property) {
return FAILURE; return FAILURE;
} else { } 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; 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 tmp;
ZVAL_INT(&tmp, value); ZVAL_LONG(&tmp, value);
return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC); 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; zval *property;
zend_class_entry *old_scope = EG(scope); 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; EG(scope) = scope;
property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC); property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC);
EG(scope) = old_scope; EG(scope) = old_scope;
STR_FREE(key); zend_string_free(key);
return property; return property;
} }
@ -4132,10 +4071,10 @@ static int same_zval(zval *zv1, zval *zv2) /* {{{ */
case IS_FALSE: case IS_FALSE:
case IS_TRUE: case IS_TRUE:
return 1; return 1;
case IS_INT: case IS_LONG:
return Z_IVAL_P(zv1) == Z_IVAL_P(zv2); return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_DOUBLE: 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_STRING:
case IS_ARRAY: case IS_ARRAY:
case IS_OBJECT: case IS_OBJECT:

View file

@ -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) \ #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; \ 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); \ 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) \ 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_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(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_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_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_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);
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_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_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_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(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_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_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_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); 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_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(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_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_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_long 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_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_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_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); 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(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_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_bool(zend_class_entry *scope, const char *name, int name_length, zend_long 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_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_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_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); 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 */ /* 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_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_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_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); 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_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); 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_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_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) #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_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key) #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_long(zval *arg, zend_ulong idx, zend_long n);
ZEND_API int add_index_null(zval *arg, zend_uint_t idx); ZEND_API int add_index_null(zval *arg, zend_ulong idx);
ZEND_API int add_index_bool(zval *arg, zend_uint_t idx, int b); ZEND_API int add_index_bool(zval *arg, zend_ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, zend_uint_t idx, zend_resource *r); ZEND_API int add_index_resource(zval *arg, zend_ulong idx, zend_resource *r);
ZEND_API int add_index_double(zval *arg, zend_uint_t idx, double d); ZEND_API int add_index_double(zval *arg, zend_ulong idx, double d);
ZEND_API int add_index_str(zval *arg, zend_uint_t idx, zend_string *str); ZEND_API int add_index_str(zval *arg, zend_ulong idx, zend_string *str);
ZEND_API int add_index_string(zval *arg, zend_uint_t idx, const char *str); ZEND_API int add_index_string(zval *arg, zend_ulong 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_stringl(zval *arg, zend_ulong idx, const char *str, uint length);
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);
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);
ZEND_API int add_next_index_null(zval *arg); 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_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, zend_resource *r); 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_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) #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_long(zval *arg, zend_ulong idx, zend_long l);
ZEND_API zval *add_get_index_double(zval *arg, zend_uint_t idx, double d); ZEND_API zval *add_get_index_double(zval *arg, zend_ulong 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_str(zval *arg, zend_ulong 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_string(zval *arg, zend_ulong 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_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 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_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_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_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); 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_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); 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_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_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) #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) #define CHECK_ZVAL_STRING_REL(z)
#endif #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 CHECK_NULL_PATH(p, l) (strlen(p) != l)
#define ZVAL_STRINGL(z, s, l) do { \ #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) } while (0)
#define ZVAL_STRING(z, s) do { \ #define ZVAL_STRING(z, s) do { \
@ -560,11 +560,11 @@ END_EXTERN_C()
} while (0) } while (0)
#define ZVAL_EMPTY_STRING(z) do { \ #define ZVAL_EMPTY_STRING(z) do { \
ZVAL_INT_STR(z, STR_EMPTY_ALLOC()); \ ZVAL_LONG_STR(z, STR_EMPTY_ALLOC()); \
} while (0) } while (0)
#define ZVAL_PSTRINGL(z, s, l) do { \ #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) } while (0)
#define ZVAL_PSTRING(z, s) do { \ #define ZVAL_PSTRING(z, s) do { \
@ -598,10 +598,10 @@ END_EXTERN_C()
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b) #define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
#define RETVAL_NULL() ZVAL_NULL(return_value) #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_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
#define RETVAL_STR(s) ZVAL_STR(return_value, s) #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_NEW_STR(s) ZVAL_NEW_STR(return_value, s)
#define RETVAL_STRING(s) ZVAL_STRING(return_value, s) #define RETVAL_STRING(s) ZVAL_STRING(return_value, s)
#define RETVAL_STRINGL(s, l) ZVAL_STRINGL(return_value, s, l) #define RETVAL_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_BOOL(b) { RETVAL_BOOL(b); return; }
#define RETURN_NULL() { RETVAL_NULL(); 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_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
#define RETURN_STR(s) { RETVAL_STR(s); 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_NEW_STR(s) { RETVAL_NEW_STR(s); return; }
#define RETURN_STRING(s) { RETVAL_STRING(s); return; } #define RETURN_STRING(s) { RETVAL_STRING(s); return; }
#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); 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) Z_PARAM_ARRAY_OR_OBJECT_HT_EX(dest, 0, 0)
/* old "l" */ /* 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); \ 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; \ _expected_type = Z_EXPECTED_LONG; \
error_code = ZPP_ERROR_WRONG_ARG; \ error_code = ZPP_ERROR_WRONG_ARG; \
break; \ break; \
} }
#define Z_PARAM_INT(dest) \ #define Z_PARAM_LONG(dest) \
Z_PARAM_INT_EX(dest, _dummy, 0, 0) Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
/* old "L" */ /* 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); \ 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; \ _expected_type = Z_EXPECTED_LONG; \
error_code = ZPP_ERROR_WRONG_ARG; \ error_code = ZPP_ERROR_WRONG_ARG; \
break; \ break; \
} }
#define Z_PARAM_STRICT_INT(dest) \ #define Z_PARAM_STRICT_LONG(dest) \
Z_PARAM_STRICT_INT_EX(dest, _dummy, 0, 0) Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
/* old "o" */ /* old "o" */
#define Z_PARAM_OBJECT_EX(dest, check_null, separate) \ #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; 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) { if (check_null) {
*is_null = 0; *is_null = 0;
} }
if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) { if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
*dest = Z_IVAL_P(arg); *dest = Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) { if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) {
*dest = ZEND_INT_MAX; *dest = ZEND_INT_MAX;
} else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) { } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) {
*dest = ZEND_INT_MIN; *dest = ZEND_INT_MIN;
} else { } 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)) { } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
double d; double d;
int type; 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 (EXPECTED(type != 0)) {
if (strict && UNEXPECTED(d > ZEND_INT_MAX)) { if (strict && UNEXPECTED(d > ZEND_INT_MAX)) {
*dest = ZEND_INT_MAX; *dest = ZEND_INT_MAX;
} else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) { } else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) {
*dest = ZEND_INT_MIN; *dest = ZEND_INT_MIN;
} else { } else {
*dest = zend_dval_to_ival(d); *dest = zend_dval_to_lval(d);
} }
} else { } else {
return 0; 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)) { if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
*dest = Z_DVAL_P(arg); *dest = Z_DVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
*dest = (double)Z_IVAL_P(arg); *dest = (double)Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
zend_int_t l; zend_long l;
int type; int type;
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) { if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) {

View file

@ -488,16 +488,16 @@ static unsigned int _zend_mm_cookie = 0;
#define ZEND_MM_RESERVE_SIZE (8*1024) #define ZEND_MM_RESERVE_SIZE (8*1024)
#ifdef _WIN64 #ifdef _WIN64
# define ZEND_MM_INT_CONST(x) (x##i64) # define ZEND_MM_LONG_CONST(x) (x##i64)
#else #else
# define ZEND_MM_INT_CONST(x) (x##L) # define ZEND_MM_LONG_CONST(x) (x##L)
#endif #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_FREE_BLOCK ZEND_MM_LONG_CONST(0x0)
#define ZEND_MM_USED_BLOCK ZEND_MM_INT_CONST(0x1) #define ZEND_MM_USED_BLOCK ZEND_MM_LONG_CONST(0x1)
#define ZEND_MM_GUARD_BLOCK ZEND_MM_INT_CONST(0x3) #define ZEND_MM_GUARD_BLOCK ZEND_MM_LONG_CONST(0x3)
#define ZEND_MM_BLOCK(b, type, size) do { \ #define ZEND_MM_BLOCK(b, type, size) do { \
size_t _size = (size); \ 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; *p = mm_block;
mm_block->parent = p; mm_block->parent = p;
mm_block->prev_free_block = mm_block->next_free_block = mm_block; 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 { } else {
size_t m; 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); prev = ZEND_MM_SMALL_FREE_BUCKET(heap, index);
if (prev->prev_free_block == prev) { 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; 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); ZEND_MM_CHECK_TREE(mm_block);
*mm_block->parent = NULL; *mm_block->parent = NULL;
if (mm_block->parent == &heap->large_free_buckets[index]) { 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 { } else {
while (*(cp = &(prev->child[prev->child[1] != NULL])) != NULL) { 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)); 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])) { 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)) { } 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->real_size = 0;
heap->overflow = 0; heap->overflow = 0;
heap->real_peak = 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->size = 0;
heap->peak = 0; heap->peak = 0;
heap->internal = internal; heap->internal = internal;
@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
} }
#if ZEND_DEBUG #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; zend_mm_block *p, *q;
p = ZEND_MM_NEXT_BLOCK(b); 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 (!ZEND_MM_IS_FREE_BLOCK(p)) {
if (p->magic == MEM_BLOCK_VALID) { if (p->magic == MEM_BLOCK_VALID) {
zend_int_t repeated; zend_long repeated;
zend_leak_info leak; zend_leak_info leak;
ZEND_MM_SET_MAGIC(p, MEM_BLOCK_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 #ifdef ZTS
if (ZEND_MM_BAD_THREAD_ID(p)) { if (ZEND_MM_BAD_THREAD_ID(p)) {
if (!silent) { 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; had_problems = 1;
} else { } else {
return zend_mm_check_ptr(heap, ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); 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_size = ZEND_MM_FREE_BLOCK_SIZE(p);
best_fit = 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]) { if (p->child[1]) {
rst = 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) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{ {
size_t res = nmemb; size_t res = nmemb;
zend_uint_t overflow = 0; zend_ulong overflow = 0;
__asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1" __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1"
: "=&a"(res), "=&d" (overflow) : "=&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) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{ {
size_t res = nmemb; size_t res = nmemb;
zend_uint_t overflow = 0; zend_ulong overflow = 0;
#ifdef __ILP32__ /* x32 */ #ifdef __ILP32__ /* x32 */
# define LP_SUFF "l" # 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) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{ {
size_t res; size_t res;
zend_uint_t overflow; zend_ulong overflow;
__asm__ ("umlal %0,%1,%2,%3" __asm__ ("umlal %0,%1,%2,%3"
: "=r"(res), "=r"(overflow) : "=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) static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{ {
size_t res; 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" __asm__ ("mul %0,%2,%3\n\tumulh %1,%2,%3\n\tadds %0,%0,%4\n\tadc %1,%1,xzr"
: "=&r"(res), "=&r"(overflow) : "=&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_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{ {
zend_size_t length; size_t length;
char *p; char *p;
#ifdef ZEND_SIGNALS #ifdef ZEND_SIGNALS
TSRMLS_FETCH(); TSRMLS_FETCH();
@ -2649,7 +2649,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
return p; 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; char *p;
#ifdef ZEND_SIGNALS #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; char *p;
#ifdef ZEND_SIGNALS #ifdef ZEND_SIGNALS

View file

@ -53,7 +53,7 @@ typedef struct _zend_leak_info {
BEGIN_EXTERN_C() 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 *_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; 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_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 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 *_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); ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
/* Standard wrapper macros */ /* Standard wrapper macros */

View file

@ -114,8 +114,8 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS
case IS_NULL: case IS_NULL:
zend_symtable_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), expr); zend_symtable_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), expr);
break; break;
case IS_INT: case IS_LONG:
zend_hash_index_update(Z_ARRVAL_P(result), Z_IVAL_P(offset), expr); zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), expr);
break; break;
case IS_FALSE: case IS_FALSE:
zend_hash_index_update(Z_ARRVAL_P(result), 0, expr); 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); zend_hash_index_update(Z_ARRVAL_P(result), 1, expr);
break; break;
case IS_DOUBLE: 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; break;
default: default:
zend_error(E_ERROR, "Illegal offset type"); 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; break;
case ZEND_UNARY_PLUS: case ZEND_UNARY_PLUS:
ZVAL_INT(&op1, 0); ZVAL_LONG(&op1, 0);
zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC); zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
add_function(result, &op1, &op2 TSRMLS_CC); add_function(result, &op1, &op2 TSRMLS_CC);
zval_dtor(&op2); zval_dtor(&op2);
break; break;
case ZEND_UNARY_MINUS: case ZEND_UNARY_MINUS:
ZVAL_INT(&op1, 0); ZVAL_LONG(&op1, 0);
zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC); zend_ast_evaluate(&op2, (&ast->u.child)[0], scope TSRMLS_CC);
sub_function(result, &op1, &op2 TSRMLS_CC); sub_function(result, &op1, &op2 TSRMLS_CC);
zval_dtor(&op2); zval_dtor(&op2);

View file

@ -364,7 +364,7 @@ ZEND_FUNCTION(zend_version)
Returns number of freed zvals */ Returns number of freed zvals */
ZEND_FUNCTION(gc_collect_cycles) 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 */ Activates the circular reference collector */
ZEND_FUNCTION(gc_enable) 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); 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 */ Deactivates the circular reference collector */
ZEND_FUNCTION(gc_disable) 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); 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; 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) { 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 { } else {
zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); 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; int arg_count, first_extra_arg;
zval *arg; zval *arg;
zend_int_t requested_offset; zend_long requested_offset;
zend_execute_data *ex; 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; return;
} }
@ -534,7 +534,7 @@ ZEND_FUNCTION(strlen)
ZEND_PARSE_PARAMETERS_END(); ZEND_PARSE_PARAMETERS_END();
#endif #endif
RETVAL_INT(s->len); RETVAL_LONG(s->len);
} }
/* }}} */ /* }}} */
@ -549,7 +549,7 @@ ZEND_FUNCTION(strcmp)
return; 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_FUNCTION(strncmp)
{ {
zend_string *s1, *s2; 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; return;
} }
@ -570,7 +570,7 @@ ZEND_FUNCTION(strncmp)
RETURN_FALSE; 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;
} }
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_FUNCTION(strncasecmp)
{ {
zend_string *s1, *s2; 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; return;
} }
@ -606,7 +606,7 @@ ZEND_FUNCTION(strncasecmp)
RETURN_FALSE; 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) ZEND_FUNCTION(each)
{ {
zval *array, *entry, tmp; zval *array, *entry, tmp;
zend_uint_t num_key; zend_ulong num_key;
HashTable *target_hash; HashTable *target_hash;
zend_string *key; zend_string *key;
@ -659,10 +659,10 @@ ZEND_FUNCTION(each)
/* add the key elements */ /* add the key elements */
if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) { 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); if (Z_REFCOUNTED(tmp)) Z_ADDREF(tmp);
} else { } 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_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); 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); old_error_reporting = EG(error_reporting);
if(ZEND_NUM_ARGS() != 0) { 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); 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: repeat:
switch (Z_TYPE_P(val)) { switch (Z_TYPE_P(val)) {
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_STRING: case IS_STRING:
case IS_FALSE: case IS_FALSE:
@ -764,7 +764,7 @@ repeat:
ZVAL_DUP(&c.value, val); ZVAL_DUP(&c.value, val);
zval_ptr_dtor(&val_free); zval_ptr_dtor(&val_free);
c.flags = case_sensitive; /* non persistent */ c.flags = case_sensitive; /* non persistent */
c.name = STR_COPY(name); c.name = zend_string_copy(name);
c.module_number = PHP_USER_CONSTANT; c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) { if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
RETURN_TRUE; RETURN_TRUE;
@ -812,7 +812,7 @@ ZEND_FUNCTION(get_class)
if (!obj) { if (!obj) {
if (EG(scope)) { if (EG(scope)) {
RETURN_STR(STR_COPY(EG(scope)->name)); RETURN_STR(zend_string_copy(EG(scope)->name));
} else { } else {
zend_error(E_WARNING, "get_class() called without object from outside a class"); zend_error(E_WARNING, "get_class() called without object from outside a class");
RETURN_FALSE; RETURN_FALSE;
@ -833,7 +833,7 @@ ZEND_FUNCTION(get_called_class)
} }
if (EG(current_execute_data)->called_scope) { 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)) { } else if (!EG(scope)) {
zend_error(E_WARNING, "get_called_class() called from outside a class"); 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()) { if (!ZEND_NUM_ARGS()) {
ce = EG(scope); ce = EG(scope);
if (ce && ce->parent) { if (ce && ce->parent) {
RETURN_STR(STR_COPY(ce->parent->name)); RETURN_STR(zend_string_copy(ce->parent->name));
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -875,7 +875,7 @@ ZEND_FUNCTION(get_parent_class)
} }
if (ce && ce->parent) { if (ce && ce->parent) {
RETURN_STR(STR_COPY(ce->parent->name)); RETURN_STR(zend_string_copy(ce->parent->name));
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1130,7 +1130,7 @@ ZEND_FUNCTION(get_class_methods)
/* Do not display old-style inherited constructors */ /* Do not display old-style inherited constructors */
if (!key) { 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); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || } else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
mptr->common.scope == ce || mptr->common.scope == ce ||
@ -1140,10 +1140,10 @@ ZEND_FUNCTION(get_class_methods)
*mptr->op_array.refcount > 1 && *mptr->op_array.refcount > 1 &&
(len != key->len || (len != key->len ||
!same_name(key->val, mptr->common.function_name->val, 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); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else { } 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); zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} }
} }
@ -1182,10 +1182,10 @@ ZEND_FUNCTION(method_exists)
RETURN_FALSE; 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); zend_str_tolower_copy(lcname->val, method_name->val, method_name->len);
if (zend_hash_exists(&ce->function_table, lcname)) { if (zend_hash_exists(&ce->function_table, lcname)) {
STR_FREE(lcname); zend_string_free(lcname);
RETURN_TRUE; RETURN_TRUE;
} else { } else {
union _zend_function *func = NULL; union _zend_function *func = NULL;
@ -1202,8 +1202,8 @@ ZEND_FUNCTION(method_exists)
&& (method_name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (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); && memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0);
STR_FREE(lcname); zend_string_free(lcname);
STR_RELEASE(func->common.function_name); zend_string_release(func->common.function_name);
efree(func); efree(func);
return; return;
} }
@ -1287,14 +1287,14 @@ ZEND_FUNCTION(class_exists)
if (!autoload) { if (!autoload) {
if (class_name->val[0] == '\\') { if (class_name->val[0] == '\\') {
/* Ignore leading "\" */ /* 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); zend_str_tolower_copy(lc_name->val, class_name->val + 1, class_name->len - 1);
} else { } 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); zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
} }
ce = zend_hash_find_ptr(EG(class_table), lc_name); 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)); 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 (!autoload) {
if (iface_name->val[0] == '\\') { if (iface_name->val[0] == '\\') {
/* Ignore leading "\" */ /* 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); zend_str_tolower_copy(lc_name->val, iface_name->val + 1, iface_name->len - 1);
} else { } 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); zend_str_tolower_copy(lc_name->val, iface_name->val, iface_name->len);
} }
ce = zend_hash_find_ptr(EG(class_table), lc_name); 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); RETURN_BOOL(ce && ce->ce_flags & ZEND_ACC_INTERFACE);
} }
@ -1373,14 +1373,14 @@ ZEND_FUNCTION(trait_exists)
if (!autoload) { if (!autoload) {
if (trait_name->val[0] == '\\') { if (trait_name->val[0] == '\\') {
/* Ignore leading "\" */ /* 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); zend_str_tolower_copy(lc_name->val, trait_name->val + 1, trait_name->len - 1);
} else { } 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); zend_str_tolower_copy(lc_name->val, trait_name->val, trait_name->len);
} }
ce = zend_hash_find_ptr(EG(class_table), lc_name); 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)); 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] == '\\') { if (name[0] == '\\') {
/* Ignore leading "\" */ /* 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); zend_str_tolower_copy(lcname->val, name + 1, name_len - 1);
} else { } else {
lcname = STR_ALLOC(name_len, 0); lcname = zend_string_alloc(name_len, 0);
zend_str_tolower_copy(lcname->val, name, name_len); zend_str_tolower_copy(lcname->val, name, name_len);
} }
func = zend_hash_find_ptr(EG(function_table), lcname); 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 * 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 */ Cause an intentional memory leak, for testing/debugging purposes */
ZEND_FUNCTION(leak) 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; return;
} }
@ -1531,7 +1531,7 @@ ZEND_FUNCTION(get_included_files)
array_init(return_value); array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) { ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) {
if (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(); } ZEND_HASH_FOREACH_END();
} }
@ -1542,11 +1542,11 @@ ZEND_FUNCTION(get_included_files)
Generates a user-level error/warning/notice message */ Generates a user-level error/warning/notice message */
ZEND_FUNCTION(trigger_error) ZEND_FUNCTION(trigger_error)
{ {
zend_int_t error_type = E_USER_NOTICE; zend_long error_type = E_USER_NOTICE;
char *message; char *message;
int message_len; 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; return;
} }
@ -1574,9 +1574,9 @@ ZEND_FUNCTION(set_error_handler)
{ {
zval *error_handler; zval *error_handler;
zend_string *error_handler_name = NULL; 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; return;
} }
@ -1584,10 +1584,10 @@ ZEND_FUNCTION(set_error_handler)
if (!zend_is_callable(error_handler, 0, &error_handler_name TSRMLS_CC)) { 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", 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"); 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; return;
} }
STR_RELEASE(error_handler_name); zend_string_release(error_handler_name);
} }
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { 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)) { 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", 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"); 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; return;
} }
STR_RELEASE(exception_handler_name); zend_string_release(exception_handler_name);
} }
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { 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 && if (ce->refcount > 1 &&
(ce->name->len != hash_key->key->len || (ce->name->len != hash_key->key->len ||
!same_name(hash_key->key->val, ce->name->val, ce->name->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 { } 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; 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) { 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) { } 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; return 0;
@ -1882,11 +1882,11 @@ ZEND_FUNCTION(create_function)
} }
(*func->refcount)++; (*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'; function_name->val[0] = '\0';
do { 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); } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
static_variables = func->static_variables; static_variables = func->static_variables;
func->static_variables = NULL; func->static_variables = NULL;
@ -1913,7 +1913,7 @@ ZEND_FUNCTION(zend_test_func)
#ifdef ZTS #ifdef ZTS
ZEND_FUNCTION(zend_thread_id) ZEND_FUNCTION(zend_thread_id)
{ {
RETURN_INT((zend_int_t)tsrm_thread_id()); RETURN_LONG((zend_long)tsrm_thread_id());
} }
#endif #endif
#endif #endif
@ -1944,7 +1944,7 @@ ZEND_FUNCTION(get_resources)
{ {
zend_string *type = NULL; zend_string *type = NULL;
zend_string *key; zend_string *key;
zend_uint_t index; zend_ulong index;
zval *val; zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &type) == FAILURE) { 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; const char *include_filename = NULL;
zval arg_array; zval arg_array;
int indent = 0; int indent = 0;
zend_int_t options = 0; zend_long options = 0;
zend_int_t limit = 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; return;
} }
@ -2406,7 +2406,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
lineno = skip->opline->lineno; lineno = skip->opline->lineno;
} }
add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename); 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 /* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
* and debug_baktrace() might have been called by the error_handler. in this case we don't * and debug_baktrace() might have been called by the error_handler. in this case we don't
@ -2424,8 +2424,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
break; break;
} }
if (prev->func && ZEND_USER_CODE(prev->func->common.type)) { 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_str_ex(&stack_frame, "file", sizeof("file")-1, zend_string_copy(prev->func->op_array.filename));
add_assoc_int_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno); add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
break; break;
} }
prev_call = prev; prev_call = prev;
@ -2462,10 +2462,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if (object) { if (object) {
if (func->common.scope) { 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 { } else {
class_name = zend_get_object_classname(object TSRMLS_CC); 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) { 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, "->"); add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->");
} else if (func->common.scope) { } 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, "::"); 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 */ Return backtrace as array */
ZEND_FUNCTION(debug_backtrace) ZEND_FUNCTION(debug_backtrace)
{ {
zend_int_t options = DEBUG_BACKTRACE_PROVIDE_OBJECT; zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
zend_int_t limit = 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; return;
} }
@ -2576,14 +2576,14 @@ ZEND_FUNCTION(extension_loaded)
return; 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); zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
if (zend_hash_exists(&module_registry, lcname)) { if (zend_hash_exists(&module_registry, lcname)) {
RETVAL_TRUE; RETVAL_TRUE;
} else { } else {
RETVAL_FALSE; RETVAL_FALSE;
} }
STR_FREE(lcname); zend_string_free(lcname);
} }
/* }}} */ /* }}} */
@ -2602,13 +2602,13 @@ ZEND_FUNCTION(get_extension_funcs)
return; return;
} }
if (strncasecmp(extension_name, "zend", sizeof("zend"))) { 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); zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
} else { } 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); module = zend_hash_find_ptr(&module_registry, lcname);
STR_FREE(lcname); zend_string_free(lcname);
if (!module) { if (!module) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -2628,7 +2628,7 @@ ZEND_FUNCTION(get_extension_funcs)
array_init(return_value); array_init(return_value);
array = 1; 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(); } ZEND_HASH_FOREACH_END();

View file

@ -61,7 +61,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
efree(arguments); efree(arguments);
/* destruct the function also, then - we have allocated it in get_method */ /* 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); efree(func);
} }
/* }}} */ /* }}} */
@ -96,10 +96,10 @@ ZEND_METHOD(Closure, bind)
ce = closure->func.common.scope; ce = closure->func.common.scope;
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) { } 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); zend_error(E_WARNING, "Class '%s' not found", class_name->val);
STR_RELEASE(class_name); zend_string_release(class_name);
RETURN_NULL(); RETURN_NULL();
} }
STR_RELEASE(class_name); zend_string_release(class_name);
} }
} else { /* scope argument not given; do not change the scope by default */ } else { /* scope argument not given; do not change the scope by default */
ce = closure->func.common.scope; 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.handler = ZEND_MN(Closure___invoke);
invoke->internal_function.module = 0; invoke->internal_function.module = 0;
invoke->internal_function.scope = zend_ce_closure; 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; return invoke;
} }
/* }}} */ /* }}} */
@ -156,15 +156,15 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
{ {
zend_string *lc_name; 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); zend_str_tolower_copy(lc_name->val, method->val, method->len);
if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) &&
memcmp(lc_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0 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); 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); 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>")); ZVAL_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>"));
zend_hash_update(Z_ARRVAL(val), name, &info); zend_hash_update(Z_ARRVAL(val), name, &info);
STR_RELEASE(name); zend_string_release(name);
arg_info++; arg_info++;
} }
zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val); zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val);

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,12 @@
#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); } #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 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 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() \ #define RESET_DOC_COMMENT() \
{ \ { \
if (CG(doc_comment)) { \ if (CG(doc_comment)) { \
STR_RELEASE(CG(doc_comment)); \ zend_string_release(CG(doc_comment)); \
CG(doc_comment) = NULL; \ CG(doc_comment) = NULL; \
} \ } \
} }
@ -67,7 +67,7 @@ typedef union _znode_op {
zend_uint constant; zend_uint constant;
zend_uint var; zend_uint var;
zend_uint num; zend_uint num;
zend_uint_t hash; zend_ulong hash;
zend_uint opline_num; /* Needs to be signed */ zend_uint opline_num; /* Needs to be signed */
zend_op *jmp_addr; zend_op *jmp_addr;
zval *zv; zval *zv;
@ -100,7 +100,7 @@ struct _zend_op {
znode_op op1; znode_op op1;
znode_op op2; znode_op op2;
znode_op result; znode_op result;
zend_uint_t extended_value; zend_ulong extended_value;
uint lineno; uint lineno;
zend_uchar opcode; zend_uchar opcode;
zend_uchar op1_type; zend_uchar op1_type;
@ -214,7 +214,7 @@ char *zend_visibility_string(zend_uint fn_flags);
typedef struct _zend_property_info { typedef struct _zend_property_info {
zend_uint flags; zend_uint flags;
zend_string *name; zend_string *name;
zend_uint_t h; zend_ulong h;
int offset; int offset;
zend_string *doc_comment; zend_string *doc_comment;
zend_class_entry *ce; zend_class_entry *ce;

View file

@ -37,7 +37,7 @@ void free_zend_constant(zval *zv)
zval_internal_dtor(&c->value); zval_internal_dtor(&c->value);
} }
if (c->name) { if (c->name) {
STR_RELEASE(c->name); zend_string_release(c->name);
} }
pefree(c, c->flags & CONST_PERSISTENT); 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)); memcpy(Z_PTR_P(zv), c, sizeof(zend_constant));
c = Z_PTR_P(zv); c = Z_PTR_P(zv);
c->name = STR_COPY(c->name); c->name = zend_string_copy(c->name);
if (!(c->flags & CONST_PERSISTENT)) { if (!(c->flags & CONST_PERSISTENT)) {
zval_copy_ctor(&c->value); zval_copy_ctor(&c->value);
} else { } else {
if (Z_TYPE(c->value) == IS_STRING) { 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) void zend_register_standard_constants(TSRMLS_D)
{ {
REGISTER_MAIN_INT_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_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_LONG_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_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_INT_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_INT_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_INT_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_INT_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
/* true/false constants */ /* true/false constants */
{ {
REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST); 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); ZVAL_NULL(&c.value);
c.flags = flags; 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; c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC); 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); ZVAL_BOOL(&c.value, bval);
c.flags = flags; 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; c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC); 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; zend_constant c;
ZVAL_INT(&c.value, lval); ZVAL_LONG(&c.value, lval);
c.flags = flags; 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; c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC); 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); ZVAL_DOUBLE(&c.value, dval);
c.flags = flags; 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; c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC); 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; 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.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; c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC); 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; zend_string *const_name;
const_name_len = sizeof("\0__CLASS__") + EG(scope)->name->len; 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); 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); 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) { if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
c = emalloc(sizeof(zend_constant)); c = emalloc(sizeof(zend_constant));
memset(c, 0, 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); zend_hash_add_ptr(EG(zend_constants), const_name, c);
} }
STR_RELEASE(const_name); zend_string_release(const_name);
} else { } 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) { if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
c = emalloc(sizeof(zend_constant)); c = emalloc(sizeof(zend_constant));
memset(c, 0, sizeof(zend_constant)); memset(c, 0, sizeof(zend_constant));
ZVAL_EMPTY_STRING(&c->value); ZVAL_EMPTY_STRING(&c->value);
zend_hash_add_ptr(EG(zend_constants), const_name, c); zend_hash_add_ptr(EG(zend_constants), const_name, c);
} }
STR_RELEASE(const_name); zend_string_release(const_name);
} }
return c; return c;
} else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 && } 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, haltname = zend_mangle_property_name(haltoff,
sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0); sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0);
c = zend_hash_find_ptr(EG(zend_constants), haltname); c = zend_hash_find_ptr(EG(zend_constants), haltname);
STR_FREE(haltname); zend_string_free(haltname);
return c; return c;
} else { } else {
return NULL; return NULL;
@ -323,7 +323,7 @@ ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC)
return c ? &c->value : NULL; 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; zend_constant *c;
const char *colon; 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) == ':')) { colon > name && (*(colon - 1) == ':')) {
int class_name_len = colon - name - 1; int class_name_len = colon - name - 1;
int const_name_len = name_len - class_name_len - 2; 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; char *lcname;
zval *ret_constant = NULL; zval *ret_constant = NULL;
ALLOCA_FLAG(use_heap) 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); lcname = do_alloca(class_name_len + 1, use_heap);
zend_str_tolower_copy(lcname, name, class_name_len); zend_str_tolower_copy(lcname, name, class_name_len);
if (!scope) { 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); ret_constant = Z_REFVAL_P(ret_constant);
} }
} }
STR_RELEASE(class_name); zend_string_release(class_name);
STR_FREE(constant_name); zend_string_free(constant_name);
if (ret_constant && Z_CONSTANT_P(ret_constant)) { if (ret_constant && Z_CONSTANT_P(ret_constant)) {
zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC); 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; 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) { (c->flags & CONST_CS) != 0) {
key--; 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 { } else {
key--; 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 #endif
if (!(c->flags & CONST_CS)) { 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); zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name; name = lowercase_name;
} else { } else {
char *slash = strrchr(c->name->val, '\\'); char *slash = strrchr(c->name->val, '\\');
if (slash) { 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); zend_str_tolower(lowercase_name->val, slash - c->name->val);
lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name; 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) { && memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
} }
zend_error(E_NOTICE,"Constant %s already defined", name->val); zend_error(E_NOTICE,"Constant %s already defined", name->val);
STR_RELEASE(c->name); zend_string_release(c->name);
if (!(c->flags & CONST_PERSISTENT)) { if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value); zval_dtor(&c->value);
} }
ret = FAILURE; ret = FAILURE;
} }
if (lowercase_name) { if (lowercase_name) {
STR_RELEASE(lowercase_name); zend_string_release(lowercase_name);
} }
return ret; return ret;
} }

View file

@ -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_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_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_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_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_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_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_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_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_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_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_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_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_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_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) #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); void clean_non_persistent_constants(TSRMLS_D);
ZEND_API zval *zend_get_constant(zend_string *name TSRMLS_DC); 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_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_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_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_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_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 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); ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
void zend_copy_constants(HashTable *target, HashTable *sourc); 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() END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant #define ZEND_CONSTANT_DTOR free_zend_constant

View file

@ -163,7 +163,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type,
Z_SET_REFCOUNT(trace, 0); 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_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); zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC);
return object; return object;
@ -196,7 +196,7 @@ ZEND_METHOD(exception, __clone)
ZEND_METHOD(exception, __construct) ZEND_METHOD(exception, __construct)
{ {
zend_string *message = NULL; zend_string *message = NULL;
long code = 0; zend_long code = 0;
zval *object, *previous = NULL; zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
@ -211,7 +211,7 @@ ZEND_METHOD(exception, __construct)
} }
if (code) { 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) { if (previous) {
@ -225,7 +225,7 @@ ZEND_METHOD(exception, __construct)
ZEND_METHOD(error_exception, __construct) ZEND_METHOD(error_exception, __construct)
{ {
char *message = NULL, *filename = NULL; char *message = NULL, *filename = NULL;
long code = 0, severity = E_ERROR, lineno; zend_long code = 0, severity = E_ERROR, lineno;
zval *object, *previous = NULL; zval *object, *previous = NULL;
int argc = ZEND_NUM_ARGS(), message_len, filename_len; int argc = ZEND_NUM_ARGS(), message_len, filename_len;
@ -240,21 +240,21 @@ ZEND_METHOD(error_exception, __construct)
} }
if (code) { 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) { if (previous) {
zend_update_property(default_exception_ce, object, "previous", sizeof("previous")-1, previous TSRMLS_CC); 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) { if (argc >= 4) {
zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC); zend_update_property_string(default_exception_ce, object, "file", sizeof("file")-1, filename TSRMLS_CC);
if (argc < 5) { if (argc < 5) {
lineno = 0; /* invalidate lineno */ 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 */ /* {{{ gettraceasstring() macros */
#define TRACE_APPEND_CHR(chr) \ #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 str->val[str->len - 1] = chr
#define TRACE_APPEND_STRL(v, l) \ #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)); \ 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); \ zend_error(E_WARNING, "Value for %s is no string", key); \
TRACE_APPEND_STR("[unknown]"); \ TRACE_APPEND_STR("[unknown]"); \
} else { \ } 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) } while (0)
@ -362,7 +362,7 @@ ZEND_METHOD(error_exception, getSeverity)
#define TRACE_ARG_APPEND(vallen) do { \ #define TRACE_ARG_APPEND(vallen) do { \
int len = str->len; \ 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); \ memmove(str->val + len - l_added + 1 + vallen, str->val + len - l_added + 1, l_added); \
} while (0) } while (0)
@ -386,12 +386,12 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{
case IS_STRING: { case IS_STRING: {
int l_added; int l_added;
TRACE_APPEND_CHR('\''); 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_STRL(Z_STRVAL_P(arg), 15);
TRACE_APPEND_STR("...', "); TRACE_APPEND_STR("...', ");
l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
} else { } else {
l_added = Z_STRSIZE_P(arg); l_added = Z_STRLEN_P(arg);
TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added); TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added);
TRACE_APPEND_STR("', "); TRACE_APPEND_STR("', ");
l_added += 3 + 1; 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, "); TRACE_APPEND_STR("true, ");
break; break;
case IS_RESOURCE: { case IS_RESOURCE: {
zend_int_t lval = Z_RES_HANDLE_P(arg); zend_long lval = Z_RES_HANDLE_P(arg);
char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1]; char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */
TRACE_APPEND_STR("Resource id #"); TRACE_APPEND_STR("Resource id #");
TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STRL(s_tmp, l_tmp);
TRACE_APPEND_STR(", "); TRACE_APPEND_STR(", ");
break; break;
} }
case IS_INT: { case IS_LONG: {
zend_int_t lval = Z_IVAL_P(arg); zend_long lval = Z_LVAL_P(arg);
char s_tmp[MAX_LENGTH_OF_ZEND_INT + 1]; char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */
TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STRL(s_tmp, l_tmp);
TRACE_APPEND_STR(", "); 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; char *s_tmp;
int len; 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); 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)++); len = sprintf(s_tmp, "#%d ", (*num)++);
TRACE_APPEND_STRL(s_tmp, len); TRACE_APPEND_STRL(s_tmp, len);
efree(s_tmp); efree(s_tmp);
@ -536,8 +536,8 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st
} else{ } else{
tmp = zend_hash_str_find(ht, "line", sizeof("line")-1); tmp = zend_hash_str_find(ht, "line", sizeof("line")-1);
if (tmp) { if (tmp) {
if (Z_TYPE_P(tmp) == IS_INT) { if (Z_TYPE_P(tmp) == IS_LONG) {
line = Z_IVAL_P(tmp); line = Z_LVAL_P(tmp);
} else { } else {
zend_error(E_WARNING, "Line is no long"); zend_error(E_WARNING, "Line is no long");
line = 0; line = 0;
@ -545,7 +545,7 @@ static void _build_trace_string(zval *frame, zend_uint_t index, zend_string **st
} else { } else {
line = 0; 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); len = sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_P(file), line);
TRACE_APPEND_STRL(s_tmp, len); TRACE_APPEND_STRL(s_tmp, len);
efree(s_tmp); 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) ZEND_METHOD(exception, getTraceAsString)
{ {
zval *trace, *frame; zval *trace, *frame;
zend_uint_t index; zend_ulong index;
zend_string *str, *key; zend_string *str, *key;
int num = 0, len; 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; 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); 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) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(trace), index, key, frame) {
@ -686,18 +686,18 @@ ZEND_METHOD(exception, __toString)
ZVAL_UNDEF(&trace); 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", 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_OBJCE_P(exception)->name->val, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line),
(Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
prev_str->len ? "\n\nNext " : "", prev_str->val); prev_str->len ? "\n\nNext " : "", prev_str->val);
} else { } else {
str = zend_strpprintf(0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s", 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_OBJCE_P(exception)->name->val, Z_STRVAL(file), Z_LVAL(line),
(Z_TYPE(trace) == IS_STRING && Z_STRSIZE(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n",
prev_str->len ? "\n\nNext " : "", prev_str->val); prev_str->len ? "\n\nNext " : "", prev_str->val);
} }
STR_RELEASE(prev_str); zend_string_release(prev_str);
zval_dtor(&message); zval_dtor(&message);
zval_dtor(&file); zval_dtor(&file);
zval_dtor(&line); 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, "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_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, "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, "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); 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); 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 = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC);
error_exception_ce->create_object = zend_error_exception_new; 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); zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC);
} }
if (code) { 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); 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; zval ex;
zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC); zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
ZVAL_OBJ(&ex, obj); 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; 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); line = zend_read_property(default_exception_ce, &zv, "line", sizeof("line")-1, 1 TSRMLS_CC);
convert_to_string_ex(file); convert_to_string_ex(file);
file = (Z_STRSIZE_P(file) > 0) ? file : NULL; file = (Z_STRLEN_P(file) > 0) ? file : NULL;
line = (Z_TYPE_P(line) == IS_INT) ? line : NULL; line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL;
} else { } else {
file = NULL; file = NULL;
line = 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); 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_string_ex(file);
convert_to_int_ex(line); 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 { } else {
zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val); zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val);
} }

View file

@ -516,7 +516,7 @@ static inline zval* make_real_object(zval *object_ptr TSRMLS_DC)
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_TYPE_P(object) == IS_NULL if (Z_TYPE_P(object) == IS_NULL
|| Z_TYPE_P(object) == IS_FALSE || 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); zval_ptr_dtor_nogc(object);
object_init(object); object_init(object);
zend_error(E_WARNING, "Creating default object from empty value"); 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; 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; zend_string *key;
ALLOCA_FLAG(use_heap); 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; zend_arg_info *cur_arg_info;
char *need_msg; 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; zend_arg_info *cur_arg_info;
char *need_msg; 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 || if (Z_TYPE_P(object) == IS_NULL ||
Z_TYPE_P(object) == IS_FALSE || 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; zend_object *obj;
zval_ptr_dtor(object); 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) { if ((int)offset < 0) {
zend_error(E_WARNING, "Illegal string offset: %d", offset); zend_error(E_WARNING, "Illegal string offset: %d", offset);
STR_RELEASE(Z_STR_P(str)); zend_string_release(Z_STR_P(str));
if (result) { if (result) {
ZVAL_NULL(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); old_str = Z_STR_P(str);
if (offset >= Z_STRSIZE_P(str)) { if (offset >= Z_STRLEN_P(str)) {
int old_len = Z_STRSIZE_P(str); int old_len = Z_STRLEN_P(str);
Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), offset + 1, 0); Z_STR_P(str) = zend_string_realloc(Z_STR_P(str), offset + 1, 0);
Z_TYPE_INFO_P(str) = IS_STRING_EX; Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len); memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
Z_STRVAL_P(str)[offset+1] = 0; Z_STRVAL_P(str)[offset+1] = 0;
} else if (IS_INTERNED(Z_STR_P(str))) { } 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; 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); zend_string *tmp = zval_get_string(value);
Z_STRVAL_P(str)[offset] = tmp->val[0]; Z_STRVAL_P(str)[offset] = tmp->val[0];
STR_RELEASE(tmp); zend_string_release(tmp);
} else { } else {
Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0];
if (value_type == IS_TMP_VAR) { 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; T(result->u.var).var = &T->str_offset.str;
*/ */
STR_RELEASE(old_str); zend_string_release(old_str);
if (result) { if (result) {
zend_uchar c = (zend_uchar)Z_STRVAL_P(str)[offset]; zend_uchar c = (zend_uchar)Z_STRVAL_P(str)[offset];
if (CG(one_char_string)[c]) { 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 { } 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; zval *retval;
zend_string *offset_key; zend_string *offset_key;
zend_uint_t hval; zend_ulong hval;
if (EXPECTED(Z_TYPE_P(dim) == IS_INT)) { if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) {
hval = Z_IVAL_P(dim); hval = Z_LVAL_P(dim);
num_index: num_index:
retval = zend_hash_index_find(ht, hval); retval = zend_hash_index_find(ht, hval);
if (retval == NULL) { if (retval == NULL) {
@ -1092,7 +1092,7 @@ str_index:
offset_key = STR_EMPTY_ALLOC(); offset_key = STR_EMPTY_ALLOC();
goto str_index; goto str_index;
case IS_DOUBLE: case IS_DOUBLE:
hval = zend_dval_to_ival(Z_DVAL_P(dim)); hval = zend_dval_to_lval(Z_DVAL_P(dim));
goto num_index; goto num_index;
case IS_RESOURCE: 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)); 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); ZVAL_INDIRECT(result, retval);
} }
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { } 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); zval_dtor(container);
convert_to_array: convert_to_array:
ZVAL_NEW_ARR(container); ZVAL_NEW_ARR(container);
@ -1156,10 +1156,10 @@ convert_to_array:
SEPARATE_STRING(container); SEPARATE_STRING(container);
} }
if (UNEXPECTED(Z_TYPE_P(dim) != IS_INT)) { if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
switch(Z_TYPE_P(dim)) { switch(Z_TYPE_P(dim)) {
case IS_STRING: 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; break;
} }
if (type != BP_VAR_UNSET) { if (type != BP_VAR_UNSET) {
@ -1177,12 +1177,12 @@ convert_to_array:
break; break;
} }
offset = zval_get_int(dim); offset = zval_get_long(dim);
} else { } 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); ZVAL_STR_OFFSET(result, container, offset);
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (!Z_OBJ_HT_P(container)->read_dimension) { 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); retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
ZVAL_COPY(result, retval); ZVAL_COPY(result, retval);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { } 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)) { switch(Z_TYPE_P(dim)) {
/* case IS_INT: */ /* case IS_LONG: */
case IS_STRING: 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; break;
} }
if (type != BP_VAR_IS) { if (type != BP_VAR_IS) {
@ -1305,12 +1305,12 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
break; break;
} }
offset = zval_get_int(dim); offset = zval_get_long(dim);
} else { } 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) { if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Uninitialized string offset: %ld", offset); 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]; zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[offset];
if (CG(one_char_string)[c]) { 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 { } 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)) { } 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 && if (type != BP_VAR_UNSET &&
((Z_TYPE_P(container) == IS_NULL || ((Z_TYPE_P(container) == IS_NULL ||
Z_TYPE_P(container) == IS_FALSE || 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); zval_ptr_dtor_nogc(container);
object_init(container); object_init(container);
} else { } else {

View file

@ -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_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 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); 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) 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: case IS_TRUE:
result = 1; result = 1;
break; break;
case IS_INT: case IS_LONG:
result = (Z_IVAL_P(op)?1:0); result = (Z_LVAL_P(op)?1:0);
break; break;
case IS_RESOURCE: case IS_RESOURCE:
result = (Z_RES_HANDLE_P(op)?1:0); result = (Z_RES_HANDLE_P(op)?1:0);
@ -97,8 +97,8 @@ again:
result = (Z_DVAL_P(op) ? 1 : 0); result = (Z_DVAL_P(op) ? 1 : 0);
break; break;
case IS_STRING: case IS_STRING:
if (Z_STRSIZE_P(op) == 0 if (Z_STRLEN_P(op) == 0
|| (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
result = 0; result = 0;
} else { } else {
result = 1; 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 uint zend_get_executed_lineno(TSRMLS_D);
ZEND_API zend_bool zend_is_executing(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_unset_timeout(TSRMLS_D);
ZEND_API void zend_timeout(int dummy); ZEND_API void zend_timeout(int dummy);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC); ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);

View file

@ -531,36 +531,36 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas
if (!const_value) { if (!const_value) {
char *actual = Z_STRVAL_P(p); 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; int len;
zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); 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) { if (inline_change) {
zend_string *tmp = STR_INIT(colon + 1, len, 0); zend_string *tmp = zend_string_init(colon + 1, len, 0);
STR_RELEASE(Z_STR_P(p)); zend_string_release(Z_STR_P(p));
Z_STR_P(p) = tmp; Z_STR_P(p) = tmp;
} else { } 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; Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
} else { } else {
zend_string *save = Z_STR_P(p); zend_string *save = Z_STR_P(p);
char *slash; 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))) { if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
actual = slash + 1; actual = slash + 1;
actual_len -= (actual - Z_STRVAL_P(p)); actual_len -= (actual - Z_STRVAL_P(p));
if (inline_change) { 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_STR_P(p) = s;
Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE; Z_TYPE_FLAGS_P(p) = IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE;
} }
} }
if (actual[0] == '\\') { if (actual[0] == '\\') {
if (inline_change) { if (inline_change) {
memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p)); memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p));
--Z_STRSIZE_P(p); --Z_STRLEN_P(p);
} else { } else {
++actual; ++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); zend_error(E_ERROR, "Undefined constant '%s'", save->val);
} }
if (inline_change) { if (inline_change) {
STR_RELEASE(save); zend_string_release(save);
} }
save = NULL; 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)) ? Z_TYPE_INFO_P(p) = IS_INTERNED(Z_STR_P(p)) ?
IS_INTERNED_STRING_EX : IS_STRING_EX; IS_INTERNED_STRING_EX : IS_STRING_EX;
if (save && save->val != actual) { if (save && save->val != actual) {
STR_RELEASE(save); zend_string_release(save);
} }
} }
} }
} else { } else {
if (inline_change) { if (inline_change) {
STR_RELEASE(Z_STR_P(p)); zend_string_release(Z_STR_P(p));
} }
ZVAL_COPY_VALUE(p, const_value); ZVAL_COPY_VALUE(p, const_value);
if (Z_OPT_CONSTANT_P(p)) { 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); efree(error);
} }
if (callable_name) { if (callable_name) {
STR_RELEASE(callable_name); zend_string_release(callable_name);
} }
if (EG(current_execute_data) == &dummy_execute_data) { if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_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); zend_error(E_STRICT, "%s", error);
efree(error); efree(error);
} }
STR_RELEASE(callable_name); zend_string_release(callable_name);
} }
func = fci_cache->function_handler; 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); zend_vm_stack_free_call_frame(call TSRMLS_CC);
if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
STR_RELEASE(func->common.function_name); zend_string_release(func->common.function_name);
} }
efree(func); 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] == '\\') { 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); zend_str_tolower_copy(lc_name->val, name->val + 1, name->len - 1);
} else { } 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); 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); ce = zend_hash_find_ptr(EG(class_table), lc_name);
if (ce) { if (ce) {
if (!key) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return ce; 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 (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!key) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return NULL; 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; EG(autoload_func) = func;
} else { } else {
if (!key) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return NULL; 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() */ /* 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 (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) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return NULL; 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 (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
if (!key) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return NULL; 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] == '\\') { if (name->val[0] == '\\') {
ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1); ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1);
} else { } else {
ZVAL_STR(&args[0], STR_COPY(name)); ZVAL_STR(&args[0], zend_string_copy(name));
} }
fcall_info.size = sizeof(fcall_info); fcall_info.size = sizeof(fcall_info);
fcall_info.function_table = EG(function_table); 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.symbol_table = NULL;
fcall_info.retval = &local_retval; fcall_info.retval = &local_retval;
fcall_info.param_count = 1; 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); ce = zend_hash_find_ptr(EG(class_table), lc_name);
} }
if (!key) { if (!key) {
STR_FREE(lc_name); zend_string_free(lc_name);
} }
return ce; return ce;
} }
@ -1066,11 +1066,11 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
int retval; int retval;
if (retval_ptr) { 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), "return ", sizeof("return ") - 1);
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';'; Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0'; Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
} else { } else {
ZVAL_STRINGL(&pv, str, str_len); ZVAL_STRINGL(&pv, str, str_len);
} }
@ -1183,7 +1183,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
} }
switch (opline->opcode) { switch (opline->opcode) {
case ZEND_GOTO: 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); zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC);
} }
/* break omitted intentionally */ /* break omitted intentionally */
@ -1360,7 +1360,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */
#define SIGPROF 27 #define SIGPROF 27
#endif #endif
void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */ void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
{ {
TSRMLS_FETCH(); 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) {
if (!execute_data->symbol_table) { 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; zend_op_array *op_array = &execute_data->func->op_array;
int i; 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) {
if (!execute_data->symbol_table) { 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; zend_op_array *op_array = &execute_data->func->op_array;
int i; int i;

View file

@ -43,7 +43,7 @@ typedef struct _zend_generator {
/* Variable to put sent value into */ /* Variable to put sent value into */
zval *send_target; zval *send_target;
/* Largest used integer key for auto-incrementing keys */ /* 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_GENERATOR_* flags */
zend_uchar flags; zend_uchar flags;

View file

@ -112,7 +112,7 @@ struct _zend_compiler_globals {
zend_llist open_files; zend_llist open_files;
zend_int_t catch_begin; zend_long catch_begin;
struct _zend_ini_parser_param *ini_parser_param; struct _zend_ini_parser_param *ini_parser_param;
@ -188,7 +188,7 @@ struct _zend_executor_globals {
zval This; zval This;
zend_int_t precision; zend_long precision;
int ticks_count; int ticks_count;
@ -220,7 +220,7 @@ struct _zend_executor_globals {
zend_class_entry *exception_class; zend_class_entry *exception_class;
/* timeout support */ /* timeout support */
zend_int_t timeout_seconds; zend_long timeout_seconds;
int lambda_count; int lambda_count;

View file

@ -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) 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 nIndex;
uint idx; uint idx;
Bucket *p; Bucket *p;
h = STR_HASH_VAL(key); h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask; nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex]; idx = ht->arHash[nIndex];
while (idx != INVALID_IDX) { while (idx != INVALID_IDX) {
@ -205,7 +205,7 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zen
return NULL; 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 nIndex;
uint idx; uint idx;
@ -227,7 +227,7 @@ static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht,
return NULL; 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 nIndex;
uint idx; 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) 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 nIndex;
uint idx; uint idx;
Bucket *p; 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); zend_hash_packed_to_hash(ht);
} }
h = STR_HASH_VAL(key); h = zend_string_hash_val(key);
if ((flag & HASH_ADD_NEW) == 0) { if ((flag & HASH_ADD_NEW) == 0) {
p = zend_hash_find_bucket(ht, key); 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 = ht->arData + idx;
p->h = h; p->h = h;
p->key = key; p->key = key;
STR_ADDREF(key); zend_string_addref(key);
ZVAL_COPY_VALUE(&p->val, pData); ZVAL_COPY_VALUE(&p->val, pData);
nIndex = h & ht->nTableMask; nIndex = h & ht->nTableMask;
Z_NEXT(p->val) = ht->arHash[nIndex]; 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_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); 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; return ret;
} }
ZEND_API zval *_zend_hash_str_update(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) 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); 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; return ret;
} }
ZEND_API zval *_zend_hash_str_update_ind(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) 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); 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; return ret;
} }
ZEND_API zval *_zend_hash_str_add(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) 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); 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; return ret;
} }
ZEND_API zval *_zend_hash_str_add_new(HashTable *ht, const char *str, int len, zval *pData ZEND_FILE_LINE_DC) 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); 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; 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; 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); 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 nIndex;
uint idx; uint idx;
@ -430,7 +430,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab
ht->pDestructor(&p->val); ht->pDestructor(&p->val);
} }
ZVAL_COPY_VALUE(&p->val, pData); 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; ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
} }
return &p->val; 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) { if (ht->nInternalPointer == INVALID_IDX) {
ht->nInternalPointer = h; 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; ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
} }
p->h = h; p->h = h;
@ -490,7 +490,7 @@ convert_to_hash:
} }
ZVAL_COPY_VALUE(&p->val, pData); ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS(); 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; ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
} }
return &p->val; return &p->val;
@ -505,7 +505,7 @@ convert_to_hash:
if (ht->nInternalPointer == INVALID_IDX) { if (ht->nInternalPointer == INVALID_IDX) {
ht->nInternalPointer = 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; ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
} }
p = ht->arData + idx; p = ht->arData + idx;
@ -520,22 +520,22 @@ convert_to_hash:
return &p->val; 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); 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); 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); 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); 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) { if (p->key) {
STR_RELEASE(p->key); zend_string_release(p->key);
} }
if (ht->pDestructor) { if (ht->pDestructor) {
zval tmp; 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_API int zend_hash_del(HashTable *ht, zend_string *key)
{ {
zend_uint_t h; zend_ulong h;
uint nIndex; uint nIndex;
uint idx; uint idx;
Bucket *p; Bucket *p;
@ -684,7 +684,7 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
return FAILURE; return FAILURE;
} }
h = STR_HASH_VAL(key); h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask; nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex]; 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_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
{ {
zend_uint_t h; zend_ulong h;
uint nIndex; uint nIndex;
uint idx; uint idx;
Bucket *p; Bucket *p;
@ -723,7 +723,7 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
return FAILURE; return FAILURE;
} }
h = STR_HASH_VAL(key); h = zend_string_hash_val(key);
nIndex = h & ht->nTableMask; nIndex = h & ht->nTableMask;
idx = ht->arHash[nIndex]; 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_API int zend_hash_str_del(HashTable *ht, const char *str, int len)
{ {
zend_uint_t h; zend_ulong h;
uint nIndex; uint nIndex;
uint idx; uint idx;
Bucket *p; 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_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len)
{ {
zend_uint_t h; zend_ulong h;
uint nIndex; uint nIndex;
uint idx; uint idx;
Bucket *p; Bucket *p;
@ -843,7 +843,7 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len)
return FAILURE; 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 nIndex;
uint idx; uint idx;
@ -900,7 +900,7 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
ht->pDestructor(&p->val); ht->pDestructor(&p->val);
} }
if (p->key) { if (p->key) {
STR_RELEASE(p->key); zend_string_release(p->key);
} }
} }
if (ht->nTableMask) { if (ht->nTableMask) {
@ -925,7 +925,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
ht->pDestructor(&p->val); ht->pDestructor(&p->val);
} }
if (p->key) { if (p->key) {
STR_RELEASE(p->key); zend_string_release(p->key);
} }
} }
ht->nNumUsed = 0; ht->nNumUsed = 0;
@ -1254,7 +1254,7 @@ ZEND_API void zend_array_dup(HashTable *target, HashTable *source)
q->h = p->h; q->h = p->h;
q->key = p->key; q->key = p->key;
if (q->key) { if (q->key) {
STR_ADDREF(q->key); zend_string_addref(q->key);
} }
nIndex = q->h & target->nTableMask; nIndex = q->h & target->nTableMask;
Z_NEXT(q->val) = target->arHash[nIndex]; 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_API zval *zend_hash_str_find(const HashTable *ht, const char *str, int len)
{ {
zend_uint_t h; zend_ulong h;
Bucket *p; Bucket *p;
IS_CONSISTENT(ht); 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_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len)
{ {
zend_uint_t h; zend_ulong h;
Bucket *p; Bucket *p;
IS_CONSISTENT(ht); 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; 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; 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; 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 */ /* 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; uint idx = *pos;
Bucket *p; 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; p = ht->arData + idx;
if (p->key) { if (p->key) {
if (duplicate) { if (duplicate) {
*str_index = STR_COPY(p->key); *str_index = zend_string_copy(p->key);
} else { } else {
*str_index = p->key; *str_index = p->key;
} }
return HASH_KEY_IS_STRING; return HASH_KEY_IS_STRING;
} else { } else {
*num_index = p->h; *num_index = p->h;
return HASH_KEY_IS_INT; return HASH_KEY_IS_LONG;
} }
} }
return HASH_KEY_NON_EXISTENT; 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; p = ht->arData + idx;
if (p->key) { if (p->key) {
ZVAL_STR(key, p->key); ZVAL_STR(key, p->key);
STR_ADDREF(p->key); zend_string_addref(p->key);
} else { } 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) { if (p->key) {
return HASH_KEY_IS_STRING; return HASH_KEY_IS_STRING;
} else { } else {
return HASH_KEY_IS_INT; return HASH_KEY_IS_LONG;
} }
} }
return HASH_KEY_NON_EXISTENT; 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 = ht->arData + j;
p->h = j; p->h = j;
if (p->key) { if (p->key) {
STR_RELEASE(p->key); zend_string_release(p->key);
p->key = NULL; p->key = NULL;
} }
} }

View file

@ -26,7 +26,7 @@
#include "zend.h" #include "zend.h"
#define HASH_KEY_IS_STRING 1 #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_EXISTENT 3
#define HASH_KEY_NON_EXISTANT HASH_KEY_NON_EXISTENT /* Keeping old define (with typo) for backward compatibility */ #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 #define HASH_MASK_CONSISTENCY 0x60
typedef struct _zend_hash_key { typedef struct _zend_hash_key {
zend_uint_t h; zend_ulong h;
zend_string *key; zend_string *key;
} zend_hash_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) \ #define zend_hash_str_add_new(ht, key, len, pData) \
_zend_hash_str_add_new(ht, key, len, pData ZEND_FILE_LINE_CC) _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_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_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);
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);
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);
ZEND_API zval *_zend_hash_next_index_insert(HashTable *ht, 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); 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) \ #define zend_hash_next_index_insert_new(ht, pData) \
_zend_hash_next_index_insert_new(ht, pData ZEND_FILE_LINE_CC) _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_add_empty_element(HashTable *ht, zend_string *key);
ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, int len); 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_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(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_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 */ /* Data retreival */
ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key); 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_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 */ /* Misc */
ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key); 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_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 */ /* traversing */
#define zend_hash_has_more_elements_ex(ht, pos) \ #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_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_forward_ex(HashTable *ht, HashPosition *pos);
ZEND_API int zend_hash_move_backwards_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 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 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); 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 { typedef struct _HashPointer {
HashPosition pos; HashPosition pos;
HashTable *ht; HashTable *ht;
zend_uint_t h; zend_ulong h;
} HashPointer; } HashPointer;
ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr); 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) \ #define ZEND_INIT_SYMTABLE_EX(ht, n, persistent) \
zend_hash_init(ht, n, NULL, ZVAL_PTR_DTOR, 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; register const char *tmp = key;
const char *end; 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 */ if ((*end != '\0') /* not a null terminated string */
|| (*tmp == '0' && length > 1) /* numbers with leading zeros */ || (*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 && || (SIZEOF_ZEND_INT == 4 &&
end - tmp == MAX_LENGTH_OF_ZEND_INT - 1 && end - tmp == MAX_LENGTH_OF_LONG - 1 &&
*tmp > '2')) { /* overflow */ *tmp > '2')) { /* overflow */
return 0; 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) 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)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_update(ht, idx, pData); 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) 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)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_update(ht, idx, pData); 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) static inline int zend_symtable_del(HashTable *ht, zend_string *key)
{ {
zend_uint_t idx; zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_del(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_del(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_find(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_find(ht, 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) static inline int zend_symtable_exists(HashTable *ht, zend_string *key)
{ {
zend_uint_t idx; zend_ulong idx;
if (ZEND_HANDLE_NUMERIC(key, idx)) { if (ZEND_HANDLE_NUMERIC(key, idx)) {
return zend_hash_index_exists(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_update(ht, idx, pData); 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_update(ht, idx, pData); 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_del(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_del(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_find(ht, 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_exists(ht, 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); 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; 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; 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; 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; 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; 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) 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)) { if (ZEND_HANDLE_NUMERIC_STR(str, len, idx)) {
return zend_hash_index_find_ptr(ht, idx); return zend_hash_index_find_ptr(ht, idx);

View file

@ -150,7 +150,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
case T_DOC_COMMENT: case T_DOC_COMMENT:
break; break;
default: default:
STR_RELEASE(Z_STR(token)); zend_string_release(Z_STR(token));
break; break;
} }
} }
@ -211,7 +211,7 @@ ZEND_API void zend_strip(TSRMLS_D)
break; break;
default: default:
STR_RELEASE(Z_STR(token)); zend_string_release(Z_STR(token));
break; break;
} }
} }

View file

@ -138,7 +138,7 @@ dflt_printout:
case T_WHITESPACE: case T_WHITESPACE:
break; break;
default: default:
STR_RELEASE(Z_STR(token)); zend_string_release(Z_STR(token));
break; break;
} }
} }

View file

@ -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; hashed_ini_entry->module_number = module_number;
if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) {
if (!hashed_ini_entry->on_modify 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 = 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; config_directive_success = 1;
} }
} }
@ -352,7 +352,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
* Data retrieval * 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; zend_ini_entry *ini_entry;
TSRMLS_FETCH(); TSRMLS_FETCH();
@ -587,7 +587,7 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */
ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
{ {
zend_int_t *p; zend_long *p;
#ifndef ZTS #ifndef ZTS
char *base = (char *) mh_arg2; char *base = (char *) mh_arg2;
#else #else
@ -596,7 +596,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
base = (char *) ts_resource(*((int *) mh_arg2)); base = (char *) ts_resource(*((int *) mh_arg2));
#endif #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); *p = zend_atol(new_value, new_value_length);
return SUCCESS; return SUCCESS;
@ -605,7 +605,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
{ {
zend_int_t *p, tmp; zend_long *p, tmp;
#ifndef ZTS #ifndef ZTS
char *base = (char *) mh_arg2; char *base = (char *) mh_arg2;
#else #else
@ -619,7 +619,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
return FAILURE; return FAILURE;
} }
p = (zend_int_t *) (base+(size_t) mh_arg1); p = (zend_long *) (base+(size_t) mh_arg1);
*p = tmp; *p = tmp;
return SUCCESS; return SUCCESS;

View file

@ -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 int zend_restore_ini_entry(zend_string *name, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module); 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 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(char *name, uint name_length, int orig);
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists); 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) 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 #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_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_STR(name) zend_ini_string_ex((name), sizeof(name)-1, 0, NULL)
#define INI_BOOL(name) ((zend_bool) INI_INT(name)) #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_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_STR(name) zend_ini_string((name), sizeof(name)-1, 1)
#define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name)) #define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))

View file

@ -50,13 +50,13 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
int i_result; int i_result;
int i_op1, i_op2; int i_op1, i_op2;
int str_len; 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)); i_op1 = atoi(Z_STRVAL_P(op1));
STR_FREE(Z_STR_P(op1)); zend_string_free(Z_STR_P(op1));
if (op2) { if (op2) {
i_op2 = atoi(Z_STRVAL_P(op2)); i_op2 = atoi(Z_STRVAL_P(op2));
STR_FREE(Z_STR_P(op2)); zend_string_free(Z_STR_P(op2));
} else { } else {
i_op2 = 0; 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) static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
{ {
int op1_len = Z_STRSIZE_P(op1); int op1_len = Z_STRLEN_P(op1);
int length = op1_len + Z_STRSIZE_P(op2); int length = op1_len + Z_STRLEN_P(op2);
ZVAL_NEW_STR(result, STR_REALLOC(Z_STR_P(op1), length, 1)); 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_STRSIZE_P(op2)); memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[length] = 0; 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; zval *c, tmp;
/* If name contains ':' it is not a constant. Bug #26893. */ /* 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) { && (c = zend_get_constant(Z_STR_P(name) TSRMLS_CC)) != 0) {
if (Z_TYPE_P(c) != IS_STRING) { if (Z_TYPE_P(c) != IS_STRING) {
ZVAL_COPY_VALUE(&tmp, c); 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); convert_to_string(&tmp);
c = &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) { if (c == &tmp) {
zval_dtor(&tmp); zval_dtor(&tmp);
} }
STR_FREE(Z_STR_P(name)); zend_string_free(Z_STR_P(name));
} else { } else {
*result = *name; *result = *name;
} }
@ -145,10 +145,10 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
char *envvar; char *envvar;
/* Fetch configuration option value */ /* Fetch configuration option value */
if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name), &curval) == SUCCESS) { if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name), &curval) == SUCCESS) {
ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRSIZE(curval)); ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRLEN(curval));
/* ..or if not found, try ENV */ /* ..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) { (envvar = getenv(Z_STRVAL_P(name))) != NULL) {
ZVAL_PSTRING(result, envvar); ZVAL_PSTRING(result, envvar);
} else { } else {
@ -282,26 +282,26 @@ statement:
printf("SECTION: [%s]\n", Z_STRVAL($2)); printf("SECTION: [%s]\n", Z_STRVAL($2));
#endif #endif
ZEND_INI_PARSER_CB(&$2, NULL, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG TSRMLS_CC); 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 { | TC_LABEL '=' string_or_value {
#if DEBUG_CFG_PARSER #if DEBUG_CFG_PARSER
printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3)); printf("NORMAL: '%s' = '%s'\n", Z_STRVAL($1), Z_STRVAL($3));
#endif #endif
ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); ZEND_INI_PARSER_CB(&$1, &$3, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
STR_RELEASE(Z_STR($1)); zend_string_release(Z_STR($1));
STR_RELEASE(Z_STR($3)); zend_string_release(Z_STR($3));
} }
| TC_OFFSET option_offset ']' '=' string_or_value { | TC_OFFSET option_offset ']' '=' string_or_value {
#if DEBUG_CFG_PARSER #if DEBUG_CFG_PARSER
printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5)); printf("OFFSET: '%s'[%s] = '%s'\n", Z_STRVAL($1), Z_STRVAL($2), Z_STRVAL($5));
#endif #endif
ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC); ZEND_INI_PARSER_CB(&$1, &$5, &$2, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG TSRMLS_CC);
STR_RELEASE(Z_STR($1)); zend_string_release(Z_STR($1));
STR_RELEASE(Z_STR($2)); zend_string_release(Z_STR($2));
STR_RELEASE(Z_STR($5)); 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 | END_OF_LINE
; ;
@ -323,8 +323,8 @@ option_offset:
; ;
encapsed_list: encapsed_list:
encapsed_list cfg_var_ref { 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); STR_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(&$$); } | /* empty */ { zend_ini_init_string(&$$); }
; ;
@ -332,18 +332,18 @@ var_string_list_section:
cfg_var_ref { $$ = $1; } cfg_var_ref { $$ = $1; }
| constant_literal { $$ = $1; } | constant_literal { $$ = $1; }
| '"' encapsed_list '"' { $$ = $2; } | '"' 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 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); STR_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); STR_FREE(Z_STR($3)); } | var_string_list_section '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); }
; ;
var_string_list: var_string_list:
cfg_var_ref { $$ = $1; } cfg_var_ref { $$ = $1; }
| constant_string { $$ = $1; } | constant_string { $$ = $1; }
| '"' encapsed_list '"' { $$ = $2; } | '"' encapsed_list '"' { $$ = $2; }
| var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); STR_FREE(Z_STR($2)); } | 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); STR_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); STR_FREE(Z_STR($3)); } | var_string_list '"' encapsed_list '"' { zend_ini_add_string(&$$, &$1, &$3); zend_string_free(Z_STR($3)); }
; ;
expr: expr:
@ -357,7 +357,7 @@ expr:
; ;
cfg_var_ref: 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: constant_literal:

View file

@ -134,7 +134,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') #define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
#define zend_ini_copy_value(retval, str, len) \ #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) { \ #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 */ /* convert escape sequences */
s = t = Z_STRVAL_P(lval); s = t = Z_STRVAL_P(lval);
end = s + Z_STRSIZE_P(lval); end = s + Z_STRLEN_P(lval);
while (s < end) { while (s < end) {
if (*s == '\\') { if (*s == '\\') {
@ -288,7 +288,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
case '\\': case '\\':
case '$': case '$':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(lval)--; Z_STRLEN_P(lval)--;
break; break;
default: default:
*t++ = '\\'; *t++ = '\\';

View file

@ -132,7 +132,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X') #define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
#define zend_ini_copy_value(retval, str, len) \ #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) { \ #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 */ /* convert escape sequences */
s = t = Z_STRVAL_P(lval); s = t = Z_STRVAL_P(lval);
end = s + Z_STRSIZE_P(lval); end = s + Z_STRLEN_P(lval);
while (s < end) { while (s < end) {
if (*s == '\\') { if (*s == '\\') {
@ -286,7 +286,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
case '\\': case '\\':
case '$': case '$':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(lval)--; Z_STRLEN_P(lval)--;
break; break;
default: default:
*t++ = '\\'; *t++ = '\\';

View file

@ -22,14 +22,10 @@
#ifndef ZEND_INT_H #ifndef ZEND_INT_H
#define ZEND_INT_H #define ZEND_INT_H
#ifndef ZEND_WIN32 #include "main/php_stdint.h"
/* this probably needs more on non windows, like for C++ and C99*/
# include <stdint.h>
# include <inttypes.h>
#endif
/* This is the heart of the whole int64 enablement in zval. Based on this /* 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) #if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
# define ZEND_ENABLE_INT64 1 # define ZEND_ENABLE_INT64 1
#endif #endif
@ -38,8 +34,8 @@
#ifdef ZEND_ENABLE_INT64 #ifdef ZEND_ENABLE_INT64
# ifdef ZEND_WIN32 # ifdef ZEND_WIN32
# ifdef _WIN64 # ifdef _WIN64
typedef __int64 zend_int_t; typedef __int64 zend_long;
typedef unsigned __int64 zend_uint_t; typedef unsigned __int64 zend_ulong;
typedef __int64 zend_off_t; typedef __int64 zend_off_t;
# define ZEND_INT_MAX _I64_MAX # define ZEND_INT_MAX _I64_MAX
# define ZEND_INT_MIN _I64_MIN # define ZEND_INT_MIN _I64_MIN
@ -51,8 +47,8 @@ typedef __int64 zend_off_t;
# endif # endif
# else # else
# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) # if defined(__X86_64__) || defined(__LP64__) || defined(_LP64)
typedef int64_t zend_int_t; typedef int64_t zend_long;
typedef uint64_t zend_uint_t; typedef uint64_t zend_ulong;
typedef off_t zend_off_t; typedef off_t zend_off_t;
# define ZEND_INT_MAX INT64_MAX # define ZEND_INT_MAX INT64_MAX
# define ZEND_INT_MIN INT64_MIN # define ZEND_INT_MIN INT64_MIN
@ -65,8 +61,8 @@ typedef off_t zend_off_t;
# endif # endif
# define SIZEOF_ZEND_INT 8 # define SIZEOF_ZEND_INT 8
#else #else
typedef long zend_int_t; typedef long zend_long;
typedef unsigned long zend_uint_t; typedef unsigned long zend_ulong;
typedef long zend_off_t; typedef long zend_off_t;
# define ZEND_INT_MAX LONG_MAX # define ZEND_INT_MAX LONG_MAX
# define ZEND_INT_MIN LONG_MIN # define ZEND_INT_MIN LONG_MIN

View file

@ -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) 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; *int_key = _iter->index;
return HASH_KEY_IS_INT; return HASH_KEY_IS_LONG;
} }
#endif #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); 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); zval_ptr_dtor(&retval);
return FAILURE; return FAILURE;
case IS_STRING: case IS_STRING:
*buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
*buf_len = Z_STRSIZE(retval); *buf_len = Z_STRLEN(retval);
result = SUCCESS; result = SUCCESS;
break; break;
default: /* failure */ default: /* failure */

View file

@ -58,7 +58,7 @@ struct _zend_object_iterator {
zend_object std; zend_object std;
zval data; zval data;
zend_object_iterator_funcs *funcs; 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 { typedef struct _zend_class_iterator_funcs {

View file

@ -578,7 +578,7 @@ optional_class_type:
function_call_parameter_list: function_call_parameter_list:
'(' ')' { Z_IVAL($$.u.constant) = 0; } '(' ')' { Z_LVAL($$.u.constant) = 0; }
| '(' non_empty_function_call_parameter_list ')' { $$ = $2; } | '(' non_empty_function_call_parameter_list ')' { $$ = $2; }
| '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); } | '(' yield_expr ')' { zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); }
; ;
@ -625,7 +625,7 @@ class_statement_list:
class_statement: 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 ';' | class_constant_declaration ';'
| trait_use_statement | trait_use_statement
| method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); } | 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: 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 */ | member_modifier { $$ = $1; } /* REM: Keep in mind, there are not only visibility modifiers */
; ;
method_body: method_body:
';' /* abstract method */ { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } ';' /* abstract method */ { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
| '{' inner_statement_list '}' { Z_IVAL($$.u.constant) = 0; } | '{' inner_statement_list '}' { Z_LVAL($$.u.constant) = 0; }
; ;
variable_modifiers: variable_modifiers:
non_empty_member_modifiers { $$ = $1; } 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: method_modifiers:
/* empty */ { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; } /* empty */ { Z_LVAL($$.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; } } | 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: non_empty_member_modifiers:
member_modifier { $$ = $1; } 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: member_modifier:
T_PUBLIC { Z_IVAL($$.u.constant) = ZEND_ACC_PUBLIC; } T_PUBLIC { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
| T_PROTECTED { Z_IVAL($$.u.constant) = ZEND_ACC_PROTECTED; } | T_PROTECTED { Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
| T_PRIVATE { Z_IVAL($$.u.constant) = ZEND_ACC_PRIVATE; } | T_PRIVATE { Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
| T_STATIC { Z_IVAL($$.u.constant) = ZEND_ACC_STATIC; } | T_STATIC { Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; }
| T_ABSTRACT { Z_IVAL($$.u.constant) = ZEND_ACC_ABSTRACT; } | T_ABSTRACT { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
| T_FINAL { Z_IVAL($$.u.constant) = ZEND_ACC_FINAL; } | T_FINAL { Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; }
; ;
class_variable_declaration: class_variable_declaration:
@ -812,8 +812,8 @@ expr_without_variable:
| expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); } | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
| expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); } | expr T_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 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_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_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) { 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_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
| '~' expr { zend_do_unary_op(ZEND_BW_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); } | 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(&$1, &$2, &$3 TSRMLS_CC); }
expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); } expr { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); }
| internal_functions_in_yacc { $$ = $1; } | 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_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
| T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING 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); } | 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);} T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1);}
| namespace_name { $$ = $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_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: fully_qualified_class_name:
namespace_name { $$ = $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_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: ctor_arguments:
/* empty */ { Z_IVAL($$.u.constant) = 0; } /* empty */ { Z_LVAL($$.u.constant) = 0; }
| function_call_parameter_list { $$ = $1; } | 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); } | 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); } | 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_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; } | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
| '[' static_array_pair_list ']' { $$ = $2; } | '[' static_array_pair_list ']' { $$ = $2; }
| static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); } | static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
@ -1045,7 +1045,7 @@ general_constant:
class_constant { $$ = $1; } class_constant { $$ = $1; }
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } | 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_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: scalar:
@ -1203,8 +1203,8 @@ variable_name:
; ;
simple_indirect_reference: simple_indirect_reference:
'$' { Z_IVAL($$.u.constant) = 1; } '$' { Z_LVAL($$.u.constant) = 1; }
| simple_indirect_reference '$' { Z_IVAL($$.u.constant)++; } | simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; }
; ;
assignment_list: assignment_list:

View file

@ -535,9 +535,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename; 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); zend_set_compiled_filename(compiled_filename TSRMLS_CC);
STR_RELEASE(compiled_filename); zend_string_release(compiled_filename);
if (CG(start_lineno)) { if (CG(start_lineno)) {
CG(zend_lineno) = 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); zend_bool original_in_compilation = CG(in_compilation);
retval_znode.op_type = IS_CONST; 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); 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); retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) { if (retval && file_handle.handle.stream.handle) {
if (!file_handle.opened_path) { 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)); 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; zend_string *new_compiled_filename;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
old_len = Z_STRSIZE_P(str); old_len = Z_STRLEN_P(str);
Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); 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; Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1); 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); 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); 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(zend_lineno) = 1;
CG(increment_lineno) = 0; CG(increment_lineno) = 0;
RESET_DOC_COMMENT(); RESET_DOC_COMMENT();
@ -727,7 +727,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
int compiler_result; int compiler_result;
zend_bool original_in_compilation = CG(in_compilation); 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); efree(op_array);
return NULL; return NULL;
} }
@ -894,7 +894,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
/* convert escape sequences */ /* convert escape sequences */
s = t = Z_STRVAL_P(zendlval); s = t = Z_STRVAL_P(zendlval);
end = s+Z_STRSIZE_P(zendlval); end = s+Z_STRLEN_P(zendlval);
while (s<end) { while (s<end) {
if (*s=='\\') { if (*s=='\\') {
s++; s++;
@ -906,23 +906,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
switch(*s) { switch(*s) {
case 'n': case 'n':
*t++ = '\n'; *t++ = '\n';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'r': case 'r':
*t++ = '\r'; *t++ = '\r';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 't': case 't':
*t++ = '\t'; *t++ = '\t';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'f': case 'f':
*t++ = '\f'; *t++ = '\f';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'v': case 'v':
*t++ = '\v'; *t++ = '\v';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'e': case 'e':
#ifdef PHP_WIN32 #ifdef PHP_WIN32
@ -930,7 +930,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
#else #else
*t++ = '\e'; *t++ = '\e';
#endif #endif
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case '"': case '"':
case '`': case '`':
@ -942,20 +942,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
case '\\': case '\\':
case '$': case '$':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'x': case 'x':
case 'X': case 'X':
if (ZEND_IS_HEX(*(s+1))) { if (ZEND_IS_HEX(*(s+1))) {
char hex_buf[3] = { 0, 0, 0 }; 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); hex_buf[0] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_HEX(*(s+1))) { if (ZEND_IS_HEX(*(s+1))) {
hex_buf[1] = *(++s); hex_buf[1] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
} }
*t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16);
} else { } 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 }; char octal_buf[4] = { 0, 0, 0, 0 };
octal_buf[0] = *s; octal_buf[0] = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) { if (ZEND_IS_OCT(*(s+1))) {
octal_buf[1] = *(++s); octal_buf[1] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) { if (ZEND_IS_OCT(*(s+1))) {
octal_buf[2] = *(++s); octal_buf[2] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
} }
} }
*t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); *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; unsigned char *str;
// TODO: avoid realocation ??? // TODO: avoid realocation ???
s = Z_STRVAL_P(zendlval); 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_ptr_dtor(zendlval);
ZVAL_STRINGL(zendlval, str, sz); ZVAL_STRINGL(zendlval, str, sz);
efree(str); efree(str);
@ -1645,7 +1645,7 @@ yy61:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 2153 "Zend/zend_language_scanner.l" #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); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1); yyless(1);
return T_CURLY_OPEN; return T_CURLY_OPEN;
@ -1873,7 +1873,7 @@ yy83:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 2153 "Zend/zend_language_scanner.l" #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); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1); yyless(1);
return T_CURLY_OPEN; return T_CURLY_OPEN;
@ -2132,7 +2132,7 @@ yy107:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 2153 "Zend/zend_language_scanner.l" #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); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1); yyless(1);
return T_CURLY_OPEN; return T_CURLY_OPEN;
@ -2952,11 +2952,11 @@ yy173:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 1537 "Zend/zend_language_scanner.l" #line 1537 "Zend/zend_language_scanner.l"
{ {
if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */ if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0));
} else { } else {
errno = 0; errno = 0;
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0));
if (errno == ERANGE) { /* Overflow */ if (errno == ERANGE) { /* Overflow */
if (yytext[0] == '0') { /* octal overflow */ if (yytext[0] == '0') { /* octal overflow */
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL));
@ -3067,7 +3067,7 @@ yy179:
/* convert escape sequences */ /* convert escape sequences */
s = t = Z_STRVAL_P(zendlval); s = t = Z_STRVAL_P(zendlval);
end = s+Z_STRSIZE_P(zendlval); end = s+Z_STRLEN_P(zendlval);
while (s<end) { while (s<end) {
if (*s=='\\') { if (*s=='\\') {
s++; s++;
@ -3076,7 +3076,7 @@ yy179:
case '\\': case '\\':
case '\'': case '\'':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
default: default:
*t++ = '\\'; *t++ = '\\';
@ -3099,7 +3099,7 @@ yy179:
char *str = NULL; char *str = NULL;
s = Z_STRVAL_P(zendlval); s = Z_STRVAL_P(zendlval);
// TODO: avoid reallocation ??? // 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); ZVAL_STRINGL(zendlval, str, sz);
efree(s); efree(s);
} }
@ -3316,9 +3316,9 @@ yy200:
if (len < SIZEOF_ZEND_INT * 8) { if (len < SIZEOF_ZEND_INT * 8) {
if (len == 0) { if (len == 0) {
ZVAL_INT(zendlval, 0); ZVAL_LONG(zendlval, 0);
} else { } else {
ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2)); ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2));
} }
return T_LNUMBER; return T_LNUMBER;
} else { } else {
@ -3351,9 +3351,9 @@ yy203:
if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) { if (len < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) {
if (len == 0) { if (len == 0) {
ZVAL_INT(zendlval, 0); ZVAL_LONG(zendlval, 0);
} else { } else {
ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16)); ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16));
} }
return T_LNUMBER; return T_LNUMBER;
} else { } else {
@ -3571,7 +3571,7 @@ yy235:
HANDLE_NEWLINES(yytext, yyleng); HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) { if (doc_com) {
CG(doc_comment) = STR_INIT(yytext, yyleng, 0); CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
return T_DOC_COMMENT; return T_DOC_COMMENT;
} }
@ -4205,11 +4205,11 @@ yy322:
filename = STR_EMPTY_ALLOC(); 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); zend_dirname(dirname->val, dirname->len);
if (strcmp(dirname->val, ".") == 0) { if (strcmp(dirname->val, ".") == 0) {
dirname = STR_REALLOC(dirname, MAXPATHLEN, 0); dirname = zend_string_realloc(dirname, MAXPATHLEN, 0);
#if HAVE_GETCWD #if HAVE_GETCWD
VCWD_GETCWD(dirname->val, MAXPATHLEN); VCWD_GETCWD(dirname->val, MAXPATHLEN);
#elif HAVE_GETWD #elif HAVE_GETWD
@ -4248,7 +4248,7 @@ yy328:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 1666 "Zend/zend_language_scanner.l" #line 1666 "Zend/zend_language_scanner.l"
{ {
ZVAL_INT(zendlval, CG(zend_lineno)); ZVAL_LONG(zendlval, CG(zend_lineno));
return T_LINE; return T_LINE;
} }
#line 4255 "Zend/zend_language_scanner.c" #line 4255 "Zend/zend_language_scanner.c"
@ -4298,7 +4298,7 @@ yy336:
len += sizeof("::")-1; len += sizeof("::")-1;
len += CG(active_op_array)->function_name->len; 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; len = 0;
if (CG(active_class_entry)->name) { if (CG(active_class_entry)->name) {
memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len); 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; Z_STRVAL_P(zendlval)[len] = 0;
} else if (CG(active_op_array) && CG(active_op_array)->function_name) { } 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -4373,7 +4373,7 @@ yy347:
{ {
zend_op_array *op_array = CG(active_op_array); zend_op_array *op_array = CG(active_op_array);
if (op_array && op_array->function_name) { 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -4406,7 +4406,7 @@ yy352:
if (!filename) { if (!filename) {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} else { } else {
ZVAL_STR(zendlval, STR_COPY(filename)); ZVAL_STR(zendlval, zend_string_copy(filename));
} }
return T_FILE; return T_FILE;
} }
@ -4444,7 +4444,7 @@ yy359:
{ {
zend_class_entry *ce = CG(active_class_entry); zend_class_entry *ce = CG(active_class_entry);
if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -4490,7 +4490,7 @@ yy366:
Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX;
} else { } else {
if (ce && ce->name) { if (ce && ce->name) {
ZVAL_STR(zendlval, STR_COPY(ce->name)); ZVAL_STR(zendlval, zend_string_copy(ce->name));
} else { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -7672,8 +7672,8 @@ yy839:
yyleng = YYCURSOR - SCNG(yy_text); yyleng = YYCURSOR - SCNG(yy_text);
#line 1578 "Zend/zend_language_scanner.l" #line 1578 "Zend/zend_language_scanner.l"
{ /* Offset could be treated as a long */ { /* 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)) { if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10));
} else { } else {
ZVAL_STRINGL(zendlval, yytext, yyleng); ZVAL_STRINGL(zendlval, yytext, yyleng);
} }

View file

@ -533,9 +533,9 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename; 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); zend_set_compiled_filename(compiled_filename TSRMLS_CC);
STR_RELEASE(compiled_filename); zend_string_release(compiled_filename);
if (CG(start_lineno)) { if (CG(start_lineno)) {
CG(zend_lineno) = 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); zend_bool original_in_compilation = CG(in_compilation);
retval_znode.op_type = IS_CONST; 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); 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); retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) { if (retval && file_handle.handle.stream.handle) {
if (!file_handle.opened_path) { 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)); 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; zend_string *new_compiled_filename;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */ /* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
old_len = Z_STRSIZE_P(str); old_len = Z_STRLEN_P(str);
Z_STR_P(str) = STR_REALLOC(Z_STR_P(str), old_len + ZEND_MMAP_AHEAD, 0); 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; Z_TYPE_INFO_P(str) = IS_STRING_EX;
memset(Z_STRVAL_P(str) + old_len, 0, ZEND_MMAP_AHEAD + 1); 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); 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); 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(zend_lineno) = 1;
CG(increment_lineno) = 0; CG(increment_lineno) = 0;
RESET_DOC_COMMENT(); RESET_DOC_COMMENT();
@ -725,7 +725,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
int compiler_result; int compiler_result;
zend_bool original_in_compilation = CG(in_compilation); 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); efree(op_array);
return NULL; return NULL;
} }
@ -892,7 +892,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
/* convert escape sequences */ /* convert escape sequences */
s = t = Z_STRVAL_P(zendlval); s = t = Z_STRVAL_P(zendlval);
end = s+Z_STRSIZE_P(zendlval); end = s+Z_STRLEN_P(zendlval);
while (s<end) { while (s<end) {
if (*s=='\\') { if (*s=='\\') {
s++; s++;
@ -904,23 +904,23 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
switch(*s) { switch(*s) {
case 'n': case 'n':
*t++ = '\n'; *t++ = '\n';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'r': case 'r':
*t++ = '\r'; *t++ = '\r';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 't': case 't':
*t++ = '\t'; *t++ = '\t';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'f': case 'f':
*t++ = '\f'; *t++ = '\f';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'v': case 'v':
*t++ = '\v'; *t++ = '\v';
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'e': case 'e':
#ifdef PHP_WIN32 #ifdef PHP_WIN32
@ -928,7 +928,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
#else #else
*t++ = '\e'; *t++ = '\e';
#endif #endif
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case '"': case '"':
case '`': case '`':
@ -940,20 +940,20 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
case '\\': case '\\':
case '$': case '$':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
case 'x': case 'x':
case 'X': case 'X':
if (ZEND_IS_HEX(*(s+1))) { if (ZEND_IS_HEX(*(s+1))) {
char hex_buf[3] = { 0, 0, 0 }; 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); hex_buf[0] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_HEX(*(s+1))) { if (ZEND_IS_HEX(*(s+1))) {
hex_buf[1] = *(++s); hex_buf[1] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
} }
*t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16);
} else { } 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 }; char octal_buf[4] = { 0, 0, 0, 0 };
octal_buf[0] = *s; octal_buf[0] = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) { if (ZEND_IS_OCT(*(s+1))) {
octal_buf[1] = *(++s); octal_buf[1] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
if (ZEND_IS_OCT(*(s+1))) { if (ZEND_IS_OCT(*(s+1))) {
octal_buf[2] = *(++s); octal_buf[2] = *(++s);
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
} }
} }
*t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); *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; unsigned char *str;
// TODO: avoid realocation ??? // TODO: avoid realocation ???
s = Z_STRVAL_P(zendlval); 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_ptr_dtor(zendlval);
ZVAL_STRINGL(zendlval, str, sz); ZVAL_STRINGL(zendlval, str, sz);
efree(str); efree(str);
@ -1523,9 +1523,9 @@ NEWLINE ("\r"|"\n"|"\r\n")
if (len < SIZEOF_ZEND_INT * 8) { if (len < SIZEOF_ZEND_INT * 8) {
if (len == 0) { if (len == 0) {
ZVAL_INT(zendlval, 0); ZVAL_LONG(zendlval, 0);
} else { } else {
ZVAL_INT(zendlval, ZEND_STRTOI(bin, NULL, 2)); ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2));
} }
return T_LNUMBER; return T_LNUMBER;
} else { } else {
@ -1535,11 +1535,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
} }
<ST_IN_SCRIPTING>{LNUM} { <ST_IN_SCRIPTING>{LNUM} {
if (yyleng < MAX_LENGTH_OF_ZEND_INT - 1) { /* Won't overflow */ if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0));
} else { } else {
errno = 0; errno = 0;
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 0)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0));
if (errno == ERANGE) { /* Overflow */ if (errno == ERANGE) { /* Overflow */
if (yytext[0] == '0') { /* octal overflow */ if (yytext[0] == '0') { /* octal overflow */
ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); 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 < SIZEOF_ZEND_INT * 2 || (len == SIZEOF_ZEND_INT * 2 && *hex <= '7')) {
if (len == 0) { if (len == 0) {
ZVAL_INT(zendlval, 0); ZVAL_LONG(zendlval, 0);
} else { } else {
ZVAL_INT(zendlval, ZEND_STRTOI(hex, NULL, 16)); ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16));
} }
return T_LNUMBER; return T_LNUMBER;
} else { } 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 */ <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)) { if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
ZVAL_INT(zendlval, ZEND_STRTOI(yytext, NULL, 10)); ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10));
} else { } else {
ZVAL_STRINGL(zendlval, yytext, yyleng); ZVAL_STRINGL(zendlval, yytext, yyleng);
} }
@ -1603,7 +1603,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX; Z_TYPE_INFO_P(zendlval) = IS_CONSTANT_EX;
} else { } else {
if (ce && ce->name) { if (ce && ce->name) {
ZVAL_STR(zendlval, STR_COPY(ce->name)); ZVAL_STR(zendlval, zend_string_copy(ce->name));
} else { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -1614,7 +1614,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"__TRAIT__" { <ST_IN_SCRIPTING>"__TRAIT__" {
zend_class_entry *ce = CG(active_class_entry); zend_class_entry *ce = CG(active_class_entry);
if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) { 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -1624,7 +1624,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"__FUNCTION__" { <ST_IN_SCRIPTING>"__FUNCTION__" {
zend_op_array *op_array = CG(active_op_array); zend_op_array *op_array = CG(active_op_array);
if (op_array && op_array->function_name) { 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -1642,7 +1642,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
len += sizeof("::")-1; len += sizeof("::")-1;
len += CG(active_op_array)->function_name->len; 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; len = 0;
if (CG(active_class_entry)->name) { if (CG(active_class_entry)->name) {
memcpy(Z_STRVAL_P(zendlval), CG(active_class_entry)->name->val, CG(active_class_entry)->name->len); 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; Z_STRVAL_P(zendlval)[len] = 0;
} else if (CG(active_op_array) && CG(active_op_array)->function_name) { } 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 { } else {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} }
@ -1664,7 +1664,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
} }
<ST_IN_SCRIPTING>"__LINE__" { <ST_IN_SCRIPTING>"__LINE__" {
ZVAL_INT(zendlval, CG(zend_lineno)); ZVAL_LONG(zendlval, CG(zend_lineno));
return T_LINE; return T_LINE;
} }
@ -1674,7 +1674,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
if (!filename) { if (!filename) {
ZVAL_EMPTY_STRING(zendlval); ZVAL_EMPTY_STRING(zendlval);
} else { } else {
ZVAL_STR(zendlval, STR_COPY(filename)); ZVAL_STR(zendlval, zend_string_copy(filename));
} }
return T_FILE; return T_FILE;
} }
@ -1687,11 +1687,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
filename = STR_EMPTY_ALLOC(); 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); zend_dirname(dirname->val, dirname->len);
if (strcmp(dirname->val, ".") == 0) { if (strcmp(dirname->val, ".") == 0) {
dirname = STR_REALLOC(dirname, MAXPATHLEN, 0); dirname = zend_string_realloc(dirname, MAXPATHLEN, 0);
#if HAVE_GETCWD #if HAVE_GETCWD
VCWD_GETCWD(dirname->val, MAXPATHLEN); VCWD_GETCWD(dirname->val, MAXPATHLEN);
#elif HAVE_GETWD #elif HAVE_GETWD
@ -1945,7 +1945,7 @@ inline_html:
HANDLE_NEWLINES(yytext, yyleng); HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) { if (doc_com) {
CG(doc_comment) = STR_INIT(yytext, yyleng, 0); CG(doc_comment) = zend_string_init(yytext, yyleng, 0);
return T_DOC_COMMENT; return T_DOC_COMMENT;
} }
@ -2000,7 +2000,7 @@ inline_html:
/* convert escape sequences */ /* convert escape sequences */
s = t = Z_STRVAL_P(zendlval); s = t = Z_STRVAL_P(zendlval);
end = s+Z_STRSIZE_P(zendlval); end = s+Z_STRLEN_P(zendlval);
while (s<end) { while (s<end) {
if (*s=='\\') { if (*s=='\\') {
s++; s++;
@ -2009,7 +2009,7 @@ inline_html:
case '\\': case '\\':
case '\'': case '\'':
*t++ = *s; *t++ = *s;
Z_STRSIZE_P(zendlval)--; Z_STRLEN_P(zendlval)--;
break; break;
default: default:
*t++ = '\\'; *t++ = '\\';
@ -2032,7 +2032,7 @@ inline_html:
char *str = NULL; char *str = NULL;
s = Z_STRVAL_P(zendlval); s = Z_STRVAL_P(zendlval);
// TODO: avoid reallocation ??? // 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); ZVAL_STRINGL(zendlval, str, sz);
efree(s); efree(s);
} }
@ -2151,7 +2151,7 @@ inline_html:
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" { <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); yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1); yyless(1);
return T_CURLY_OPEN; return T_CURLY_OPEN;

View file

@ -21,8 +21,8 @@
#if defined(__i386__) && defined(__GNUC__) #if defined(__i386__) && defined(__GNUC__)
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
zend_int_t __tmpvar; \ zend_long __tmpvar; \
__asm__ ("imul %3,%0\n" \ __asm__ ("imul %3,%0\n" \
"adc $0,%1" \ "adc $0,%1" \
: "=r"(__tmpvar),"=r"(usedval) \ : "=r"(__tmpvar),"=r"(usedval) \
@ -33,8 +33,8 @@
#elif defined(__x86_64__) && defined(__GNUC__) #elif defined(__x86_64__) && defined(__GNUC__)
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
zend_int_t __tmpvar; \ zend_long __tmpvar; \
__asm__ ("imul %3,%0\n" \ __asm__ ("imul %3,%0\n" \
"adc $0,%1" \ "adc $0,%1" \
: "=r"(__tmpvar),"=r"(usedval) \ : "=r"(__tmpvar),"=r"(usedval) \
@ -45,8 +45,8 @@
#elif defined(__arm__) && defined(__GNUC__) #elif defined(__arm__) && defined(__GNUC__)
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
zend_int_t __tmpvar; \ zend_long __tmpvar; \
__asm__("smull %0, %1, %2, %3\n" \ __asm__("smull %0, %1, %2, %3\n" \
"sub %1, %1, %0, asr #31" \ "sub %1, %1, %0, asr #31" \
: "=r"(__tmpvar), "=r"(usedval) \ : "=r"(__tmpvar), "=r"(usedval) \
@ -57,8 +57,8 @@
#elif defined(__aarch64__) && defined(__GNUC__) #elif defined(__aarch64__) && defined(__GNUC__)
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
zend_int_t __tmpvar; \ zend_long __tmpvar; \
__asm__("mul %0, %2, %3\n" \ __asm__("mul %0, %2, %3\n" \
"smulh %1, %2, %3\n" \ "smulh %1, %2, %3\n" \
"sub %1, %1, %0, asr #63\n" \ "sub %1, %1, %0, asr #63\n" \
@ -70,8 +70,8 @@
#elif defined(ZEND_WIN32) #elif defined(ZEND_WIN32)
#define ZEND_SIGNED_MULTIPLY_INT(a, b, lval, dval, usedval) do { \ #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
zend_int_t __lres = (a) * (b); \ zend_long __lres = (a) * (b); \
long double __dres = (long double)(a) * (long double)(b); \ long double __dres = (long double)(a) * (long double)(b); \
long double __delta = (long double) __lres - __dres; \ long double __delta = (long double) __lres - __dres; \
if ( ((usedval) = (( __dres + __delta ) != __dres))) { \ if ( ((usedval) = (( __dres + __delta ) != __dres))) { \
@ -83,7 +83,7 @@
#elif SIZEOF_ZEND_INT == 4 && defined(HAVE_ZEND_LONG64) #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); \ zend_long64 __result = (zend_long64) (a) * (zend_long64) (b); \
if (__result > ZEND_INT_MAX || __result < ZEND_INT_MIN) { \ if (__result > ZEND_INT_MAX || __result < ZEND_INT_MIN) { \
(dval) = (double) __result; \ (dval) = (double) __result; \
@ -96,7 +96,7 @@
#else #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 __lres = (a) * (b); \
long double __dres = (long double)(a) * (long double)(b); \ long double __dres = (long double)(a) * (long double)(b); \
long double __delta = (long double) __lres - __dres; \ long double __delta = (long double) __lres - __dres; \

View file

@ -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) { 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); 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 { } 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); property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC);
STR_RELEASE(member); zend_string_release(member);
if (!property_info) { if (!property_info) {
return FAILURE; 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; zend_property_info info;
zval stub, *guard; 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); zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name);
if (class_name) { if (class_name) {
/* use unmangled name for protected properties */ /* 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; 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); zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
} else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) { } else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) {
if (str) { 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); guard = zend_hash_add_new(zobj->guards, property_info->name, &stub);
if (str) { 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 */ /* magic get */
if (zobj->ce->__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)) { if (!((*guard) & IN_GET)) {
zval tmp_object; 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); zval_ptr_dtor(&tmp_object);
} else { } else {
if (Z_STRVAL_P(member)[0] == '\0') { 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"); zend_error(E_ERROR, "Cannot access empty property");
} else { } else {
zend_error(E_ERROR, "Cannot access property started with '\\0'"); zend_error(E_ERROR, "Cannot access property started with '\\0'");
@ -635,7 +635,7 @@ found:
/* magic set */ /* magic set */
if (zobj->ce->__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)) { if (!((*guard) & IN_SET)) {
zval tmp_object; zval tmp_object;
@ -651,7 +651,7 @@ found:
goto write_std_property; goto write_std_property;
} else { } else {
if (Z_STRVAL_P(member)[0] == '\0') { 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"); zend_error(E_ERROR, "Cannot access empty property");
} else { } else {
zend_error(E_ERROR, "Cannot access property started with '\\0'"); 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 tmp_member;
zval *retval, tmp; zval *retval, tmp;
zend_property_info *property_info; zend_property_info *property_info;
zend_int_t *guard; zend_long *guard;
zobj = Z_OBJ_P(object); zobj = Z_OBJ_P(object);
@ -875,7 +875,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
/* magic unset */ /* magic unset */
if (zobj->ce->__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)) { if (!((*guard) & IN_UNSET)) {
zval tmp_object; 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); zval_ptr_dtor(&tmp_object);
} else { } else {
if (Z_STRVAL_P(member)[0] == '\0') { 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"); zend_error(E_ERROR, "Cannot access empty property");
} else { } else {
zend_error(E_ERROR, "Cannot access property started with '\\0'"); 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 //??? keep compatibility for "\0" characters
//??? see: Zend/tests/bug46238.phpt //??? see: Zend/tests/bug46238.phpt
if (UNEXPECTED(strlen(method_name->val) != method_name->len)) { 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 { } 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; 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 //??? keep compatibility for "\0" characters
//??? see: Zend/tests/bug46238.phpt //??? see: Zend/tests/bug46238.phpt
if (UNEXPECTED(strlen(method_name->val) != method_name->len)) { 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 { } 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; 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)) { if (EXPECTED(key != NULL)) {
lc_function_name = Z_STR_P(key); lc_function_name = Z_STR_P(key);
} else { } 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); 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); fbc = Z_FUNC_P(func);
} else { } else {
if (UNEXPECTED(!key)) { if (UNEXPECTED(!key)) {
STR_FREE(lc_function_name); zend_string_free(lc_function_name);
} }
if (ce->__call && if (ce->__call &&
Z_OBJ(EG(This)) && 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)) { if (UNEXPECTED(!key)) {
STR_FREE(lc_function_name); zend_string_free(lc_function_name);
} }
return fbc; return fbc;
@ -1404,10 +1404,10 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
Z_OBJ_UNPROTECT_RECURSION(o2); Z_OBJ_UNPROTECT_RECURSION(o2);
return 1; return 1;
} }
if (Z_IVAL(result) != 0) { if (Z_LVAL(result) != 0) {
Z_OBJ_UNPROTECT_RECURSION(o1); Z_OBJ_UNPROTECT_RECURSION(o1);
Z_OBJ_UNPROTECT_RECURSION(o2); Z_OBJ_UNPROTECT_RECURSION(o2);
return Z_IVAL(result); return Z_LVAL(result);
} }
} else { } else {
Z_OBJ_UNPROTECT_RECURSION(o1); Z_OBJ_UNPROTECT_RECURSION(o1);
@ -1485,7 +1485,7 @@ found:
result = 0; result = 0;
if ((has_set_exists != 2) && zobj->ce->__isset) { 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)) { if (!((*guard) & IN_ISSET)) {
zval rv; zval rv;
@ -1546,7 +1546,7 @@ zend_string* zend_std_object_get_class_name(const zend_object *zobj, int parent
ce = zobj->ce; 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: case _IS_BOOL:
ZVAL_BOOL(writeobj, 1); ZVAL_BOOL(writeobj, 1);
return SUCCESS; return SUCCESS;
case IS_INT: case IS_LONG:
ce = Z_OBJCE_P(readobj); ce = Z_OBJCE_P(readobj);
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val); zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val);
if (readobj == writeobj) { if (readobj == writeobj) {
zval_dtor(readobj); zval_dtor(readobj);
} }
ZVAL_INT(writeobj, 1); ZVAL_LONG(writeobj, 1);
return SUCCESS; return SUCCESS;
case IS_DOUBLE: case IS_DOUBLE:
ce = Z_OBJCE_P(readobj); ce = Z_OBJCE_P(readobj);

View file

@ -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. /* 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 */ * 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); 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);

View file

@ -149,7 +149,7 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *o
} }
if (old_object->properties) { if (old_object->properties) {
zval *prop, new_prop; zval *prop, new_prop;
zend_uint_t num_key; zend_ulong num_key;
zend_string *key; zend_string *key;
if (!new_object->properties) { if (!new_object->properties) {

View file

@ -113,7 +113,7 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
break; break;
case ZEND_INTERNAL_FUNCTION: case ZEND_INTERNAL_FUNCTION:
if (function->common.function_name) { if (function->common.function_name) {
STR_RELEASE(function->common.function_name); zend_string_release(function->common.function_name);
} }
/* do nothing */ /* do nothing */
break; break;
@ -198,16 +198,16 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce)
while (ce->trait_aliases[i]) { while (ce->trait_aliases[i]) {
if (ce->trait_aliases[i]->trait_method) { if (ce->trait_aliases[i]->trait_method) {
if (ce->trait_aliases[i]->trait_method->method_name) { 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) { 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); efree(ce->trait_aliases[i]->trait_method);
} }
if (ce->trait_aliases[i]->alias) { 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]); efree(ce->trait_aliases[i]);
@ -221,8 +221,8 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce)
size_t i = 0; size_t i = 0;
while (ce->trait_precedences[i]) { while (ce->trait_precedences[i]) {
STR_RELEASE(ce->trait_precedences[i]->trait_method->method_name); zend_string_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->class_name);
efree(ce->trait_precedences[i]->trait_method); efree(ce->trait_precedences[i]->trait_method);
if (ce->trait_precedences[i]->exclude_from_classes) { 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); efree(ce->default_static_members_table);
} }
zend_hash_destroy(&ce->properties_info); 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->function_table);
zend_hash_destroy(&ce->constants_table); zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) { if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces); efree(ce->interfaces);
} }
if (ce->info.user.doc_comment) { 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); _destroy_zend_class_traits_info(ce);
@ -299,7 +299,7 @@ ZEND_API void destroy_zend_class(zval *zv)
free(ce->default_static_members_table); free(ce->default_static_members_table);
} }
zend_hash_destroy(&ce->properties_info); 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->function_table);
zend_hash_destroy(&ce->constants_table); zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0) { 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; i = op_array->last_var;
while (i > 0) { while (i > 0) {
i--; i--;
STR_RELEASE(op_array->vars[i]); zend_string_release(op_array->vars[i]);
} }
efree(op_array->vars); 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); efree(op_array->opcodes);
if (op_array->function_name) { if (op_array->function_name) {
STR_RELEASE(op_array->function_name); zend_string_release(op_array->function_name);
} }
if (op_array->doc_comment) { if (op_array->doc_comment) {
STR_RELEASE(op_array->doc_comment); zend_string_release(op_array->doc_comment);
} }
if (op_array->brk_cont_array) { if (op_array->brk_cont_array) {
efree(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; int nest_levels, array_offset;
zend_brk_cont_element *jmp_to; 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) { if ((array_offset = opline->op1.opline_num) != -1) {
do { do {
jmp_to = &op_array->brk_cont_array[array_offset]; 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: 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; zend_uint num = opline->op2.constant;
opline->op2.zv = &op_array->literals[opline->op2.constant]; opline->op2.zv = &op_array->literals[opline->op2.constant];
zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC); 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); opline->extended_value = (zend_uint)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->extended_value);
break; break;
case ZEND_GOTO: 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); zend_resolve_goto_label(op_array, opline, 1 TSRMLS_CC);
} }
/* break omitted intentionally */ /* break omitted intentionally */

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@
#include "ext/bcmath/libbcmath/src/bcmath.h" #include "ext/bcmath/libbcmath/src/bcmath.h"
#endif #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() BEGIN_EXTERN_C()
ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); 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); ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC);
END_EXTERN_C() END_EXTERN_C()
#if ZEND_DVAL_TO_IVAL_CAST_OK #if ZEND_DVAL_TO_LVAL_CAST_OK
# define zend_dval_to_ival(d) ((zend_int_t) (d)) # define zend_dval_to_lval(d) ((zend_long) (d))
#elif SIZEOF_ZEND_INT == 4 #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) { if (d > ZEND_INT_MAX || d < ZEND_INT_MIN) {
double two_pow_32 = pow(2., 32.), 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 */ * to simulate rounding towards 0 of the negative number */
dmod = ceil(dmod) + two_pow_32; 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 #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 */ /* >= as (double)ZEND_INT_MAX is outside signed range */
if (d >= ZEND_INT_MAX || d < ZEND_INT_MIN) { 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 */ * fractional part, hence dmod does not have one either */
dmod += two_pow_64; 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 #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 * of allow_errors determines whether it's required to be entirely numeric, or
* just its prefix. Leading whitespace is allowed. * 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 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. * 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, * 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 * 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. * 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; const char *ptr;
int base = 10, digits = 0, dp_or_e = 0; 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, /* 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 * 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 */ * 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: check_digits:
if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) { if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) {
continue; continue;
@ -195,7 +195,7 @@ check_digits:
} }
if (base == 10) { if (base == 10) {
if (digits >= MAX_LENGTH_OF_ZEND_INT) { if (digits >= MAX_LENGTH_OF_LONG) {
if (oflow_info != NULL) { if (oflow_info != NULL) {
*oflow_info = *str == '-' ? -1 : 1; *oflow_info = *str == '-' ? -1 : 1;
} }
@ -236,9 +236,9 @@ process_double:
} }
} }
if (type == IS_INT) { if (type == IS_LONG) {
if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { if (digits == MAX_LENGTH_OF_LONG - 1) {
int cmp = strcmp(&ptr[-digits], int_min_digits); int cmp = strcmp(&ptr[-digits], long_min_digits);
if (!(cmp < 0 || (cmp == 0 && *str == '-'))) { if (!(cmp < 0 || (cmp == 0 && *str == '-'))) {
if (dval) { if (dval) {
@ -256,7 +256,7 @@ process_double:
*lval = ZEND_STRTOI(str, NULL, base); *lval = ZEND_STRTOI(str, NULL, base);
} }
return IS_INT; return IS_LONG;
} else { } else {
if (dval) { if (dval) {
*dval = local_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); 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 * 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 *p = haystack;
const char ne = needle[needle_len-1]; const char ne = needle[needle_len-1];
ptrdiff_t off_p; ptrdiff_t off_p;
zend_size_t off_s; size_t off_s;
if (needle_len == 1) { if (needle_len == 1) {
return (char *)memchr(p, *needle, (end-p)); return (char *)memchr(p, *needle, (end-p));
} }
off_p = end - haystack; 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) { if (needle_len > off_s) {
return NULL; return NULL;
} }
@ -309,7 +309,7 @@ zend_memnstr(const char *haystack, const char *needle, zend_size_t needle_len, c
return NULL; 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; 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_double_ex(int argc, ...);
ZEND_API void multi_convert_to_string_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 double _zval_get_double_func(zval *op TSRMLS_DC);
ZEND_API zend_string *_zval_get_string_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) { static zend_always_inline zend_long _zval_get_long(zval *op TSRMLS_DC) {
return Z_TYPE_P(op) == IS_INT ? Z_IVAL_P(op) : _zval_get_int_func(op TSRMLS_CC); 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) { 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); 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) { 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_double(op) _zval_get_double((op) TSRMLS_CC)
#define zval_get_string(op) _zval_get_string((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); ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
#endif #endif
ZEND_API void zend_str_tolower(char *str, 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, zend_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, zend_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_strcmp(zval *s1, zval *s2);
ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); 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_strcasecmp(zval *s1, zval *s2);
ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); 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_strcmp(const char *s1, size_t len1, const char *s2, 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_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, 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_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_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_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_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); 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); 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 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 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); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
END_EXTERN_C() END_EXTERN_C()
@ -417,7 +417,7 @@ END_EXTERN_C()
case IS_NULL: \ case IS_NULL: \
convert_to_null(pzv); \ convert_to_null(pzv); \
break; \ break; \
case IS_INT: \ case IS_LONG: \
convert_to_int(pzv); \ convert_to_int(pzv); \
break; \ break; \
case IS_DOUBLE: \ 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_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_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_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) #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_to_null_ex(pzv) convert_to_ex_master(pzv, null, IS_NULL)
#define convert_scalar_to_number_ex(pzv) \ #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); \ SEPARATE_ZVAL_IF_NOT_REF(pzv); \
convert_scalar_to_number(pzv TSRMLS_CC); \ 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) 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__) #if defined(__GNUC__) && defined(__i386__)
__asm__( __asm__(
"incl (%0)\n\t" "incl (%0)\n\t"
@ -508,11 +508,11 @@ static zend_always_inline int fast_increment_function(zval *op1)
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "cc"); : "cc");
#else #else
if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MAX)) { if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MAX)) {
/* switch to double */ /* switch to double */
ZVAL_DOUBLE(op1, (double)ZEND_INT_MAX + 1.0); ZVAL_DOUBLE(op1, (double)ZEND_INT_MAX + 1.0);
} else { } else {
Z_IVAL_P(op1)++; Z_LVAL_P(op1)++;
} }
#endif #endif
return SUCCESS; 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) 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__) #if defined(__GNUC__) && defined(__i386__)
__asm__( __asm__(
"decl (%0)\n\t" "decl (%0)\n\t"
@ -550,11 +550,11 @@ static zend_always_inline int fast_decrement_function(zval *op1)
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "cc"); : "cc");
#else #else
if (UNEXPECTED(Z_IVAL_P(op1) == ZEND_INT_MIN)) { if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MIN)) {
/* switch to double */ /* switch to double */
ZVAL_DOUBLE(op1, (double)ZEND_INT_MIN - 1.0); ZVAL_DOUBLE(op1, (double)ZEND_INT_MIN - 1.0);
} else { } else {
Z_IVAL_P(op1)--; Z_LVAL_P(op1)--;
} }
#endif #endif
return SUCCESS; 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
__asm__( __asm__(
"movl (%1), %%eax\n\t" "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"(&result->value),
"r"(&op1->value), "r"(&op1->value),
"r"(&op2->value), "r"(&op2->value),
"n"(IS_INT), "n"(IS_LONG),
"n"(IS_DOUBLE), "n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "eax","cc"); : "eax","cc");
@ -608,7 +608,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
: "r"(&result->value), : "r"(&result->value),
"r"(&op1->value), "r"(&op1->value),
"r"(&op2->value), "r"(&op2->value),
"n"(IS_INT), "n"(IS_LONG),
"n"(IS_DOUBLE), "n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "rax","cc"); : "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. * have read the values of op1 and op2.
*/ */
if (UNEXPECTED((Z_IVAL_P(op1) & LONG_SIGN_MASK) == (Z_IVAL_P(op2) & LONG_SIGN_MASK) if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
&& (Z_IVAL_P(op1) & LONG_SIGN_MASK) != ((Z_IVAL_P(op1) + Z_IVAL_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_IVAL_P(op1) + (double) Z_IVAL_P(op2)); ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
} else { } else {
ZVAL_INT(result, Z_IVAL_P(op1) + Z_IVAL_P(op2)); ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2));
} }
#endif #endif
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return SUCCESS;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
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; 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
__asm__( __asm__(
"movl (%1), %%eax\n\t" "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"(&result->value),
"r"(&op1->value), "r"(&op1->value),
"r"(&op2->value), "r"(&op2->value),
"n"(IS_INT), "n"(IS_LONG),
"n"(IS_DOUBLE), "n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "eax","cc"); : "eax","cc");
@ -697,29 +697,29 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
: "r"(&result->value), : "r"(&result->value),
"r"(&op1->value), "r"(&op1->value),
"r"(&op2->value), "r"(&op2->value),
"n"(IS_INT), "n"(IS_LONG),
"n"(IS_DOUBLE), "n"(IS_DOUBLE),
"n"(ZVAL_OFFSETOF_TYPE) "n"(ZVAL_OFFSETOF_TYPE)
: "rax","cc"); : "rax","cc");
#else #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) if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
&& (Z_IVAL_P(op1) & LONG_SIGN_MASK) != (Z_IVAL_P(result) & LONG_SIGN_MASK))) { && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & 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));
} }
#endif #endif
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return SUCCESS;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2));
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
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; 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
zend_int_t overflow; zend_long overflow;
ZEND_SIGNED_MULTIPLY_INT(Z_IVAL_P(op1), Z_IVAL_P(op2), Z_IVAL_P(result), Z_DVAL_P(result), overflow); 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_INT; Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return SUCCESS;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2));
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
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; 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) static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{ {
#if 0 #if 0
if (EXPECTED(Z_TYPE_P(op1) == IS_INT) && 0) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero"); zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0); ZVAL_BOOL(result, 0);
return FAILURE; 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 */ /* Prevent overflow error/crash */
ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1); 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 */ /* integer */
ZVAL_INT(result, Z_IVAL_P(op1) / Z_IVAL_P(op2)); ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
} else { } 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; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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); ZVAL_BOOL(result, 0);
return FAILURE; 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; return SUCCESS;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) { } 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)); ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2));
return SUCCESS; return SUCCESS;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero"); zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0); ZVAL_BOOL(result, 0);
return FAILURE; 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; 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (UNEXPECTED(Z_IVAL_P(op2) == 0)) { if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
zend_error(E_WARNING, "Division by zero"); zend_error(E_WARNING, "Division by zero");
ZVAL_BOOL(result, 0); ZVAL_BOOL(result, 0);
return FAILURE; 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 */ /* Prevent overflow error/crash if op1==ZEND_INT_MIN */
ZVAL_INT(result, 0); ZVAL_LONG(result, 0);
return SUCCESS; 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; 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_IVAL_P(op1) == Z_IVAL_P(op2); return Z_LVAL_P(op1) == Z_LVAL_P(op2);
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
return Z_DVAL_P(op1) == Z_DVAL_P(op2); return Z_DVAL_P(op1) == Z_DVAL_P(op2);
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2)); return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2));
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
if (Z_STR_P(op1) == Z_STR_P(op2)) { if (Z_STR_P(op1) == Z_STR_P(op2)) {
return 1; return 1;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { } 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; return 0;
} else { } 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 { } else {
zendi_smart_strcmp(result, op1, op2); 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); 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_IVAL_P(op1) == Z_IVAL_P(op2)); ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2)); ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_IVAL_P(op2))); ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
return; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { } 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); ZVAL_TRUE(result);
return; return;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { } 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); ZVAL_FALSE(result);
return; return;
} else { } 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; return;
} }
} else { } else {
zendi_smart_strcmp(result, op1, op2); zendi_smart_strcmp(result, op1, op2);
ZVAL_BOOL(result, Z_IVAL_P(result) == 0); ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
return; return;
} }
} }
} }
compare_function(result, op1, op2 TSRMLS_CC); 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_IVAL_P(op1) != Z_IVAL_P(op2)); ZVAL_BOOL(result, Z_LVAL_P(op1) != Z_LVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2)); ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_IVAL_P(op2))); ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2)));
return; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) { } 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); ZVAL_FALSE(result);
return; return;
} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { } 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); ZVAL_TRUE(result);
return; return;
} else { } 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; return;
} }
} else { } else {
zendi_smart_strcmp(result, op1, op2); zendi_smart_strcmp(result, op1, op2);
ZVAL_BOOL(result, Z_IVAL_P(result) != 0); ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
return; return;
} }
} }
} }
compare_function(result, op1, op2 TSRMLS_CC); 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_IVAL_P(op1) < Z_IVAL_P(op2)); ZVAL_BOOL(result, Z_LVAL_P(op1) < Z_LVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2)); ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_IVAL_P(op2))); ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2)));
return; return;
} }
} }
compare_function(result, op1, op2 TSRMLS_CC); 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) 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(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_IVAL_P(op1) <= Z_IVAL_P(op2)); ZVAL_BOOL(result, Z_LVAL_P(op1) <= Z_LVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { } 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; return;
} }
} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) { } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) { if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2)); ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2));
return; return;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_IVAL_P(op2))); ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2)));
return; return;
} }
} }
compare_function(result, op1, op2 TSRMLS_CC); 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) 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) } 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 #endif

View file

@ -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[size] is zeroed automatically by the kernel */
*buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0); *buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
if (*buf != MAP_FAILED) { 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; file_handle->handle.stream.mmap.map = *buf;
if (offset != -1) { if (offset != -1) {

View file

@ -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_snapshot_int(TSRMLS_D);
static void zend_interned_strings_restore_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); 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)); memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(zend_uint));
/* interned empty string */ /* interned empty string */
str = STR_ALLOC(sizeof("")-1, 1); str = zend_string_alloc(sizeof("")-1, 1);
str->val[0] = '\000'; str->val[0] = '\000';
CG(empty_string) = zend_new_interned_string_int(str TSRMLS_CC); CG(empty_string) = zend_new_interned_string_int(str TSRMLS_CC);
#else #else
str = STR_ALLOC(sizeof("")-1, 1); str = zend_string_alloc(sizeof("")-1, 1);
str->val[0] = '\000'; str->val[0] = '\000';
STR_HASH_VAL(str); zend_string_hash_val(str);
str->gc.u.v.flags |= IS_STR_INTERNED; str->gc.u.v.flags |= IS_STR_INTERNED;
CG(empty_string) = str; CG(empty_string) = str;
#endif #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) static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
{ {
#ifndef ZTS #ifndef ZTS
zend_uint_t h; zend_ulong h;
uint nIndex; uint nIndex;
uint idx; uint idx;
Bucket *p; Bucket *p;
@ -94,14 +94,14 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
return str; return str;
} }
h = STR_HASH_VAL(str); h = zend_string_hash_val(str);
nIndex = h & CG(interned_strings).nTableMask; nIndex = h & CG(interned_strings).nTableMask;
idx = CG(interned_strings).arHash[nIndex]; idx = CG(interned_strings).arHash[nIndex];
while (idx != INVALID_IDX) { while (idx != INVALID_IDX) {
p = CG(interned_strings).arData + idx; p = CG(interned_strings).arData + idx;
if ((p->h == h) && (p->key->len == str->len)) { if ((p->h == h) && (p->key->len == str->len)) {
if (!memcmp(p->key->val, str->val, str->len)) { if (!memcmp(p->key->val, str->val, str->len)) {
STR_RELEASE(str); zend_string_release(str);
return p->key; return p->key;
} }
} }
@ -182,7 +182,7 @@ static void zend_interned_strings_restore_int(TSRMLS_D)
GC_FLAGS(p->key) &= ~IS_STR_INTERNED; GC_FLAGS(p->key) &= ~IS_STR_INTERNED;
GC_REFCOUNT(p->key) = 1; GC_REFCOUNT(p->key) = 1;
STR_FREE(p->key); zend_string_free(p->key);
nIndex = p->h & CG(interned_strings).nTableMask; nIndex = p->h & CG(interned_strings).nTableMask;
if (CG(interned_strings).arHash[nIndex] == idx) { if (CG(interned_strings).arHash[nIndex] == idx) {

View file

@ -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_snapshot)(TSRMLS_D);
ZEND_API extern void (*zend_interned_strings_restore)(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_init(TSRMLS_D);
void zend_interned_strings_dtor(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 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_EMPTY_ALLOC() CG(empty_string)
#define _STR_HEADER_SIZE XtOffsetOf(zend_string, val) #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) #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) { if (!s->h) {
s->h = zend_hash_func(s->val, s->len); 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; 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; 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)) { if (!IS_INTERNED(s)) {
return GC_REFCOUNT(s); return GC_REFCOUNT(s);
@ -91,7 +76,7 @@ static zend_always_inline zend_uint zend_str_refcount(zend_string *s)
return 1; 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)) { if (!IS_INTERNED(s)) {
return ++GC_REFCOUNT(s); return ++GC_REFCOUNT(s);
@ -99,7 +84,7 @@ static zend_always_inline zend_uint zend_str_addref(zend_string *s)
return 1; 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)) { if (!IS_INTERNED(s)) {
return --GC_REFCOUNT(s); return --GC_REFCOUNT(s);
@ -107,7 +92,7 @@ static zend_always_inline zend_uint zend_str_delref(zend_string *s)
return 1; 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); 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; 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); 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; 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); memcpy(ret->val, str, len);
ret->val[len] = '\0'; ret->val[len] = '\0';
return ret; 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)) { if (!IS_INTERNED(s)) {
STR_ADDREF(s); zend_string_addref(s);
} }
return 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)) { if (IS_INTERNED(s)) {
return s; return s;
} else { } 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; zend_string *ret;
if (IS_INTERNED(s)) { 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); 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 = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent);
ret->len = len; ret->len = len;
STR_FORGET_HASH_VAL(ret); zend_string_forget_hash_val(ret);
} else { } else {
ret = STR_ALLOC(len, persistent); ret = zend_string_alloc(len, persistent);
memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1); memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
STR_DELREF(s); zend_string_delref(s);
} }
return ret; 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; zend_string *ret;
if (IS_INTERNED(s)) { 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); 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 = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + l + 1), persistent);
ret->len = (n * m) + l; ret->len = (n * m) + l;
STR_FORGET_HASH_VAL(ret); zend_string_forget_hash_val(ret);
} else { } 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); 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; 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)) { 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); 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 (!IS_INTERNED(s)) {
if (STR_DELREF(s) == 0) { if (zend_string_delref(s) == 0) {
pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); 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> * -- 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 */ /* variant with the hash unrolled eight times */
for (; len >= 8; len -= 8) { for (; len >= 8; len -= 8) {

View file

@ -110,7 +110,7 @@ ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zv
return retval; 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; zval *retval;
@ -187,7 +187,7 @@ ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key)
return retval; 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; int retval;
@ -209,7 +209,7 @@ ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key)
return retval; 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; zval *retval;
@ -231,7 +231,7 @@ ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key)
return retval; 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; int retval;

View file

@ -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) \ #define zend_ts_hash_add(ht, key, pData) \
_zend_ts_hash_add_or_update(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC) _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) \ #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) _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) \ #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 */ /* Deletes */
ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key); 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 */ /* Data retreival */
ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key); 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 */ /* Misc */
ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key); 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 */ /* Copying, merging and sorting */
ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor); ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);

View file

@ -42,8 +42,7 @@
typedef unsigned char zend_bool; typedef unsigned char zend_bool;
typedef unsigned char zend_uchar; typedef unsigned char zend_uchar;
typedef unsigned int zend_uint; typedef uint32_t zend_uint;
typedef unsigned long zend_ulong;
typedef unsigned short zend_ushort; typedef unsigned short zend_ushort;
#ifdef ZEND_ENABLE_INT64 #ifdef ZEND_ENABLE_INT64
@ -59,7 +58,6 @@ typedef unsigned short zend_ushort;
# define ZEND_SIZE_MAX SIZE_MAX # define ZEND_SIZE_MAX SIZE_MAX
# endif # endif
#endif #endif
typedef size_t zend_size_t;
#define HAVE_ZEND_LONG64 #define HAVE_ZEND_LONG64
#ifdef ZEND_WIN32 #ifdef ZEND_WIN32
@ -104,7 +102,7 @@ typedef void (*dtor_func_t)(zval *pDest);
typedef void (*copy_ctor_func_t)(zval *pElement); typedef void (*copy_ctor_func_t)(zval *pElement);
typedef union _zend_value { typedef union _zend_value {
zend_int_t lval; /* long value */ zend_long lval; /* long value */
double dval; /* double value */ double dval; /* double value */
zend_refcounted *counted; zend_refcounted *counted;
zend_string *str; zend_string *str;
@ -154,13 +152,13 @@ struct _zend_refcounted {
struct _zend_string { struct _zend_string {
zend_refcounted gc; zend_refcounted gc;
zend_uint_t h; /* hash value */ zend_ulong h; /* hash value */
zend_size_t len; size_t len;
char val[1]; char val[1];
}; };
typedef struct _Bucket { 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 */ zend_string *key; /* string key or NULL for numerics */
zval val; zval val;
} Bucket; } Bucket;
@ -170,7 +168,7 @@ typedef struct _HashTable {
zend_uint nTableMask; zend_uint nTableMask;
zend_uint nNumUsed; zend_uint nNumUsed;
zend_uint nNumOfElements; zend_uint nNumOfElements;
zend_int_t nNextFreeElement; zend_long nNextFreeElement;
Bucket *arData; Bucket *arData;
zend_uint *arHash; zend_uint *arHash;
dtor_func_t pDestructor; dtor_func_t pDestructor;
@ -203,7 +201,7 @@ struct _zend_object {
struct _zend_resource { struct _zend_resource {
zend_refcounted gc; zend_refcounted gc;
zend_int_t handle; // TODO: may be removed ??? zend_long handle; // TODO: may be removed ???
int type; int type;
void *ptr; void *ptr;
}; };
@ -223,7 +221,7 @@ struct _zend_ast_ref {
#define IS_NULL 1 #define IS_NULL 1
#define IS_FALSE 2 #define IS_FALSE 2
#define IS_TRUE 3 #define IS_TRUE 3
#define IS_INT 4 #define IS_LONG 4
#define IS_DOUBLE 5 #define IS_DOUBLE 5
#define IS_STRING 6 #define IS_STRING 6
#define IS_ARRAY 7 #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(zval) (Z_TYPE(zval) == IS_NULL)
#define Z_ISNULL_P(zval_p) Z_ISNULL(*(zval_p)) #define Z_ISNULL_P(zval_p) Z_ISNULL(*(zval_p))
#define Z_IVAL(zval) (zval).value.lval #define Z_LVAL(zval) (zval).value.lval
#define Z_IVAL_P(zval_p) Z_IVAL(*(zval_p)) #define Z_LVAL_P(zval_p) Z_LVAL(*(zval_p))
#define Z_DVAL(zval) (zval).value.dval #define Z_DVAL(zval) (zval).value.dval
#define Z_DVAL_P(zval_p) Z_DVAL(*(zval_p)) #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(zval) Z_STR(zval)->val
#define Z_STRVAL_P(zval_p) Z_STRVAL(*(zval_p)) #define Z_STRVAL_P(zval_p) Z_STRVAL(*(zval_p))
#define Z_STRSIZE(zval) Z_STR(zval)->len #define Z_STRLEN(zval) Z_STR(zval)->len
#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*(zval_p)) #define Z_STRLEN_P(zval_p) Z_STRLEN(*(zval_p))
#define Z_STRHASH(zval) Z_STR(zval)->h #define Z_STRHASH(zval) Z_STR(zval)->h
#define Z_STRHASH_P(zval_p) Z_STRHASH(*(zval_p)) #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; \ (b) ? IS_TRUE : IS_FALSE; \
} while (0) } while (0)
#define ZVAL_INT(z, l) { \ #define ZVAL_LONG(z, l) { \
zval *__z = (z); \ zval *__z = (z); \
Z_IVAL_P(__z) = l; \ Z_LVAL_P(__z) = l; \
Z_TYPE_INFO_P(__z) = IS_INT; \ Z_TYPE_INFO_P(__z) = IS_LONG; \
} }
#define ZVAL_DOUBLE(z, d) { \ #define ZVAL_DOUBLE(z, d) { \
@ -522,7 +520,7 @@ static inline zend_uchar zval_get_type(const zval* pz) {
IS_STRING_EX; \ IS_STRING_EX; \
} while (0) } while (0)
#define ZVAL_INT_STR(z, s) do { \ #define ZVAL_LONG_STR(z, s) do { \
zval *__z = (z); \ zval *__z = (z); \
zend_string *__s = (s); \ zend_string *__s = (s); \
Z_STR_P(__z) = __s; \ Z_STR_P(__z) = __s; \

View file

@ -34,7 +34,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
case IS_CONSTANT: { case IS_CONSTANT: {
zend_string *str = (zend_string*)p; zend_string *str = (zend_string*)p;
CHECK_ZVAL_STRING_REL(str); CHECK_ZVAL_STRING_REL(str);
STR_RELEASE(str); zend_string_release(str);
break; break;
} }
case IS_ARRAY: { 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: { case IS_CONSTANT: {
zend_string *str = (zend_string*)p; zend_string *str = (zend_string*)p;
CHECK_ZVAL_STRING_REL(str); CHECK_ZVAL_STRING_REL(str);
STR_FREE(str); zend_string_free(str);
break; break;
} }
case IS_ARRAY: { case IS_ARRAY: {
@ -150,7 +150,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
case IS_STRING: case IS_STRING:
case IS_CONSTANT: case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_RELEASE(Z_STR_P(zvalue)); zend_string_release(Z_STR_P(zvalue));
break; break;
case IS_ARRAY: case IS_ARRAY:
case IS_CONSTANT_AST: case IS_CONSTANT_AST:
@ -165,7 +165,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
free(ref); free(ref);
break; break;
} }
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: 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_STRING:
case IS_CONSTANT: case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue));
STR_FREE(Z_STR_P(zvalue)); zend_string_free(Z_STR_P(zvalue));
break; break;
case IS_ARRAY: case IS_ARRAY:
case IS_CONSTANT_AST: case IS_CONSTANT_AST:
@ -196,7 +196,7 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
free(ref); free(ref);
break; break;
} }
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_FALSE: case IS_FALSE:
case IS_TRUE: 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_CONSTANT:
case IS_STRING: case IS_STRING:
CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); 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; break;
case IS_ARRAY: { case IS_ARRAY: {
HashTable *ht; HashTable *ht;

View file

@ -178,7 +178,7 @@ static int php_check_dots(const char *element, int n)
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
typedef struct { typedef struct {
zend_uint_t ReparseTag; zend_ulong ReparseTag;
unsigned short ReparseDataLength; unsigned short ReparseDataLength;
unsigned short Reserved; unsigned short Reserved;
union { union {
@ -187,7 +187,7 @@ typedef struct {
unsigned short SubstituteNameLength; unsigned short SubstituteNameLength;
unsigned short PrintNameOffset; unsigned short PrintNameOffset;
unsigned short PrintNameLength; unsigned short PrintNameLength;
zend_uint_t Flags; zend_ulong Flags;
wchar_t ReparseTarget[1]; wchar_t ReparseTarget[1];
} SymbolicLinkReparseBuffer; } SymbolicLinkReparseBuffer;
struct { struct {
@ -582,9 +582,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */
/* }}} */ /* }}} */
#ifdef PHP_WIN32 #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_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC);
char *bucket_key = (char *)bucket_key_start; char *bucket_key = (char *)bucket_key_start;
const char *e = bucket_key + strlen(bucket_key); 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 #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; const char *e = path + path_len;
for (h = Z_UI(2166136261); path < e;) { 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) /* {{{ */ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */
{ {
#ifdef PHP_WIN32 #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 #else
zend_uint_t key = realpath_cache_key(path, path_len); zend_ulong key = realpath_cache_key(path, path_len);
#endif #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]; realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
while (*bucket != NULL) { 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) /* {{{ */ 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; int same = 1;
if (realpath_len != path_len || 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)) { if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) {
realpath_cache_bucket *bucket = malloc(size); realpath_cache_bucket *bucket = malloc(size);
zend_uint_t n; zend_ulong n;
if (bucket == NULL) { if (bucket == NULL) {
return; 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) /* {{{ */ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */
{ {
#ifdef PHP_WIN32 #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 #else
zend_uint_t key = realpath_cache_key(path, path_len); zend_ulong key = realpath_cache_key(path, path_len);
#endif #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]; realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n];
while (*bucket != NULL) { 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); 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])); return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
} }

View file

@ -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 */ #define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
typedef struct _realpath_cache_bucket { typedef struct _realpath_cache_bucket {
zend_uint_t key; zend_ulong key;
char *path; char *path;
int path_len; int path_len;
char *realpath; char *realpath;
@ -229,9 +229,9 @@ typedef struct _realpath_cache_bucket {
typedef struct _virtual_cwd_globals { typedef struct _virtual_cwd_globals {
cwd_state cwd; cwd_state cwd;
zend_int_t realpath_cache_size; zend_long realpath_cache_size;
zend_int_t realpath_cache_size_limit; zend_long realpath_cache_size_limit;
zend_int_t realpath_cache_ttl; zend_long realpath_cache_ttl;
realpath_cache_bucket *realpath_cache[1024]; realpath_cache_bucket *realpath_cache[1024];
} virtual_cwd_globals; } 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_clean(TSRMLS_D);
CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC); 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 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_long realpath_cache_size(TSRMLS_D);
CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D); CWD_API zend_long realpath_cache_max_buckets(TSRMLS_D);
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D); CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
/* The actual macros to be used in programs using TSRM /* The actual macros to be used in programs using TSRM

View file

@ -867,7 +867,7 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
SAVE_OPLINE(); SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); 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); fast_increment_function(var_ptr);
if (RETURN_VALUE_USED(opline)) { if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); 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(); SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); 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); fast_decrement_function(var_ptr);
if (RETURN_VALUE_USED(opline)) { if (RETURN_VALUE_USED(opline)) {
ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr); 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(); SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); 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); ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_increment_function(var_ptr); fast_increment_function(var_ptr);
ZEND_VM_NEXT_OPCODE(); ZEND_VM_NEXT_OPCODE();
@ -1031,7 +1031,7 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
SAVE_OPLINE(); SAVE_OPLINE();
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); 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); ZVAL_COPY_VALUE(EX_VAR(opline->result.var), var_ptr);
fast_decrement_function(var_ptr); fast_decrement_function(var_ptr);
ZEND_VM_NEXT_OPCODE(); ZEND_VM_NEXT_OPCODE();
@ -1096,7 +1096,7 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY)
{ {
USE_OPLINE 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); 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); name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) { } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname); name = Z_STR_P(varname);
STR_ADDREF(name); zend_string_addref(name);
} else { } else {
name = zval_get_string(varname); 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); ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) { if (UNEXPECTED(ce == NULL)) {
if (OP1_TYPE != IS_CONST) { if (OP1_TYPE != IS_CONST) {
STR_RELEASE(name); zend_string_release(name);
} }
FREE_OP1(); FREE_OP1();
CHECK_EXCEPTION(); 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) { if (OP1_TYPE != IS_CONST) {
STR_RELEASE(name); zend_string_release(name);
} }
ZEND_ASSERT(retval != NULL); 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); ZVAL_DEREF(function_name);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
if (Z_STRVAL_P(function_name)[0] == '\\') { if (Z_STRVAL_P(function_name)[0] == '\\') {
lcname = STR_ALLOC(Z_STRSIZE_P(function_name) - 1, 0); lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRSIZE_P(function_name) - 1); zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else { } else {
lcname = STR_ALLOC(Z_STRSIZE_P(function_name), 0); lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); 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)) { 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)); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
} }
STR_FREE(lcname); zend_string_free(lcname);
FREE_OP2(); FREE_OP2();
fbc = Z_FUNC_P(func); fbc = Z_FUNC_P(func);
called_scope = NULL; 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); zend_vm_stack_free_call_frame(call TSRMLS_CC);
if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
STR_RELEASE(fbc->common.function_name); zend_string_release(fbc->common.function_name);
} }
efree(fbc); efree(fbc);
@ -3630,7 +3630,7 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST)
zend_brk_cont_element *el; zend_brk_cont_element *el;
SAVE_OPLINE(); 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); &EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk); 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; zend_brk_cont_element *el;
SAVE_OPLINE(); 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); &EX(func)->op_array, execute_data TSRMLS_CC);
ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont); 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; zend_brk_cont_element *el;
SAVE_OPLINE(); 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); &EX(func)->op_array, execute_data TSRMLS_CC);
brk_opline = EX(func)->op_array.opcodes + el->brk; 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)); 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) { } 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) { 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) { if(!actual) {
actual = Z_STRVAL_P(opline->op2.zv); actual = Z_STRVAL_P(opline->op2.zv);
} else { } else {
@ -3823,7 +3823,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
} }
/* non-qualified constant - allow text substitution */ /* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); 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(); CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE(); ZEND_VM_NEXT_OPCODE();
} else { } 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); CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
} }
ZVAL_DUP(EX_VAR(opline->result.var), 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 */ /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
ZVAL_STR(EX_VAR(opline->result.var), ce->name); ZVAL_STR(EX_VAR(opline->result.var), ce->name);
STR_ADDREF(ce->name); zend_string_addref(ce->name);
} else { } else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); 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; zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
zend_string *str; zend_string *str;
zend_uint_t hval; zend_ulong hval;
ZEND_VM_C_LABEL(add_again): ZEND_VM_C_LABEL(add_again):
switch (Z_TYPE_P(offset)) { switch (Z_TYPE_P(offset)) {
case IS_DOUBLE: 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); ZEND_VM_C_GOTO(num_index);
case IS_INT: case IS_LONG:
hval = Z_IVAL_P(offset); hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index): ZEND_VM_C_LABEL(num_index):
zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr); zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break; break;
@ -4049,8 +4049,8 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
case _IS_BOOL: case _IS_BOOL:
ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC)); ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
break; break;
case IS_INT: case IS_LONG:
ZVAL_INT(result, zval_get_int(expr)); ZVAL_LONG(result, zval_get_long(expr));
break; break;
case IS_DOUBLE: case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(expr)); 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; 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) { 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); zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
} else { } else {
@ -4159,7 +4159,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_file_handle file_handle; zend_file_handle file_handle;
char *resolved_path; 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) { if (resolved_path) {
failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path)); failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
} else { } 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; zend_free_op free_op1, free_op2;
zval *container; zval *container;
zval *offset; zval *offset;
zend_uint_t hval; zend_ulong hval;
SAVE_OPLINE(); SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); 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): ZEND_VM_C_LABEL(offset_again):
switch (Z_TYPE_P(offset)) { switch (Z_TYPE_P(offset)) {
case IS_DOUBLE: 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); zend_hash_index_del(ht, hval);
break; break;
case IS_INT: case IS_LONG:
hval = Z_IVAL_P(offset); hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_dim): ZEND_VM_C_LABEL(num_index_dim):
zend_hash_index_del(ht, hval); zend_hash_index_del(ht, hval);
break; 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); zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
zend_string *str_key; zend_string *str_key;
zend_uint_t int_key; zend_ulong int_key;
zend_uchar key_type; zend_uchar key_type;
key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0); key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
if (key_type != HASH_KEY_NON_EXISTENT && 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)) { zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break; break;
} }
@ -4674,7 +4674,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zend_object *zobj = Z_OBJ_P(array); zend_object *zobj = Z_OBJ_P(array);
int key_type; int key_type;
zend_string *str_key; zend_string *str_key;
zend_uint_t int_key; zend_ulong int_key;
fe_ht = Z_OBJPROP_P(array); fe_ht = Z_OBJPROP_P(array);
zend_hash_set_pointer(fe_ht, (HashPointer*)EX_VAR((opline+1)->op1.var)); 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); key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
zend_hash_move_forward(fe_ht); 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) { zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) {
break; break;
} }
} }
if (key) { if (key) {
if (key_type == HASH_KEY_IS_INT) { if (key_type == HASH_KEY_IS_LONG) {
ZVAL_INT(key, int_key); ZVAL_LONG(key, int_key);
} else { } else {
const char *class_name, *prop_name; const char *class_name, *prop_name;
int prop_name_len; int prop_name_len;
@ -4769,7 +4769,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
HANDLE_EXCEPTION(); HANDLE_EXCEPTION();
} }
} else { } else {
ZVAL_INT(key, iter->index); ZVAL_LONG(key, iter->index);
} }
} }
break; 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; zend_free_op free_op1, free_op2;
zval *container; zval *container;
int result; int result;
zend_uint_t hval; zend_ulong hval;
zval *offset; zval *offset;
SAVE_OPLINE(); SAVE_OPLINE();
@ -4896,14 +4896,14 @@ ZEND_VM_C_LABEL(isset_again):
} }
ZEND_VM_C_LABEL(str_index_prop): ZEND_VM_C_LABEL(str_index_prop):
value = zend_hash_find_ind(ht, str); value = zend_hash_find_ind(ht, str);
} else if (EXPECTED(Z_TYPE_P(offset) == IS_INT)) { } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
hval = Z_IVAL_P(offset); hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_prop): ZEND_VM_C_LABEL(num_index_prop):
value = zend_hash_index_find(ht, hval); value = zend_hash_index_find(ht, hval);
} else { } else {
switch (Z_TYPE_P(offset)) { switch (Z_TYPE_P(offset)) {
case IS_DOUBLE: 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); ZEND_VM_C_GOTO(num_index_prop);
case IS_NULL: case IS_NULL:
str = STR_EMPTY_ALLOC(); str = STR_EMPTY_ALLOC();
@ -4948,20 +4948,20 @@ ZEND_VM_C_LABEL(num_index_prop):
zval tmp; zval tmp;
result = 0; 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) { if (OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) {
ZVAL_DEREF(offset); ZVAL_DEREF(offset);
} }
if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ || (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); ZVAL_DUP(&tmp, offset);
convert_to_int(&tmp); convert_to_int(&tmp);
offset = &tmp; offset = &tmp;
} }
} }
if (Z_TYPE_P(offset) == IS_INT) { if (Z_TYPE_P(offset) == IS_LONG) {
if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_P(container)) { if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
if ((opline->extended_value & ZEND_ISSET) || if ((opline->extended_value & ZEND_ISSET) ||
Z_STRVAL_P(container)[offset->value.lval] != '0') { Z_STRVAL_P(container)[offset->value.lval] != '0') {
result = 1; result = 1;
@ -5025,8 +5025,8 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
zend_free_op free_op1; zend_free_op free_op1;
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_P(ptr) == IS_INT) { if (Z_TYPE_P(ptr) == IS_LONG) {
EG(exit_status) = Z_IVAL_P(ptr); EG(exit_status) = Z_LVAL_P(ptr);
} else { } else {
zend_print_variable(ptr TSRMLS_CC); zend_print_variable(ptr TSRMLS_CC);
} }
@ -5042,9 +5042,9 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
USE_OPLINE USE_OPLINE
SAVE_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) { 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)) { 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) ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
{ {
USE_OPLINE USE_OPLINE
char buf[MAX_LENGTH_OF_ZEND_INT + 1]; char buf[MAX_LENGTH_OF_LONG + 1];
char *res; char *res;
SAVE_OPLINE(); SAVE_OPLINE();
if (!EG(error_reporting) && Z_IVAL_P(EX_VAR(opline->op1.var)) != 0) { if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
EG(error_reporting) = Z_IVAL_P(EX_VAR(opline->op1.var)); EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
_zend_print_signed_to_buf(buf + sizeof(buf) - 1, EG(error_reporting), zend_uint_t, res); _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) != NULL)) {
if (EXPECTED(EG(error_reporting_ini_entry)->modified && if (EXPECTED(EG(error_reporting_ini_entry)->modified &&
EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { 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 */ /* 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; zval restored_error_reporting;
zend_string *key; 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); convert_to_string(&restored_error_reporting);
key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0); key = zend_string_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); 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);
STR_FREE(key); zend_string_free(key);
zval_dtor(&restored_error_reporting); zval_dtor(&restored_error_reporting);
} }
ZVAL_UNDEF(&EX(old_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.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; c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { 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); ZVAL_COPY_VALUE(&generator->key, key);
} }
if (Z_TYPE(generator->key) == IS_INT if (Z_TYPE(generator->key) == IS_LONG
&& Z_IVAL(generator->key) > generator->largest_used_integer_key && 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 { } else {
/* If no key was specified we use auto-increment keys */ /* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++; 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)) { if (RETURN_VALUE_USED(opline)) {
@ -5873,24 +5873,24 @@ ZEND_VM_HANDLER(121, ZEND_STRLEN, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE(); SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) { 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 { } else {
if (Z_TYPE_P(value) < IS_TRUE) { 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) { } 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) { } else if (Z_TYPE_P(value) <= IS_DOUBLE) {
zend_string *str = zval_get_string(value); zend_string *str = zval_get_string(value);
ZVAL_INT(EX_VAR(opline->result.var), str->len); ZVAL_LONG(EX_VAR(opline->result.var), str->len);
STR_RELEASE(str); zend_string_release(str);
} else if (Z_TYPE_P(value) == IS_OBJECT) { } else if (Z_TYPE_P(value) == IS_OBJECT) {
zend_string *str; zend_string *str;
if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) { if (parse_arg_object_to_str(value, &str, IS_STRING TSRMLS_CC) == FAILURE) {
ZEND_VM_C_GOTO(strlen_error); ZEND_VM_C_GOTO(strlen_error);
} }
ZVAL_INT(EX_VAR(opline->result.var), str->len); ZVAL_LONG(EX_VAR(opline->result.var), str->len);
STR_RELEASE(str); zend_string_release(str);
} else { } else {
ZEND_VM_C_LABEL(strlen_error): 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))); 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); value = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
switch (opline->extended_value) { switch (opline->extended_value) {
case IS_NULL: case IS_NULL:
case IS_INT: case IS_LONG:
case IS_DOUBLE: case IS_DOUBLE:
case IS_STRING: case IS_STRING:
case IS_ARRAY: case IS_ARRAY:

File diff suppressed because it is too large Load diff

View file

@ -206,12 +206,12 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
PHP_FUNCTION(bcadd) PHP_FUNCTION(bcadd)
{ {
char *left, *right; char *left, *right;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second, result; bc_num first, second, result;
int left_len, right_len; int left_len, right_len;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -244,11 +244,11 @@ PHP_FUNCTION(bcsub)
{ {
char *left, *right; char *left, *right;
int left_len, right_len; int left_len, right_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second, result; bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -281,11 +281,11 @@ PHP_FUNCTION(bcmul)
{ {
char *left, *right; char *left, *right;
int left_len, right_len; int left_len, right_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second, result; bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -318,11 +318,11 @@ PHP_FUNCTION(bcdiv)
{ {
char *left, *right; char *left, *right;
int left_len, right_len; int left_len, right_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second, result; bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -396,10 +396,10 @@ PHP_FUNCTION(bcpowmod)
char *left, *right, *modulous; char *left, *right, *modulous;
int left_len, right_len, modulous_len; int left_len, right_len, modulous_len;
bc_num first, second, mod, result; bc_num first, second, mod, result;
php_int_t scale = BCG(bc_precision); zend_long scale = BCG(bc_precision);
int scale_int; 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; return;
} }
@ -436,11 +436,11 @@ PHP_FUNCTION(bcpow)
{ {
char *left, *right; char *left, *right;
int left_len, right_len; int left_len, right_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second, result; bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -473,11 +473,11 @@ PHP_FUNCTION(bcsqrt)
{ {
char *left; char *left;
int left_len; int left_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num result; bc_num result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -508,11 +508,11 @@ PHP_FUNCTION(bccomp)
{ {
char *left, *right; char *left, *right;
int left_len, right_len; int left_len, right_len;
php_int_t scale_param = 0; zend_long scale_param = 0;
bc_num first, second; bc_num first, second;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -525,7 +525,7 @@ PHP_FUNCTION(bccomp)
bc_str2num(&first, left, scale TSRMLS_CC); bc_str2num(&first, left, scale TSRMLS_CC);
bc_str2num(&second, right, 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(&first);
bc_free_num(&second); bc_free_num(&second);
@ -537,9 +537,9 @@ PHP_FUNCTION(bccomp)
Sets default scale parameter for all bc math functions */ Sets default scale parameter for all bc math functions */
PHP_FUNCTION(bcscale) 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; return;
} }

View file

@ -52,9 +52,9 @@ zend_string
/* Allocate the string memory. */ /* Allocate the string memory. */
signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */
if (num->n_scale > 0) 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 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(); if (str == NULL) bc_out_of_memory();
/* The negative sign if needed. */ /* The negative sign if needed. */

View file

@ -45,7 +45,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
bc_num _zero_; bc_num _zero_;
bc_num _one_; bc_num _one_;
bc_num _two_; bc_num _two_;
php_int_t bc_precision; zend_long bc_precision;
ZEND_END_MODULE_GLOBALS(bcmath) ZEND_END_MODULE_GLOBALS(bcmath)
#ifdef ZTS #ifdef ZTS

View file

@ -343,11 +343,11 @@ static PHP_MINFO_FUNCTION(bz2)
static PHP_FUNCTION(bzread) static PHP_FUNCTION(bzread)
{ {
zval *bz; zval *bz;
php_int_t len = 1024; zend_long len = 1024;
php_stream *stream; php_stream *stream;
zend_string *data; 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; RETURN_FALSE;
} }
@ -357,11 +357,11 @@ static PHP_FUNCTION(bzread)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "length may not be negative");
RETURN_FALSE; RETURN_FALSE;
} }
data = STR_ALLOC(len, 0); data = zend_string_alloc(len, 0);
data->len = php_stream_read(stream, data->val, data->len); data->len = php_stream_read(stream, data->val, data->len);
if (data->len < 0) { 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
RETURN_FALSE; 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 it's not a resource its a string containing the filename to open */
if (Z_TYPE_P(file) == IS_STRING) { 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty");
RETURN_FALSE; RETURN_FALSE;
} }
@ -490,8 +490,8 @@ static PHP_FUNCTION(bzerror)
static PHP_FUNCTION(bzcompress) static PHP_FUNCTION(bzcompress)
{ {
char *source; /* Source data to compress */ char *source; /* Source data to compress */
php_int_t zblock_size = 0; /* Optional block size to use */ zend_long zblock_size = 0; /* Optional block size to use */
php_int_t zwork_factor = 0;/* Optional work factor to use */ zend_long zwork_factor = 0;/* Optional work factor to use */
zend_string *dest = NULL; /* Destination to place the compressed data into */ zend_string *dest = NULL; /* Destination to place the compressed data into */
int error, /* Error Container */ int error, /* Error Container */
block_size = 4, /* Block size for compression algorithm */ block_size = 4, /* Block size for compression algorithm */
@ -502,7 +502,7 @@ static PHP_FUNCTION(bzcompress)
argc = ZEND_NUM_ARGS(); 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; return;
} }
@ -513,7 +513,7 @@ static PHP_FUNCTION(bzcompress)
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600); dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
/* Allocate the destination buffer */ /* Allocate the destination buffer */
dest = STR_ALLOC(dest_len, 0); dest = zend_string_alloc(dest_len, 0);
/* Handle the optional arguments */ /* Handle the optional arguments */
if (argc > 1) { 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); error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor);
if (error != BZ_OK) { if (error != BZ_OK) {
STR_FREE(dest); zend_string_free(dest);
RETURN_INT(error); RETURN_LONG(error);
} else { } else {
/* Copy the buffer, we have perhaps allocate a lot more than we need, /* Copy the buffer, we have perhaps allocate a lot more than we need,
so we erealloc() the buffer to the proper size */ so we erealloc() the buffer to the proper size */
@ -544,7 +544,7 @@ static PHP_FUNCTION(bzdecompress)
{ {
char *source, *dest; char *source, *dest;
int source_len, error; int source_len, error;
php_int_t small = 0; zend_long small = 0;
#if defined(PHP_WIN32) #if defined(PHP_WIN32)
unsigned __int64 size = 0; unsigned __int64 size = 0;
#else #else
@ -552,7 +552,7 @@ static PHP_FUNCTION(bzdecompress)
#endif #endif
bz_stream bzs; 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; RETURN_FALSE;
} }
@ -586,7 +586,7 @@ static PHP_FUNCTION(bzdecompress)
efree(dest); efree(dest);
} else { /* real error */ } else { /* real error */
efree(dest); efree(dest);
RETVAL_INT(error); RETVAL_LONG(error);
} }
BZ2_bzDecompressEnd(&bzs); BZ2_bzDecompressEnd(&bzs);
@ -621,7 +621,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
/* Determine what to return */ /* Determine what to return */
switch (opt) { switch (opt) {
case PHP_BZ_ERRNO: case PHP_BZ_ERRNO:
RETURN_INT(errnum); RETURN_LONG(errnum);
break; break;
case PHP_BZ_ERRSTR: case PHP_BZ_ERRSTR:
RETURN_STRING((char*)errstr); RETURN_STRING((char*)errstr);
@ -629,7 +629,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
case PHP_BZ_ERRBOTH: case PHP_BZ_ERRBOTH:
array_init(return_value); 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); add_assoc_string(return_value, "errstr", (char*)errstr);
break; break;
} }

View file

@ -381,10 +381,10 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
ZVAL_DUP(&tmp, tmpzval); ZVAL_DUP(&tmp, tmpzval);
convert_to_int(&tmp); convert_to_int(&tmp);
if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) { 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_IVAL_P(tmpzval)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_LVAL_P(tmpzval));
} else { } 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); ZVAL_DUP(&tmp, tmpzval);
convert_to_int(&tmp); convert_to_int(&tmp);
if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) { 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_IVAL(tmp)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_LVAL(tmp));
} else { } else {
workFactor = Z_IVAL(tmp); workFactor = Z_LVAL(tmp);
} }
} }
} }

View file

@ -31,7 +31,7 @@ PHP_FUNCTION(unixtojd)
time_t ts = 0; time_t ts = 0;
struct tm *ta, tmbuf; 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; return;
} }
@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd)
RETURN_FALSE; 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_FALSE;
} }
RETURN_INT(uday * 24 * 3600); RETURN_LONG(uday * 24 * 3600);
} }
/* }}} */ /* }}} */

View file

@ -178,8 +178,8 @@ enum cal_name_type_t {
CAL_NUM_CALS CAL_NUM_CALS
}; };
typedef php_int_t (*cal_to_jd_func_t) (int month, int day, int year); typedef zend_long (*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 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); typedef char *(*cal_as_string_func_t) (int year, int month, int day);
struct cal_entry_t { struct cal_entry_t {
@ -225,31 +225,31 @@ static char alef_bet[25] = "0
PHP_MINIT_FUNCTION(calendar) PHP_MINIT_FUNCTION(calendar)
{ {
REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_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_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
/* constants for jddayofweek */ /* constants for jddayofweek */
REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_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_LONG_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_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
/* constants for jdmonthname */ /* constants for jdmonthname */
REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_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_LONG_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_LONG_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_LONG_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_LONG_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_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
/* constants for easter calculation */ /* constants for easter calculation */
REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_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_LONG_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_LONG_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_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
/* constants for Jewish date formatting */ /* constants for Jewish date formatting */
REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_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_LONG_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_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
return SUCCESS; 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, "months", &months);
add_assoc_zval(ret, "abbrevmonths", &smonths); 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, "calname", calendar->name);
add_assoc_string(ret, "calsymbol", calendar->symbol); 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 */ Returns information about a particular calendar */
PHP_FUNCTION(cal_info) 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; RETURN_FALSE;
} }
@ -324,11 +324,11 @@ PHP_FUNCTION(cal_info)
Returns the number of days in a month for a given year and calendar */ Returns the number of days in a month for a given year and calendar */
PHP_FUNCTION(cal_days_in_month) PHP_FUNCTION(cal_days_in_month)
{ {
php_int_t cal, month, year; zend_long cal, month, year;
struct cal_entry_t *calendar; 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; 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 */ Converts from a supported calendar to Julian Day Count */
PHP_FUNCTION(cal_to_jd) 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; RETURN_FALSE;
} }
@ -379,7 +379,7 @@ PHP_FUNCTION(cal_to_jd)
RETURN_FALSE; 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 */ Converts from Julian Day Count to a supported calendar and return extended information */
PHP_FUNCTION(cal_from_jd) PHP_FUNCTION(cal_from_jd)
{ {
php_int_t jd, cal; zend_long jd, cal;
int month, day, year, dow; int month, day, year, dow;
char date[16]; char date[16];
struct cal_entry_t *calendar; 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; RETURN_FALSE;
} }
@ -409,13 +409,13 @@ PHP_FUNCTION(cal_from_jd)
snprintf(date, sizeof(date), "%i/%i/%i", month, day, year); snprintf(date, sizeof(date), "%i/%i/%i", month, day, year);
add_assoc_string(return_value, "date", date); add_assoc_string(return_value, "date", date);
add_assoc_int(return_value, "month", month); add_assoc_long(return_value, "month", month);
add_assoc_int(return_value, "day", day); add_assoc_long(return_value, "day", day);
add_assoc_int(return_value, "year", year); add_assoc_long(return_value, "year", year);
/* day of week */ /* day of week */
dow = DayOfWeek(jd); 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, "abbrevdayname", DayNameShort[dow]);
add_assoc_string(return_value, "dayname", DayNameLong[dow]); add_assoc_string(return_value, "dayname", DayNameLong[dow]);
/* month name */ /* month name */
@ -434,11 +434,11 @@ PHP_FUNCTION(cal_from_jd)
Converts a julian day count to a gregorian calendar date */ Converts a julian day count to a gregorian calendar date */
PHP_FUNCTION(jdtogregorian) PHP_FUNCTION(jdtogregorian)
{ {
php_int_t julday; zend_long julday;
int year, month, day; int year, month, day;
char date[16]; 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; RETURN_FALSE;
} }
@ -453,13 +453,13 @@ PHP_FUNCTION(jdtogregorian)
Converts a gregorian calendar date to julian day count */ Converts a gregorian calendar date to julian day count */
PHP_FUNCTION(gregoriantojd) 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_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 */ Convert a julian day count to a julian calendar date */
PHP_FUNCTION(jdtojulian) PHP_FUNCTION(jdtojulian)
{ {
php_int_t julday; zend_long julday;
int year, month, day; int year, month, day;
char date[16]; 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; RETURN_FALSE;
} }
@ -486,13 +486,13 @@ PHP_FUNCTION(jdtojulian)
Converts a julian calendar date to julian day count */ Converts a julian calendar date to julian day count */
PHP_FUNCTION(juliantojd) 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_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 */ Converts a julian day count to a jewish calendar date */
PHP_FUNCTION(jdtojewish) PHP_FUNCTION(jdtojewish)
{ {
php_int_t julday, fl = 0; zend_long julday, fl = 0;
zend_bool heb = 0; zend_bool heb = 0;
int year, month, day; int year, month, day;
char date[16], hebdate[32]; char date[16], hebdate[32];
char *dayp, *yearp; 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; RETURN_FALSE;
} }
@ -634,13 +634,13 @@ PHP_FUNCTION(jdtojewish)
Converts a jewish calendar date to a julian day count */ Converts a jewish calendar date to a julian day count */
PHP_FUNCTION(jewishtojd) 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_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 */ Converts a julian day count to a french republic calendar date */
PHP_FUNCTION(jdtofrench) PHP_FUNCTION(jdtofrench)
{ {
php_int_t julday; zend_long julday;
int year, month, day; int year, month, day;
char date[16]; 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; RETURN_FALSE;
} }
@ -667,13 +667,13 @@ PHP_FUNCTION(jdtofrench)
Converts a french republic calendar date to julian day count */ Converts a french republic calendar date to julian day count */
PHP_FUNCTION(frenchtojd) 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_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 */ Returns name or number of day of week from julian day count */
PHP_FUNCTION(jddayofweek) PHP_FUNCTION(jddayofweek)
{ {
php_int_t julday, mode = CAL_DOW_DAYNO; zend_long julday, mode = CAL_DOW_DAYNO;
int day; int day;
char *daynamel, *daynames; 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; RETURN_FALSE;
} }
@ -702,7 +702,7 @@ PHP_FUNCTION(jddayofweek)
break; break;
case CAL_DOW_DAYNO: case CAL_DOW_DAYNO:
default: default:
RETURN_INT(day); RETURN_LONG(day);
break; break;
} }
} }
@ -712,11 +712,11 @@ PHP_FUNCTION(jddayofweek)
Returns name of month for julian day count */ Returns name of month for julian day count */
PHP_FUNCTION(jdmonthname) PHP_FUNCTION(jdmonthname)
{ {
php_int_t julday, mode; zend_long julday, mode;
char *monthname = NULL; char *monthname = NULL;
int month, day, year; 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; RETURN_FALSE;
} }

View file

@ -32,7 +32,7 @@
#include "sdncal.h" #include "sdncal.h"
int DayOfWeek( int DayOfWeek(
php_int_t sdn) zend_long sdn)
{ {
int dow; int dow;

View file

@ -24,14 +24,14 @@
#include "sdncal.h" #include "sdncal.h"
#include <time.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> */ /* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
struct tm te; struct tm te;
php_int_t year, golden, solar, lunar, pfm, dom, tmp, easter, result; zend_long year, golden, solar, lunar, pfm, dom, tmp, easter, result;
php_int_t method = CAL_EASTER_DEFAULT; zend_long method = CAL_EASTER_DEFAULT;
/* Default to the current year if year parameter is not given */ /* 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, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"|ii", &year, &method) == FAILURE) { "|ll", &year, &method) == FAILURE) {
return; return;
} }
@ -115,7 +115,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm)
} else { /* return the days after March 21 */ } else { /* return the days after March 21 */
result = easter; result = easter;
} }
ZVAL_INT(return_value, result); ZVAL_LONG(return_value, result);
} }
/* {{{ proto int easter_date([int year]) /* {{{ proto int easter_date([int year])

View file

@ -93,12 +93,12 @@
#define LAST_VALID 2380952 #define LAST_VALID 2380952
void SdnToFrench( void SdnToFrench(
php_int_t sdn, zend_long sdn,
int *pYear, int *pYear,
int *pMonth, int *pMonth,
int *pDay) int *pDay)
{ {
php_int_t temp; zend_long temp;
int dayOfYear; int dayOfYear;
if (sdn < FIRST_VALID || sdn > LAST_VALID) { if (sdn < FIRST_VALID || sdn > LAST_VALID) {
@ -114,7 +114,7 @@ void SdnToFrench(
*pDay = dayOfYear % DAYS_PER_MONTH + 1; *pDay = dayOfYear % DAYS_PER_MONTH + 1;
} }
php_int_t FrenchToSdn( zend_long FrenchToSdn(
int year, int year,
int month, int month,
int day) int day)

View file

@ -135,7 +135,7 @@
#define DAYS_PER_400_YEARS 146097 #define DAYS_PER_400_YEARS 146097
void SdnToGregorian( void SdnToGregorian(
php_int_t sdn, zend_long sdn,
int *pYear, int *pYear,
int *pMonth, int *pMonth,
int *pDay) int *pDay)
@ -144,7 +144,7 @@ void SdnToGregorian(
int year; int year;
int month; int month;
int day; int day;
php_int_t temp; zend_long temp;
int dayOfYear; int dayOfYear;
if (sdn <= 0 || if (sdn <= 0 ||
@ -190,7 +190,7 @@ fail:
*pDay = 0; *pDay = 0;
} }
php_int_t GregorianToSdn( zend_long GregorianToSdn(
int inputYear, int inputYear,
int inputMonth, int inputMonth,
int inputDay) int inputDay)

View file

@ -382,12 +382,12 @@ char *JewishMonthHebName[14] =
* (called dehiyyot) delays it. These 4 rules can delay the start of the * (called dehiyyot) delays it. These 4 rules can delay the start of the
* year by as much as 2 days. * year by as much as 2 days.
*/ */
static php_int_t Tishri1( static zend_long Tishri1(
int metonicYear, int metonicYear,
php_int_t moladDay, zend_long moladDay,
php_int_t moladHalakim) zend_long moladHalakim)
{ {
php_int_t tishri1; zend_long tishri1;
int dow; int dow;
int leapYear; int leapYear;
int lastWasLeapYear; int lastWasLeapYear;
@ -429,10 +429,10 @@ static php_int_t Tishri1(
*/ */
static void MoladOfMetonicCycle( static void MoladOfMetonicCycle(
int metonicCycle, int metonicCycle,
php_int_t *pMoladDay, zend_long *pMoladDay,
php_int_t *pMoladHalakim) 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. */ /* Start with the time of the first molad after creation. */
r1 = NEW_MOON_OF_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. * us to avoid calculating the length of the year in most cases.
*/ */
static void FindTishriMolad( static void FindTishriMolad(
php_int_t inputDay, zend_long inputDay,
int *pMetonicCycle, int *pMetonicCycle,
int *pMetonicYear, int *pMetonicYear,
php_int_t *pMoladDay, zend_long *pMoladDay,
php_int_t *pMoladHalakim) zend_long *pMoladHalakim)
{ {
php_int_t moladDay; zend_long moladDay;
php_int_t moladHalakim; zend_long moladHalakim;
int metonicCycle; int metonicCycle;
int metonicYear; int metonicYear;
@ -523,8 +523,8 @@ static void FindStartOfYear(
int year, int year,
int *pMetonicCycle, int *pMetonicCycle,
int *pMetonicYear, int *pMetonicYear,
php_int_t *pMoladDay, zend_long *pMoladDay,
php_int_t *pMoladHalakim, zend_long *pMoladHalakim,
int *pTishri1) int *pTishri1)
{ {
*pMetonicCycle = (year - 1) / 19; *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. * range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive.
*/ */
void SdnToJewish( void SdnToJewish(
php_int_t sdn, zend_long sdn,
int *pYear, int *pYear,
int *pMonth, int *pMonth,
int *pDay) int *pDay)
{ {
php_int_t inputDay; zend_long inputDay;
php_int_t day; zend_long day;
php_int_t halakim; zend_long halakim;
int metonicCycle; int metonicCycle;
int metonicYear; int metonicYear;
int tishri1; int tishri1;
@ -684,18 +684,18 @@ void SdnToJewish(
* value. To verify that a date is valid, convert it to SDN and then back * value. To verify that a date is valid, convert it to SDN and then back
* and compare with the original. * and compare with the original.
*/ */
php_int_t JewishToSdn( zend_long JewishToSdn(
int year, int year,
int month, int month,
int day) int day)
{ {
php_int_t sdn; zend_long sdn;
int metonicCycle; int metonicCycle;
int metonicYear; int metonicYear;
int tishri1; int tishri1;
int tishri1After; int tishri1After;
php_int_t moladDay; zend_long moladDay;
php_int_t moladHalakim; zend_long moladHalakim;
int yearLength; int yearLength;
int lengthOfAdarIAndII; int lengthOfAdarIAndII;

View file

@ -11,7 +11,7 @@
* *
* void * void
* SdnToJulian( * SdnToJulian(
* php_int_t sdn, * zend_long sdn,
* int *pYear, * int *pYear,
* int *pMonth, * int *pMonth,
* int *pDay); * int *pDay);
@ -21,7 +21,7 @@
* will be >= -4713 and != 0; *pMonth will be in the range 1 to 12 * 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. * inclusive; *pDay will be in the range 1 to 31 inclusive.
* *
* php_int_t * zend_long
* JulianToSdn( * JulianToSdn(
* int inputYear, * int inputYear,
* int inputMonth, * int inputMonth,
@ -153,7 +153,7 @@
#define DAYS_PER_4_YEARS 1461 #define DAYS_PER_4_YEARS 1461
void SdnToJulian( void SdnToJulian(
php_int_t sdn, zend_long sdn,
int *pYear, int *pYear,
int *pMonth, int *pMonth,
int *pDay) int *pDay)
@ -161,7 +161,7 @@ void SdnToJulian(
int year; int year;
int month; int month;
int day; int day;
php_int_t temp; zend_long temp;
int dayOfYear; int dayOfYear;
if (sdn <= 0) { if (sdn <= 0) {
@ -212,7 +212,7 @@ fail:
*pDay = 0; *pDay = 0;
} }
php_int_t JulianToSdn( zend_long JulianToSdn(
int inputYear, int inputYear,
int inputMonth, int inputMonth,
int inputDay) int inputDay)

View file

@ -53,7 +53,7 @@
* *
* int y1, m1, d1; * int y1, m1, d1;
* int y2, m2, d2; * int y2, m2, d2;
* php_int_t sdn; * zend_long sdn;
* ... * ...
* sdn = GregorianToSdn(y1, m1, d1); * sdn = GregorianToSdn(y1, m1, d1);
* if (sdn > 0) { * if (sdn > 0) {
@ -68,18 +68,18 @@
#include "php.h" #include "php.h"
/* Gregorian calendar conversions. */ /* Gregorian calendar conversions. */
void SdnToGregorian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); void SdnToGregorian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
php_int_t GregorianToSdn(int year, int month, int day); zend_long GregorianToSdn(int year, int month, int day);
extern char *MonthNameShort[13]; extern char *MonthNameShort[13];
extern char *MonthNameLong[13]; extern char *MonthNameLong[13];
/* Julian calendar conversions. */ /* Julian calendar conversions. */
void SdnToJulian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); void SdnToJulian(zend_long sdn, int *pYear, int *pMonth, int *pDay);
php_int_t JulianToSdn(int year, int month, int day); zend_long JulianToSdn(int year, int month, int day);
/* Jewish calendar conversions. */ /* Jewish calendar conversions. */
void SdnToJewish(php_int_t sdn, int *pYear, int *pMonth, int *pDay); void SdnToJewish(zend_long sdn, int *pYear, int *pMonth, int *pDay);
php_int_t JewishToSdn(int year, int month, int day); zend_long JewishToSdn(int year, int month, int day);
extern char *JewishMonthName[14]; extern char *JewishMonthName[14];
extern char *JewishMonthNameLeap[14]; extern char *JewishMonthNameLeap[14];
extern char *JewishMonthHebName[14]; extern char *JewishMonthHebName[14];
@ -87,15 +87,15 @@ extern char *JewishMonthHebNameLeap[14];
extern int monthsPerYear[19]; extern int monthsPerYear[19];
/* French republic calendar conversions. */ /* French republic calendar conversions. */
void SdnToFrench(php_int_t sdn, int *pYear, int *pMonth, int *pDay); void SdnToFrench(zend_long sdn, int *pYear, int *pMonth, int *pDay);
php_int_t FrenchToSdn(int inputYear, int inputMonth, int inputDay); zend_long FrenchToSdn(int inputYear, int inputMonth, int inputDay);
extern char *FrenchMonthName[14]; extern char *FrenchMonthName[14];
/* Islamic calendar conversions. */ /* Islamic calendar conversions. */
/* Not implemented yet. */ /* Not implemented yet. */
/* Day of week conversion. 0=Sunday, 6=Saturday */ /* 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 *DayNameShort[7];
extern char *DayNameLong[7]; extern char *DayNameLong[7];

View file

@ -57,11 +57,11 @@ PHP_FUNCTION(com_create_instance)
obj = CDNO_FETCH(object); obj = CDNO_FETCH(object);
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 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, &module_name, &module_name_len, &server_name, &server_name_len,
&obj->code_page, &typelib_name, &typelib_name_len) && &obj->code_page, &typelib_name, &typelib_name_len) &&
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 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, &module_name, &module_name_len, &server_params, &obj->code_page,
&typelib_name, &typelib_name_len)) { &typelib_name, &typelib_name_len)) {
@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance)
"Server", sizeof("Server")-1))) { "Server", sizeof("Server")-1))) {
convert_to_string_ex(tmp); convert_to_string_ex(tmp);
server_name = Z_STRVAL_P(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; ctx = CLSCTX_REMOTE_SERVER;
} }
@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance)
"Username", sizeof("Username")-1))) { "Username", sizeof("Username")-1))) {
convert_to_string_ex(tmp); convert_to_string_ex(tmp);
user_name = Z_STRVAL_P(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), if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Password", sizeof("Password")-1))) { "Password", sizeof("Password")-1))) {
convert_to_string_ex(tmp); convert_to_string_ex(tmp);
password = Z_STRVAL_P(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), if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Domain", sizeof("Domain")-1))) { "Domain", sizeof("Domain")-1))) {
convert_to_string_ex(tmp); convert_to_string_ex(tmp);
domain_name = Z_STRVAL_P(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), if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params),
"Flags", sizeof("Flags")-1))) { "Flags", sizeof("Flags")-1))) {
convert_to_int_ex(tmp); 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; CLSID clsid;
char *module_name; char *module_name;
int module_name_len; int module_name_len;
php_int_t code_page = COMG(code_page); zend_long code_page = COMG(code_page);
IUnknown *unk = NULL; IUnknown *unk = NULL;
IDispatch *obj = NULL; IDispatch *obj = NULL;
HRESULT res; HRESULT res;
OLECHAR *module = NULL; OLECHAR *module = NULL;
php_com_initialize(TSRMLS_C); 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)) { &module_name, &module_name_len, &code_page)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC); php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC);
return; 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))) { 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; 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); ALLOC_HASHTABLE(obj->id_of_name_cache);
zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0); 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); 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 */ Process COM messages, sleeping for up to timeoutms milliseconds */
PHP_FUNCTION(com_message_pump) PHP_FUNCTION(com_message_pump)
{ {
php_int_t timeoutms = 0; zend_long timeoutms = 0;
MSG msg; MSG msg;
DWORD result; 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; RETURN_FALSE;
php_com_initialize(TSRMLS_C); php_com_initialize(TSRMLS_C);

View file

@ -243,7 +243,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
obj = CDNO_FETCH(object); 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, &assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len, &datatype_name, &datatype_name_len,
&obj->code_page)) { &obj->code_page)) {

View file

@ -383,12 +383,12 @@ PHP_MINIT_FUNCTION(com_dotnet)
REGISTER_INI_ENTRIES(); 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) { \ #define COM_ERR_CONST(x) { \
php_int_t __tmp; \ zend_long __tmp; \
ULongToUIntPtr(x, &__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); COM_CONST(CLSCTX_INPROC_SERVER);

View file

@ -44,7 +44,7 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
convert_to_string_ex(member); 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); DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC);
if (res == SUCCESS) { if (res == SUCCESS) {
@ -71,7 +71,7 @@ static void com_property_write(zval *object, zval *member, zval *value, void **c
VariantInit(&v); VariantInit(&v);
convert_to_string_ex(member); 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)) { DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0 TSRMLS_CC)) {
VariantClear(&v); VariantClear(&v);
} }
@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T
convert_to_int(offset); convert_to_int(offset);
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { 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); php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC);
VariantClear(&v); VariantClear(&v);
} }
@ -145,7 +145,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
} }
convert_to_int(offset); convert_to_int(offset);
indices = Z_IVAL_P(offset); indices = Z_LVAL_P(offset);
VariantInit(&v); VariantInit(&v);
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC); 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) { if (V_VT(&obj->v) == VT_DISPATCH) {
convert_to_string_ex(member); 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! */ /* TODO: distinguish between property and method! */
return 1; return 1;
} }
@ -238,7 +238,7 @@ static void function_dtor(zval *zv)
{ {
zend_internal_function *f = (zend_internal_function*)Z_PTR_P(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) { if (f->arg_info) {
efree(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.arg_info = NULL;
f.scope = obj->ce; f.scope = obj->ce;
f.fn_flags = ZEND_ACC_CALL_VIA_HANDLER; 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); f.handler = PHP_FN(com_method_handler);
fptr = &f; 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; 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 */ /* 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) { switch(type) {
case IS_INT: case IS_LONG:
vt = VT_INT; vt = VT_INT;
break; break;
case IS_DOUBLE: case IS_DOUBLE:

View file

@ -32,7 +32,7 @@
struct php_com_iterator { struct php_com_iterator {
zend_object_iterator iter; zend_object_iterator iter;
IEnumVARIANT *ev; IEnumVARIANT *ev;
php_uint_t key; zend_ulong key;
VARIANT v; /* cached element */ VARIANT v; /* cached element */
int code_page; int code_page;
VARIANT safe_array; 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); 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); ZVAL_NULL(key);
} else { } else {
ZVAL_INT(key, I->key); ZVAL_LONG(key, I->key);
} }
} }

View file

@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
message = php_win32_error_to_msg(code); message = php_win32_error_to_msg(code);
free_msg = 1; 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) { if (free_msg) {
LocalFree(message); LocalFree(message);
} }

View file

@ -439,7 +439,7 @@ CPH_METHOD(LoadFromFile)
HRESULT res; HRESULT res;
char *filename, *fullpath; char *filename, *fullpath;
int filename_len; int filename_len;
php_int_t flags = 0; zend_long flags = 0;
OLECHAR *olefilename; OLECHAR *olefilename;
CPH_FETCH(); CPH_FETCH();
@ -448,7 +448,7 @@ CPH_METHOD(LoadFromFile)
res = get_persist_file(helper); res = get_persist_file(helper);
if (helper->ipf) { 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)) { &filename, &filename_len, &flags)) {
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
return; return;
@ -506,7 +506,7 @@ CPH_METHOD(GetMaxStreamSize)
php_com_throw_exception(res, NULL TSRMLS_CC); php_com_throw_exception(res, NULL TSRMLS_CC);
} else { } else {
/* TODO: handle 64 bit properly */ /* TODO: handle 64 bit properly */
RETURN_INT((php_int_t)size.QuadPart); RETURN_LONG((zend_long)size.QuadPart);
} }
} }
/* }}} */ /* }}} */

View file

@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
VariantInit(&v); VariantInit(&v);
res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), 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); proxy->dimensions, args, 0 TSRMLS_CC);
if (res == SUCCESS) { if (res == SUCCESS) {
@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
SafeArrayGetLBound(sa, proxy->dimensions, &lbound); SafeArrayGetLBound(sa, proxy->dimensions, &lbound);
SafeArrayGetUBound(sa, proxy->dimensions, &ubound); 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); php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC);
return rv; return rv;
} }
@ -167,11 +167,11 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
/* copy indices from proxy */ /* copy indices from proxy */
for (i = 0; i < dims; i++) { for (i = 0; i < dims; i++) {
convert_to_int(&proxy->indices[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 */ /* add user-supplied index */
indices[dims-1] = Z_IVAL_P(offset); indices[dims-1] = Z_LVAL_P(offset);
/* now fetch the value */ /* now fetch the value */
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { 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]); convert_to_string(&proxy->indices[0]);
VariantInit(&v); VariantInit(&v);
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), 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)) { args, 0 TSRMLS_CC)) {
VariantClear(&v); VariantClear(&v);
} }
@ -241,12 +241,12 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
/* copy indices from proxy */ /* copy indices from proxy */
for (i = 0; i < dims; i++) { for (i = 0; i < dims; i++) {
convert_to_int(&proxy->indices[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 */ /* add user-supplied index */
convert_to_int(offset); 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) { if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY; 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) 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) 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; 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); php_com_saproxy *proxy = SA_FETCH(object);
LONG ubound, lbound; 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) { if (I->key == -1) {
ZVAL_NULL(key); ZVAL_NULL(key);
} else { } 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); I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
for (i = 0; i < proxy->dimensions; i++) { for (i = 0; i < proxy->dimensions; i++) {
convert_to_int(&proxy->indices[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); SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);

View file

@ -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); 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??? // TODO: avoid reallocation???
efree(const_name); efree(const_name);
if(c.name == NULL) { 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)) { 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); 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); ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
continue; continue;
} }
/* register the constant */ /* register the constant */
php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC); 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; c.flags = mode;
ZVAL_INT(&c.value, Z_IVAL(value)); ZVAL_LONG(&c.value, Z_LVAL(value));
c.module_number = 0; c.module_number = 0;
zend_register_constant(&c TSRMLS_CC); zend_register_constant(&c TSRMLS_CC);
} }

View file

@ -39,8 +39,8 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
HashPosition pos; HashPosition pos;
int keytype; int keytype;
zend_string *strindex; zend_string *strindex;
php_int_t intindex = -1; zend_long intindex = -1;
php_int_t max_index = 0; zend_long max_index = 0;
VARIANT *va; VARIANT *va;
zval *item; 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); safe_array_from_zval(v, z, codepage TSRMLS_CC);
break; break;
case IS_INT: case IS_LONG:
V_VT(v) = VT_I4; V_VT(v) = VT_I4;
V_I4(v) = Z_IVAL_P(z); V_I4(v) = Z_LVAL_P(z);
break; break;
case IS_DOUBLE: 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: case IS_STRING:
V_VT(v) = VT_BSTR; 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) { if (CP_UTF8 == codepage) {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR)); V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
} else { } 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); efree(olestring);
break; break;
@ -187,28 +187,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
ZVAL_NULL(z); ZVAL_NULL(z);
break; break;
case VT_UI1: case VT_UI1:
ZVAL_INT(z, (php_int_t)V_UI1(v)); ZVAL_LONG(z, (zend_long)V_UI1(v));
break; break;
case VT_I1: case VT_I1:
ZVAL_INT(z, (php_int_t)V_I1(v)); ZVAL_LONG(z, (zend_long)V_I1(v));
break; break;
case VT_UI2: case VT_UI2:
ZVAL_INT(z, (php_int_t)V_UI2(v)); ZVAL_LONG(z, (zend_long)V_UI2(v));
break; break;
case VT_I2: case VT_I2:
ZVAL_INT(z, (php_int_t)V_I2(v)); ZVAL_LONG(z, (zend_long)V_I2(v));
break; break;
case VT_UI4: /* TODO: promote to double if large? */ 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; break;
case VT_I4: case VT_I4:
ZVAL_INT(z, (php_int_t)V_I4(v)); ZVAL_LONG(z, (zend_long)V_I4(v));
break; break;
case VT_INT: case VT_INT:
ZVAL_INT(z, V_INT(v)); ZVAL_LONG(z, V_INT(v));
break; break;
case VT_UINT: /* TODO: promote to double if large? */ 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; break;
case VT_R4: case VT_R4:
ZVAL_DOUBLE(z, (double)V_R4(v)); 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() */ /* {{{ com_variant_create_instance - ctor for new VARIANT() */
PHP_FUNCTION(com_variant_create_instance) PHP_FUNCTION(com_variant_create_instance)
{ {
/* VARTYPE == unsigned short */ php_int_t vt = VT_EMPTY; /* VARTYPE == unsigned short */ zend_long vt = VT_EMPTY;
php_int_t codepage = CP_ACP; zend_long codepage = CP_ACP;
zval *object = getThis(); zval *object = getThis();
php_com_dotnet_object *obj; php_com_dotnet_object *obj;
zval *zvalue = NULL; zval *zvalue = NULL;
@ -421,7 +421,7 @@ PHP_FUNCTION(com_variant_create_instance)
obj = CDNO_FETCH(object); obj = CDNO_FETCH(object);
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 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); php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC);
return; return;
} }
@ -444,7 +444,7 @@ PHP_FUNCTION(com_variant_create_instance)
but will probably fail (original behavior) but will probably fail (original behavior)
*/ */
if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) { if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) {
php_int_t orig_vt = vt; zend_long orig_vt = vt;
vt &= ~VT_ARRAY; vt &= ~VT_ARRAY;
if (vt) { if (vt) {
@ -832,7 +832,7 @@ PHP_FUNCTION(variant_round)
zval *zleft = NULL; zval *zleft = NULL;
php_com_dotnet_object *obj; php_com_dotnet_object *obj;
int codepage = CP_ACP; int codepage = CP_ACP;
php_int_t decimals = 0; zend_long decimals = 0;
VariantInit(&left_val); VariantInit(&left_val);
VariantInit(&vres); VariantInit(&vres);
@ -867,8 +867,8 @@ PHP_FUNCTION(variant_cmp)
zval *zleft = NULL, *zright = NULL; zval *zleft = NULL, *zright = NULL;
php_com_dotnet_object *obj; php_com_dotnet_object *obj;
int codepage = CP_ACP; int codepage = CP_ACP;
php_int_t lcid = LOCALE_SYSTEM_DEFAULT; zend_long lcid = LOCALE_SYSTEM_DEFAULT;
php_int_t flags = 0; zend_long flags = 0;
/* it is safe to ignore the warning for this line; see the comments in com_handlers.c */ /* 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); STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags);
@ -876,28 +876,28 @@ PHP_FUNCTION(variant_cmp)
VariantInit(&right_val); VariantInit(&right_val);
if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 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)) { &zright, php_com_variant_class_entry, &lcid, &flags)) {
obj = CDNO_FETCH(zleft); obj = CDNO_FETCH(zleft);
vleft = &obj->v; vleft = &obj->v;
obj = CDNO_FETCH(zright); obj = CDNO_FETCH(zright);
vright = &obj->v; vright = &obj->v;
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, } 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)) { &zright, &lcid, &flags)) {
obj = CDNO_FETCH(zleft); obj = CDNO_FETCH(zleft);
vleft = &obj->v; vleft = &obj->v;
vright = &right_val; vright = &right_val;
php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC); php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC);
} else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, } 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)) { &lcid, &flags)) {
obj = CDNO_FETCH(zright); obj = CDNO_FETCH(zright);
vright = &obj->v; vright = &obj->v;
vleft = &left_val; vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
} else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() 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; vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC);
@ -909,7 +909,7 @@ PHP_FUNCTION(variant_cmp)
return; return;
} }
ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags)); ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags));
VariantClear(&left_val); VariantClear(&left_val);
VariantClear(&right_val); VariantClear(&right_val);
@ -948,7 +948,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
tmv.tm_isdst = -1; tmv.tm_isdst = -1;
tzset(); tzset();
RETVAL_INT(mktime(&tmv)); RETVAL_LONG(mktime(&tmv));
} }
VariantClear(&vres); VariantClear(&vres);
@ -959,13 +959,13 @@ PHP_FUNCTION(variant_date_to_timestamp)
Returns a variant date representation of a unix timestamp */ Returns a variant date representation of a unix timestamp */
PHP_FUNCTION(variant_date_from_timestamp) PHP_FUNCTION(variant_date_from_timestamp)
{ {
php_int_t timestamp; zend_long timestamp;
time_t ttstamp; time_t ttstamp;
SYSTEMTIME systime; SYSTEMTIME systime;
struct tm *tmv; struct tm *tmv;
VARIANT res; VARIANT res;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
&timestamp)) { &timestamp)) {
return; return;
} }
@ -1010,7 +1010,7 @@ PHP_FUNCTION(variant_get_type)
} }
obj = CDNO_FETCH(zobj); 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; zval *zobj;
php_com_dotnet_object *obj; php_com_dotnet_object *obj;
/* VARTYPE == unsigned short */ php_int_t vt; /* VARTYPE == unsigned short */ zend_long vt;
HRESULT res; HRESULT res;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 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; return;
} }
obj = CDNO_FETCH(zobj); obj = CDNO_FETCH(zobj);
@ -1055,12 +1055,12 @@ PHP_FUNCTION(variant_cast)
{ {
zval *zobj; zval *zobj;
php_com_dotnet_object *obj; php_com_dotnet_object *obj;
/* VARTYPE == unsigned short */ php_int_t vt; /* VARTYPE == unsigned short */ zend_long vt;
VARIANT vres; VARIANT vres;
HRESULT res; HRESULT res;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 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; return;
} }
obj = CDNO_FETCH(zobj); obj = CDNO_FETCH(zobj);

View file

@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
ret = DISP_E_UNKNOWNNAME; ret = DISP_E_UNKNOWNNAME;
rgDispId[i] = 0; rgDispId[i] = 0;
} else { } else {
rgDispId[i] = Z_IVAL_P(tmp); rgDispId[i] = Z_LVAL_P(tmp);
} }
efree(name); efree(name);
@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
/* Lookup the name in the hash */ /* Lookup the name in the hash */
if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) { if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) {
trace("found it\n"); trace("found it\n");
*pid = Z_IVAL_P(tmp); *pid = Z_LVAL_P(tmp);
ret = S_OK; ret = S_OK;
} }
@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) {
/* TODO: add support for overloaded objects */ /* 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. /* convert args into zvals.
* Args are in reverse order */ * Args are in reverse order */
@ -283,9 +283,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
* and expose it as a COM exception */ * and expose it as a COM exception */
if (wFlags & DISPATCH_PROPERTYGET) { 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) { } else if (wFlags & DISPATCH_PROPERTYPUT) {
zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name), &params[0] TSRMLS_CC); zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name), &params[0] TSRMLS_CC);
} else if (wFlags & DISPATCH_METHOD) { } else if (wFlags & DISPATCH_METHOD) {
zend_try { zend_try {
retval = &rv; retval = &rv;
@ -385,7 +385,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername(
FETCH_DISP("GetMemberName"); FETCH_DISP("GetMemberName");
if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { 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); *pbstrName = SysAllocString(olestr);
efree(olestr); efree(olestr);
return S_OK; return S_OK;
@ -450,7 +450,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
zend_string *name = NULL; zend_string *name = NULL;
zval *tmp, tmp2; zval *tmp, tmp2;
int keytype; int keytype;
php_uint_t pid; zend_ulong pid;
if (disp->dispid_to_name == NULL) { if (disp->dispid_to_name == NULL) {
ALLOC_HASHTABLE(disp->dispid_to_name); 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, zend_hash_get_current_key_ex(Z_OBJPROP(disp->object), &name,
&pid, 0, &pos))) { &pid, 0, &pos))) {
char namebuf[32]; char namebuf[32];
if (keytype == HASH_KEY_IS_INT) { if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid); snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid);
name = STR_INIT(namebuf, strlen(namebuf), 0); name = zend_string_init(namebuf, strlen(namebuf), 0);
} else { } else {
STR_ADDREF(name); zend_string_addref(name);
} }
zend_hash_move_forward_ex(Z_OBJPROP(disp->object), &pos); zend_hash_move_forward_ex(Z_OBJPROP(disp->object), &pos);
/* Find the existing id */ /* Find the existing id */
if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) {
STR_RELEASE(name); zend_string_release(name);
continue; continue;
} }
/* add the mappings */ /* 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); pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); 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); 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))) { &name, &pid, 0, &pos))) {
char namebuf[32]; char namebuf[32];
if (keytype == HASH_KEY_IS_INT) { if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid); snprintf(namebuf, sizeof(namebuf), "%d", pid);
name = STR_INIT(namebuf, strlen(namebuf), 0); name = zend_string_init(namebuf, strlen(namebuf), 0);
} else { } else {
STR_ADDREF(name); zend_string_addref(name);
} }
zend_hash_move_forward_ex(&Z_OBJCE(disp->object)->function_table, &pos); zend_hash_move_forward_ex(&Z_OBJCE(disp->object)->function_table, &pos);
/* Find the existing id */ /* Find the existing id */
if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) { if ((tmp = zend_hash_find(disp->name_to_dispid, name)) != NULL) {
STR_RELEASE(name); zend_string_release(name);
continue; continue;
} }
/* add the mappings */ /* 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); pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); 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); 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; zend_string *name = NULL;
zval tmp, *ntmp; zval tmp, *ntmp;
int keytype; int keytype;
php_uint_t pid; zend_ulong pid;
disp->dispid_to_name = id_to_name; 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 = while (HASH_KEY_NON_EXISTENT != (keytype =
zend_hash_get_current_key_ex(id_to_name, &name, &pid, 0, &pos))) { 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); 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); zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp);
} }

View file

@ -38,7 +38,7 @@ typedef struct _php_com_dotnet_object {
int modified; int modified;
ITypeInfo *typeinfo; ITypeInfo *typeinfo;
php_int_t code_page; zend_long code_page;
zend_class_entry *ce; zend_class_entry *ce;

View file

@ -146,11 +146,11 @@ static PHP_MINFO_FUNCTION(ctype)
zval *c, tmp; \ zval *c, tmp; \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
return; \ return; \
if (Z_TYPE_P(c) == IS_INT) { \ if (Z_TYPE_P(c) == IS_LONG) { \
if (Z_IVAL_P(c) <= 255 && Z_IVAL_P(c) >= 0) { \ if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
RETURN_BOOL(iswhat(Z_IVAL_P(c))); \ RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
} else if (Z_IVAL_P(c) >= -128 && Z_IVAL_P(c) < 0) { \ } else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
RETURN_BOOL(iswhat(Z_IVAL_P(c) + 256)); \ RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
} \ } \
tmp = *c; \ tmp = *c; \
zval_copy_ctor(&tmp); \ zval_copy_ctor(&tmp); \
@ -159,18 +159,18 @@ static PHP_MINFO_FUNCTION(ctype)
tmp = *c; \ tmp = *c; \
} \ } \
if (Z_TYPE(tmp) == IS_STRING) { \ 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 (e == p) { \
if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \ RETURN_FALSE; \
} \ } \
while (p < e) { \ while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) { \ 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; \ RETURN_FALSE; \
} \ } \
} \ } \
if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_TRUE; \ RETURN_TRUE; \
} else { \ } else { \
RETURN_FALSE; \ RETURN_FALSE; \

View file

@ -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 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 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 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()); #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; # define php_curl_ret(__ret) RETVAL_FALSE; return;
#endif #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; 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 /* {{{ 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
length = -1; length = -1;
} else if (!Z_ISUNDEF(retval)) { } else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) != IS_INT) { if (Z_TYPE(retval) != IS_LONG) {
convert_to_int_ex(&retval); convert_to_int_ex(&retval);
} }
length = Z_IVAL(retval); length = Z_LVAL(retval);
} }
zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[0]);
@ -1371,10 +1371,10 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
if (error == FAILURE) { if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION");
} else if (!Z_ISUNDEF(retval)) { } else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) != IS_INT) { if (Z_TYPE(retval) != IS_LONG) {
convert_to_int_ex(&retval); convert_to_int_ex(&retval);
} }
rval = Z_IVAL(retval); rval = Z_LVAL(retval);
} }
zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]); 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); ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]); Z_ADDREF(argv[0]);
ZVAL_INT(&argv[1], (long)dltotal); ZVAL_LONG(&argv[1], (long)dltotal);
ZVAL_INT(&argv[2], (long)dlnow); ZVAL_LONG(&argv[2], (long)dlnow);
ZVAL_INT(&argv[3], (long)ultotal); ZVAL_LONG(&argv[3], (long)ultotal);
ZVAL_INT(&argv[4], (long)ulnow); ZVAL_LONG(&argv[4], (long)ulnow);
fci.size = sizeof(fci); fci.size = sizeof(fci);
fci.function_table = EG(function_table); 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) { if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
} else if (!Z_ISUNDEF(retval)) { } else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) != IS_INT) { if (Z_TYPE(retval) != IS_LONG) {
convert_to_int_ex(&retval); convert_to_int_ex(&retval);
} }
if (0 != Z_IVAL(retval)) { if (0 != Z_LVAL(retval)) {
rval = 1; 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]); Z_ADDREF(argv[0]);
ZVAL_RES(&argv[1], t->res); ZVAL_RES(&argv[1], t->res);
Z_ADDREF(argv[1]); Z_ADDREF(argv[1]);
ZVAL_INT(&argv[2], (int)size * nmemb); ZVAL_LONG(&argv[2], (int)size * nmemb);
fci.size = sizeof(fci); fci.size = sizeof(fci);
fci.function_table = EG(function_table); 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 #endif
} else if (!Z_ISUNDEF(retval)) { } else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) == IS_STRING) { 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); memcpy(data, Z_STRVAL(retval), length);
} }
zval_ptr_dtor(&retval); 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
length = -1; length = -1;
} else if (!Z_ISUNDEF(retval)) { } else if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) != IS_INT) { if (Z_TYPE(retval) != IS_LONG) {
convert_to_int_ex(&retval); convert_to_int_ex(&retval);
} }
length = Z_IVAL(retval); length = Z_LVAL(retval);
} }
zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[0]);
zval_ptr_dtor(&argv[1]); 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 (type == CURLINFO_HEADER_OUT) {
if (ch->header.str) { if (ch->header.str) {
STR_RELEASE(ch->header.str); zend_string_release(ch->header.str);
} }
if (buf_len > 0) { 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); ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]); Z_ADDREF(argv[0]);
ZVAL_STRING(&argv[1], prompt); 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); error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv TSRMLS_CC);
if (error == FAILURE) { if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION");
} else if (Z_TYPE(retval) == IS_STRING) { } 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle");
} else { } else {
memcpy(buf, Z_STRVAL(retval), Z_STRSIZE(retval) + 1); memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1);
} }
} else { } else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func)); 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) PHP_FUNCTION(curl_version)
{ {
curl_version_info_data *d; 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; 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; 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 */ /* Long options */
case CURLOPT_SSL_VERIFYHOST: case CURLOPT_SSL_VERIFYHOST:
convert_to_int(zvalue); convert_to_int(zvalue);
if (Z_IVAL_P(zvalue) == 1) { if (Z_LVAL_P(zvalue) == 1) {
#if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */ #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"); 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 #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); convert_to_int_ex(zvalue);
#if LIBCURL_VERSION_NUM >= 0x71304 #if LIBCURL_VERSION_NUM >= 0x71304
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) && 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
return 1; return 1;
} }
#endif #endif
error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue));
break; break;
case CURLOPT_SAFE_UPLOAD: case CURLOPT_SAFE_UPLOAD:
convert_to_int_ex(zvalue); convert_to_int_ex(zvalue);
ch->safe_upload = (Z_IVAL_P(zvalue) != 0); ch->safe_upload = (Z_LVAL_P(zvalue) != 0);
break; break;
/* String options */ /* String options */
@ -2222,7 +2222,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
#endif #endif
{ {
convert_to_string_ex(zvalue); 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 */ /* 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); error = curl_easy_setopt(ch->cp, option, NULL);
} else { } else {
convert_to_string_ex(zvalue); 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; break;
} }
@ -2253,12 +2253,12 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
/* Curl private option */ /* Curl private option */
case CURLOPT_PRIVATE: case CURLOPT_PRIVATE:
convert_to_string_ex(zvalue); 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 */ /* Curl url option */
case CURLOPT_URL: case CURLOPT_URL:
convert_to_string_ex(zvalue); 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 */ /* Curl file handle options */
case CURLOPT_FILE: 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); convert_to_int_ex(zvalue);
#if LIBCURL_VERSION_NUM < 0x071304 #if LIBCURL_VERSION_NUM < 0x071304
if (PG(open_basedir) && *PG(open_basedir)) { 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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
return FAILURE; return FAILURE;
} }
} }
#endif #endif
error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue));
break; break;
case CURLOPT_HEADERFUNCTION: case CURLOPT_HEADERFUNCTION:
@ -2476,9 +2476,9 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
char *postval; char *postval;
/* Pretend we have a string_key here */ /* Pretend we have a string_key here */
if (!string_key) { if (!string_key) {
string_key = zend_int_to_str(num_key); string_key = zend_longo_str(num_key);
} else { } else {
STR_ADDREF(string_key); zend_string_addref(string_key);
} }
if (Z_TYPE_P(current) == IS_OBJECT && 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); 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); type = Z_STRVAL_P(prop);
} }
prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0 TSRMLS_CC); 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); filename = Z_STRVAL_P(prop);
} }
error = curl_formadd(&first, &last, 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); CURLFORM_END);
} }
STR_RELEASE(string_key); zend_string_release(string_key);
continue; 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, 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"); "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, if ((type = php_memnstr(name, ";type=", sizeof(";type=") - 1,
name + Z_STRSIZE_P(current)))) { name + Z_STRLEN_P(current)))) {
*type = '\0'; *type = '\0';
} }
if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1, if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1,
name + Z_STRSIZE_P(current)))) { name + Z_STRLEN_P(current)))) {
*filename = '\0'; *filename = '\0';
} }
/* open_basedir check */ /* 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_COPYNAME, string_key->val,
CURLFORM_NAMELENGTH, (long)string_key->len, CURLFORM_NAMELENGTH, (long)string_key->len,
CURLFORM_COPYCONTENTS, postval, CURLFORM_COPYCONTENTS, postval,
CURLFORM_CONTENTSLENGTH, (long)Z_STRSIZE_P(current), CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_P(current),
CURLFORM_END); CURLFORM_END);
} }
STR_RELEASE(string_key); zend_string_release(string_key);
} ZEND_HASH_FOREACH_END(); } ZEND_HASH_FOREACH_END();
SAVE_CURL_ERROR(ch, error); 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 #if LIBCURL_VERSION_NUM >= 0x071101
convert_to_string_ex(zvalue); convert_to_string_ex(zvalue);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ /* 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)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_P(zvalue));
#else #else
char *post = NULL; char *post = NULL;
convert_to_string_ex(zvalue); 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); zend_llist_add_element(&ch->to_free->str, &post);
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, 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 #endif
} }
break; break;
@ -2620,7 +2620,7 @@ static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_
case CURLOPT_RETURNTRANSFER: case CURLOPT_RETURNTRANSFER:
convert_to_int_ex(zvalue); convert_to_int_ex(zvalue);
if (Z_IVAL_P(zvalue)) { if (Z_LVAL_P(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN; ch->handlers->write->method = PHP_CURL_RETURN;
} else { } else {
ch->handlers->write->method = PHP_CURL_STDOUT; 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_RECV_SPEED_LARGE:
case CURLOPT_MAX_SEND_SPEED_LARGE: case CURLOPT_MAX_SEND_SPEED_LARGE:
convert_to_int_ex(zvalue); 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; break;
#endif #endif
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
case CURLOPT_POSTREDIR: case CURLOPT_POSTREDIR:
convert_to_int_ex(zvalue); 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; break;
#endif #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); 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 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: case CURLINFO_HEADER_OUT:
convert_to_int_ex(zvalue); 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_DEBUGFUNCTION, curl_debug);
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch); curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1); 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) PHP_FUNCTION(curl_setopt)
{ {
zval *zid, *zvalue; zval *zid, *zvalue;
php_int_t options; zend_long options;
php_curl *ch; 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; return;
} }
@ -2772,7 +2772,7 @@ PHP_FUNCTION(curl_setopt_array)
{ {
zval *zid, *arr, *entry; zval *zid, *arr, *entry;
php_curl *ch; php_curl *ch;
php_uint_t option; zend_ulong option;
zend_string *string_key; zend_string *string_key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) { 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"); "Array keys must be CURLOPT constants or equivalent integer values");
RETURN_FALSE; 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; RETURN_FALSE;
} }
} ZEND_HASH_FOREACH_END(); } ZEND_HASH_FOREACH_END();
@ -2802,7 +2802,7 @@ void _php_curl_cleanup_handle(php_curl *ch)
{ {
smart_str_free(&ch->handlers->write->buf); smart_str_free(&ch->handlers->write->buf);
if (ch->header.str) { if (ch->header.str) {
STR_RELEASE(ch->header.str); zend_string_release(ch->header.str);
ch->header.str = NULL; 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) { if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
smart_str_0(&ch->handlers->write->buf); 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 */ /* flush the file handle, so any remaining data is synched to disk */
@ -2872,9 +2872,9 @@ PHP_FUNCTION(curl_getinfo)
{ {
zval *zid; zval *zid;
php_curl *ch; 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; return;
} }
@ -2882,7 +2882,7 @@ PHP_FUNCTION(curl_getinfo)
if (ZEND_NUM_ARGS() < 2) { if (ZEND_NUM_ARGS() < 2) {
char *s_code; char *s_code;
php_int_t l_code; zend_long l_code;
double d_code; double d_code;
#if LIBCURL_VERSION_NUM > 0x071301 #if LIBCURL_VERSION_NUM > 0x071301
struct curl_certinfo *ci = NULL; struct curl_certinfo *ci = NULL;
@ -2992,7 +2992,7 @@ PHP_FUNCTION(curl_getinfo)
switch (option) { switch (option) {
case CURLINFO_HEADER_OUT: case CURLINFO_HEADER_OUT:
if (ch->header.str) { if (ch->header.str) {
RETURN_STR(STR_COPY(ch->header.str)); RETURN_STR(zend_string_copy(ch->header.str));
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -3026,10 +3026,10 @@ PHP_FUNCTION(curl_getinfo)
} }
case CURLINFO_LONG: case CURLINFO_LONG:
{ {
php_int_t code = 0; zend_long code = 0;
if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) {
RETURN_INT(code); RETURN_LONG(code);
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -3103,7 +3103,7 @@ PHP_FUNCTION(curl_errno)
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); 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 #endif
zval_ptr_dtor(&ch->handlers->std_err); zval_ptr_dtor(&ch->handlers->std_err);
if (ch->header.str) { if (ch->header.str) {
STR_RELEASE(ch->header.str); zend_string_release(ch->header.str);
} }
zval_ptr_dtor(&ch->handlers->write_header->stream); 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 */ return string describing error code */
PHP_FUNCTION(curl_strerror) PHP_FUNCTION(curl_strerror)
{ {
php_int_t code; zend_long code;
const char *str; 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; return;
} }
@ -3363,17 +3363,17 @@ PHP_FUNCTION(curl_unescape)
pause and unpause a connection */ pause and unpause a connection */
PHP_FUNCTION(curl_pause) PHP_FUNCTION(curl_pause)
{ {
php_int_t bitmask; zend_long bitmask;
zval *zid; zval *zid;
php_curl *ch; 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; return;
} }
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); 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 #endif

View file

@ -92,7 +92,7 @@ PHP_FUNCTION(curl_multi_add_handle)
zend_llist_add_element(&mh->easyh, &tmp_val); 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(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); 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); 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); curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
if (maxfd == -1) { 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); 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); 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) { if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.s) {
smart_str_0(&ch->handlers->write->buf); 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(); RETURN_EMPTY_STRING();
@ -271,12 +271,12 @@ PHP_FUNCTION(curl_multi_info_read)
} }
if (zmsgs_in_queue) { if (zmsgs_in_queue) {
zval_dtor(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); array_init(return_value);
add_assoc_int(return_value, "msg", tmp_msg->msg); add_assoc_long(return_value, "msg", tmp_msg->msg);
add_assoc_int(return_value, "result", tmp_msg->data.result); add_assoc_long(return_value, "result", tmp_msg->data.result);
/* find the original easy curl handle */ /* 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 */ return string describing error code */
PHP_FUNCTION(curl_multi_strerror) PHP_FUNCTION(curl_multi_strerror)
{ {
php_int_t code; zend_long code;
const char *str; 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; return;
} }
@ -375,7 +375,7 @@ PHP_FUNCTION(curl_multi_strerror)
#endif #endif
#if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */ #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; 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: case CURLMOPT_MAXCONNECTS:
#endif #endif
convert_to_int_ex(zvalue); 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; break;
default: 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) PHP_FUNCTION(curl_multi_setopt)
{ {
zval *z_mh, *zvalue; zval *z_mh, *zvalue;
php_int_t options; zend_long options;
php_curlm *mh; 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; return;
} }

View file

@ -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; 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_SHARE:
case CURLSHOPT_UNSHARE: case CURLSHOPT_UNSHARE:
convert_to_int_ex(zvalue); 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; break;
default: 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) PHP_FUNCTION(curl_share_setopt)
{ {
zval *zid, *zvalue; zval *zid, *zvalue;
php_int_t options; zend_long options;
php_curlsh *sh; 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; return;
} }

View file

@ -176,7 +176,7 @@ void timelib_error_container_dtor(timelib_error_container *errors)
free(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; timelib_sll ts;
@ -191,7 +191,7 @@ php_int_t timelib_date_to_int(timelib_time *d, int *error)
if (error) { if (error) {
*error = 0; *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) void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)

View file

@ -21,7 +21,7 @@
#ifndef __TIMELIB_H__ #ifndef __TIMELIB_H__
#define __TIMELIB_H__ #define __TIMELIB_H__
#include "php.h" /* for php_int_t */ #include "php.h" /* for zend_long */
#include "timelib_structs.h" #include "timelib_structs.h"
#if HAVE_LIMITS_H #if HAVE_LIMITS_H
#include <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); 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_date(timelib_time *d, int options);
void timelib_dump_rel_time(timelib_rel_time *d); void timelib_dump_rel_time(timelib_rel_time *d);

View file

@ -860,9 +860,9 @@ PHP_MINIT_FUNCTION(date)
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); 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_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_LONG_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_LONG_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_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT);
php_date_global_timezone_db = NULL; php_date_global_timezone_db = NULL;
php_date_global_timezone_db_enabled = 0; php_date_global_timezone_db_enabled = 0;
@ -962,7 +962,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
zval ztz; zval ztz;
if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &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); return Z_STRVAL(ztz);
} }
} else if (*DATEG(default_timezone)) { } else if (*DATEG(default_timezone)) {
@ -1217,9 +1217,9 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
{ {
char *format; char *format;
int format_len; 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; RETURN_FALSE;
} }
if (ZEND_NUM_ARGS() == 1) { if (ZEND_NUM_ARGS() == 1) {
@ -1373,10 +1373,10 @@ PHP_FUNCTION(idate)
{ {
char *format; char *format;
int format_len; int format_len;
php_int_t ts = 0; zend_long ts = 0;
int ret; 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; RETURN_FALSE;
} }
@ -1394,7 +1394,7 @@ PHP_FUNCTION(idate)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
RETURN_FALSE; 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 */ /* {{{ 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_time *parsed_time;
timelib_error_container *error = NULL; timelib_error_container *error = NULL;
int error2; int error2;
php_int_t retval; zend_long retval;
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (error->error_count) { if (error->error_count) {
@ -1442,14 +1442,14 @@ PHP_FUNCTION(strtotime)
char *times, *initial_ts; char *times, *initial_ts;
int time_len, error1, error2; int time_len, error1, error2;
struct timelib_error_container *error; struct timelib_error_container *error;
php_int_t preset_ts = 0, ts; zend_long preset_ts = 0, ts;
timelib_time *t, *now; timelib_time *t, *now;
timelib_tzinfo *tzi; timelib_tzinfo *tzi;
tzi = get_timezone_info(TSRMLS_C); tzi = get_timezone_info(TSRMLS_C);
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "si", &times, &time_len, &preset_ts) != FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", &times, &time_len, &preset_ts) != FAILURE) {
/* We have an initial timestamp */ /* We have an initial timestamp */
now = timelib_time_ctor(); now = timelib_time_ctor();
@ -1462,7 +1462,7 @@ PHP_FUNCTION(strtotime)
timelib_unixtime2local(now, t->sse); timelib_unixtime2local(now, t->sse);
timelib_time_dtor(t); timelib_time_dtor(t);
efree(initial_ts); efree(initial_ts);
} else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &times, &time_len, &preset_ts) != FAILURE) { } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &times, &time_len, &preset_ts) != FAILURE) {
/* We have no initial timestamp */ /* We have no initial timestamp */
now = timelib_time_ctor(); now = timelib_time_ctor();
now->tz_info = tzi; now->tz_info = tzi;
@ -1490,7 +1490,7 @@ PHP_FUNCTION(strtotime)
if (error1 || error2) { if (error1 || error2) {
RETURN_FALSE; RETURN_FALSE;
} else { } else {
RETURN_INT(ts); RETURN_LONG(ts);
} }
} }
/* }}} */ /* }}} */
@ -1498,13 +1498,13 @@ PHP_FUNCTION(strtotime)
/* {{{ php_mktime - (gm)mktime helper */ /* {{{ php_mktime - (gm)mktime helper */
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) 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_time *now;
timelib_tzinfo *tzi = NULL; timelib_tzinfo *tzi = NULL;
php_int_t ts, adjust_seconds = 0; zend_long ts, adjust_seconds = 0;
int error; 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; RETURN_FALSE;
} }
/* Initialize structure with current time */ /* Initialize structure with current time */
@ -1582,7 +1582,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (error) { if (error) {
RETURN_FALSE; RETURN_FALSE;
} else { } 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 */ Returns true(1) if it is a valid date in gregorian calendar */
PHP_FUNCTION(checkdate) 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; RETURN_FALSE;
} }
@ -1626,7 +1626,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
{ {
char *format; char *format;
int format_len; int format_len;
php_int_t timestamp = 0; zend_long timestamp = 0;
struct tm ta; struct tm ta;
int max_reallocs = 5; int max_reallocs = 5;
size_t buf_len = 256, real_len; 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; timelib_time_offset *offset = NULL;
zend_string *buf; 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, &timestamp) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &timestamp) == FAILURE) {
RETURN_FALSE; 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 /* VS2012 crt has a bug where strftime crash with %z and %Z format when the
initial buffer is too small. See initial buffer is too small. See
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */ 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) { while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) {
buf_len *= 2; buf_len *= 2;
buf = STR_REALLOC(buf, buf_len, 0); buf = zend_string_realloc(buf, buf_len, 0);
if (!--max_reallocs) { if (!--max_reallocs) {
break; break;
} }
@ -1708,10 +1708,10 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
} }
if (real_len && real_len != buf_len) { 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); RETURN_STR(buf);
} }
STR_FREE(buf); zend_string_free(buf);
RETURN_FALSE; RETURN_FALSE;
} }
/* }}} */ /* }}} */
@ -1737,7 +1737,7 @@ PHP_FUNCTION(gmstrftime)
Return current UNIX timestamp */ Return current UNIX timestamp */
PHP_FUNCTION(time) 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 */ 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_FUNCTION(localtime)
{ {
php_int_t timestamp = (php_int_t)time(NULL); zend_long timestamp = (zend_long)time(NULL);
zend_bool associative = 0; zend_bool associative = 0;
timelib_tzinfo *tzi; timelib_tzinfo *tzi;
timelib_time *ts; timelib_time *ts;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ib", &timestamp, &associative) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &timestamp, &associative) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1763,25 +1763,25 @@ PHP_FUNCTION(localtime)
array_init(return_value); array_init(return_value);
if (associative) { if (associative) {
add_assoc_int(return_value, "tm_sec", ts->s); add_assoc_long(return_value, "tm_sec", ts->s);
add_assoc_int(return_value, "tm_min", ts->i); add_assoc_long(return_value, "tm_min", ts->i);
add_assoc_int(return_value, "tm_hour", ts->h); add_assoc_long(return_value, "tm_hour", ts->h);
add_assoc_int(return_value, "tm_mday", ts->d); add_assoc_long(return_value, "tm_mday", ts->d);
add_assoc_int(return_value, "tm_mon", ts->m - 1); add_assoc_long(return_value, "tm_mon", ts->m - 1);
add_assoc_int(return_value, "tm_year", ts->y - 1900); add_assoc_long(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_long(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_long(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_isdst", ts->dst);
} else { } else {
add_next_index_int(return_value, ts->s); add_next_index_long(return_value, ts->s);
add_next_index_int(return_value, ts->i); add_next_index_long(return_value, ts->i);
add_next_index_int(return_value, ts->h); add_next_index_long(return_value, ts->h);
add_next_index_int(return_value, ts->d); add_next_index_long(return_value, ts->d);
add_next_index_int(return_value, ts->m - 1); add_next_index_long(return_value, ts->m - 1);
add_next_index_int(return_value, ts->y- 1900); add_next_index_long(return_value, ts->y- 1900);
add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); add_next_index_long(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_long(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->dst);
} }
timelib_time_dtor(ts); timelib_time_dtor(ts);
@ -1792,11 +1792,11 @@ PHP_FUNCTION(localtime)
Get date/time information */ Get date/time information */
PHP_FUNCTION(getdate) PHP_FUNCTION(getdate)
{ {
php_int_t timestamp = (php_int_t)time(NULL); zend_long timestamp = (zend_long)time(NULL);
timelib_tzinfo *tzi; timelib_tzinfo *tzi;
timelib_time *ts; timelib_time *ts;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timestamp) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timestamp) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -1808,17 +1808,17 @@ PHP_FUNCTION(getdate)
array_init(return_value); array_init(return_value);
add_assoc_int(return_value, "seconds", ts->s); add_assoc_long(return_value, "seconds", ts->s);
add_assoc_int(return_value, "minutes", ts->i); add_assoc_long(return_value, "minutes", ts->i);
add_assoc_int(return_value, "hours", ts->h); add_assoc_long(return_value, "hours", ts->h);
add_assoc_int(return_value, "mday", ts->d); add_assoc_long(return_value, "mday", ts->d);
add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d));
add_assoc_int(return_value, "mon", ts->m); add_assoc_long(return_value, "mon", ts->m);
add_assoc_int(return_value, "year", ts->y); add_assoc_long(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, "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, "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_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); 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) static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC)
{ {
date_period_it *iterator = (date_period_it *)iter; 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; date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
#define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ #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("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA);
REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); 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; date_object_handlers_period.write_property = date_period_write_property;
#define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \ #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); 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) */ /* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) { 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); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (dateobj->time->zone_type) { 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); ZVAL_STRING(&zv, dateobj->time->tz_info->name);
break; break;
case TIMELIB_ZONETYPE_OFFSET: { 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; timelib_sll utc_offset = dateobj->time->z;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d", 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; return props;
} }
ZVAL_INT(&zv, tzobj->type); ZVAL_LONG(&zv, tzobj->type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (tzobj->type) { 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); ZVAL_STRING(&zv, tzobj->tzi.tz->name);
break; break;
case TIMELIB_ZONETYPE_OFFSET: { 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", tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+', 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) \ #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); zend_hash_str_update(props, n, sizeof(n)-1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); 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) { if (z_timezone) {
convert_to_string(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_OFFSET:
case TIMELIB_ZONETYPE_ABBR: { 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; 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)); 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_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
efree(tmp); efree(tmp);
return 1 == ret; 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->tzi.tz = tzi;
tzobj->initialized = 1; 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); zval_ptr_dtor(&tmp_obj);
return 1 == ret; return 1 == ret;
} }
@ -2870,14 +2870,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) /
int i; int i;
zval element; zval element;
add_assoc_int(z, "warning_count", error->warning_count); add_assoc_long(z, "warning_count", error->warning_count);
array_init(&element); array_init(&element);
for (i = 0; i < error->warning_count; i++) { for (i = 0; i < error->warning_count; i++) {
add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message); add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message);
} }
add_assoc_zval(z, "warnings", &element); 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); array_init(&element);
for (i = 0; i < error->error_count; i++) { for (i = 0; i < error->error_count; i++) {
add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message); 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) { \ if (parsed_time->elem == -99999) { \
add_assoc_bool(return_value, #name, 0); \ add_assoc_bool(return_value, #name, 0); \
} else { \ } 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(year, y);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m); 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) { if (parsed_time->have_relative) {
array_init(&element); array_init(&element);
add_assoc_int(&element, "year", parsed_time->relative.y); add_assoc_long(&element, "year", parsed_time->relative.y);
add_assoc_int(&element, "month", parsed_time->relative.m); add_assoc_long(&element, "month", parsed_time->relative.m);
add_assoc_int(&element, "day", parsed_time->relative.d); add_assoc_long(&element, "day", parsed_time->relative.d);
add_assoc_int(&element, "hour", parsed_time->relative.h); add_assoc_long(&element, "hour", parsed_time->relative.h);
add_assoc_int(&element, "minute", parsed_time->relative.i); add_assoc_long(&element, "minute", parsed_time->relative.i);
add_assoc_int(&element, "second", parsed_time->relative.s); add_assoc_long(&element, "second", parsed_time->relative.s);
if (parsed_time->relative.have_weekday_relative) { 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)) { 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) { 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); 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) { switch (dateobj->time->zone_type) {
case TIMELIB_ZONETYPE_ID: case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info); 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); timelib_time_offset_dtor(offset);
break; break;
case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_OFFSET:
RETVAL_INT(dateobj->time->z * -60); RETVAL_LONG(dateobj->time->z * -60);
break; break;
case TIMELIB_ZONETYPE_ABBR: 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; break;
} }
return; return;
} else { } 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; 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) PHP_FUNCTION(date_time_set)
{ {
zval *object; 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; RETURN_FALSE;
} }
@ -3412,9 +3412,9 @@ PHP_FUNCTION(date_time_set)
PHP_METHOD(DateTimeImmutable, setTime) PHP_METHOD(DateTimeImmutable, setTime)
{ {
zval *object, new_object; 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; 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; 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) PHP_FUNCTION(date_date_set)
{ {
zval *object; 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; RETURN_FALSE;
} }
@ -3460,9 +3460,9 @@ PHP_FUNCTION(date_date_set)
PHP_METHOD(DateTimeImmutable, setDate) PHP_METHOD(DateTimeImmutable, setDate)
{ {
zval *object, new_object; 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; 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; 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) PHP_FUNCTION(date_isodate_set)
{ {
zval *object; 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; RETURN_FALSE;
} }
@ -3512,9 +3512,9 @@ PHP_FUNCTION(date_isodate_set)
PHP_METHOD(DateTimeImmutable, setISODate) PHP_METHOD(DateTimeImmutable, setISODate)
{ {
zval *object, new_object; 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; 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; 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) PHP_FUNCTION(date_timestamp_set)
{ {
zval *object; 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, &timestamp) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, &timestamp) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -3558,9 +3558,9 @@ PHP_FUNCTION(date_timestamp_set)
PHP_METHOD(DateTimeImmutable, setTimestamp) PHP_METHOD(DateTimeImmutable, setTimestamp)
{ {
zval *object, new_object; 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, &timestamp) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, &timestamp) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
@ -3578,7 +3578,7 @@ PHP_FUNCTION(date_timestamp_get)
{ {
zval *object; zval *object;
php_date_obj *dateobj; php_date_obj *dateobj;
php_int_t timestamp; zend_long timestamp;
int error; int error;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) { 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) { if (error) {
RETURN_FALSE; RETURN_FALSE;
} else { } else {
RETVAL_INT(timestamp); RETVAL_LONG(timestamp);
} }
} }
/* }}} */ /* }}} */
@ -3605,9 +3605,9 @@ PHP_FUNCTION(date_diff)
zval *object1, *object2; zval *object1, *object2;
php_date_obj *dateobj1, *dateobj2; php_date_obj *dateobj1, *dateobj2;
php_interval_obj *interval; 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; RETURN_FALSE;
} }
dateobj1 = Z_PHPDATE_P(object1); dateobj1 = Z_PHPDATE_P(object1);
@ -3756,7 +3756,7 @@ PHP_FUNCTION(timezone_name_get)
RETURN_STRING(tzobj->tzi.tz->name); RETURN_STRING(tzobj->tzi.tz->name);
break; break;
case TIMELIB_ZONETYPE_OFFSET: { 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; timelib_sll utc_offset = tzobj->tzi.utc_offset;
tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d", tmpstr->len = snprintf(tmpstr->val, sizeof("+05:00"), "%c%02d:%02d",
@ -3782,10 +3782,10 @@ PHP_FUNCTION(timezone_name_from_abbr)
char *abbr; char *abbr;
char *tzid; char *tzid;
int abbr_len; int abbr_len;
php_int_t gmtoffset = -1; zend_long gmtoffset = -1;
php_int_t isdst = -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; RETURN_FALSE;
} }
tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst); tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
@ -3819,14 +3819,14 @@ PHP_FUNCTION(timezone_offset_get)
switch (tzobj->type) { switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID: case TIMELIB_ZONETYPE_ID:
offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); 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); timelib_time_offset_dtor(offset);
break; break;
case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_OFFSET:
RETURN_INT(tzobj->tzi.utc_offset * -60); RETURN_LONG(tzobj->tzi.utc_offset * -60);
break; break;
case TIMELIB_ZONETYPE_ABBR: 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; break;
} }
} }
@ -3840,9 +3840,9 @@ PHP_FUNCTION(timezone_transitions_get)
zval *object, element; zval *object, element;
php_timezone_obj *tzobj; php_timezone_obj *tzobj;
unsigned int i, begin = 0, found; 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, &timestamp_begin, &timestamp_end) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
tzobj = Z_PHPTIMEZONE_P(object); tzobj = Z_PHPTIMEZONE_P(object);
@ -3853,18 +3853,18 @@ PHP_FUNCTION(timezone_transitions_get)
#define add_nominal() \ #define add_nominal() \
array_init(&element); \ 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_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_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_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \
add_next_index_zval(return_value, &element); add_next_index_zval(return_value, &element);
#define add(i,ts) \ #define add(i,ts) \
array_init(&element); \ 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_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_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_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); 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; retval = rv;
if (value != -99999) { if (value != -99999) {
ZVAL_INT(retval, value); ZVAL_LONG(retval, value);
} else { } else {
ZVAL_FALSE(retval); 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) \ #define SET_VALUE_FROM_STRUCT(n,m) \
if (strcmp(Z_STRVAL_P(member), m) == 0) { \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \
obj->diff->n = zval_get_int(value); \ obj->diff->n = zval_get_long(value); \
break; \ break; \
} }
@ -4119,7 +4119,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
do { \ do { \
zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
if (z_arg) { \ if (z_arg) { \
(*intobj)->diff->member = (itype)zval_get_int(z_arg); \ (*intobj)->diff->member = (itype)zval_get_long(z_arg); \
} else { \ } else { \
(*intobj)->diff->member = (itype)def; \ (*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) { \ if (z_arg) { \
zend_string *str = zval_get_string(z_arg); \ zend_string *str = zval_get_string(z_arg); \
DATE_A64I((*intobj)->diff->member, str->val); \ DATE_A64I((*intobj)->diff->member, str->val); \
STR_RELEASE(str); \ zend_string_release(str); \
} else { \ } else { \
(*intobj)->diff->member = -1LL; \ (*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, "%02d", (int) t->i); break;
case 'i': length = slprintf(buffer, 32, "%d", (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, "%02" ZEND_INT_FMT_SPEC, (zend_long) t->s); break;
case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (php_int_t) t->s); break; case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (zend_long) t->s); break;
case 'a': { case 'a': {
if ((int) t->days != -99999) { 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_time *b = NULL, *e = NULL;
timelib_rel_time *p = NULL; timelib_rel_time *p = NULL;
@ -4334,16 +4334,16 @@ PHP_METHOD(DatePeriod, __construct)
php_date_obj *dateobj; php_date_obj *dateobj;
php_interval_obj *intobj; php_interval_obj *intobj;
zval *start, *end = NULL, *interval; zval *start, *end = NULL, *interval;
php_int_t recurrences = 0, options = 0; zend_long recurrences = 0, options = 0;
char *isostr = NULL; char *isostr = NULL;
int isostr_len = 0; int isostr_len = 0;
timelib_time *clone; timelib_time *clone;
zend_error_handling error_handling; zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); 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, "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|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, "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|i", &isostr, &isostr_len, &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."); 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); zend_restore_error_handling(&error_handling TSRMLS_CC);
return; 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_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 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 *tzdb;
const timelib_tzdb_index_entry *table; const timelib_tzdb_index_entry *table;
int i, item_count; int i, item_count;
php_int_t what = PHP_DATE_TIMEZONE_GROUP_ALL; zend_long what = PHP_DATE_TIMEZONE_GROUP_ALL;
char *option = NULL; char *option = NULL;
int option_len = 0; 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; RETURN_FALSE;
} }
@ -4496,7 +4496,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
do { do {
array_init(&element); array_init(&element);
add_assoc_bool(&element, "dst", entry->type); 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) { if (entry->full_tz_name) {
add_assoc_string(&element, "timezone_id", entry->full_tz_name); add_assoc_string(&element, "timezone_id", entry->full_tz_name);
} else { } 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 latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude;
double h_rise, h_set, N; double h_rise, h_set, N;
timelib_sll rise, set, transit; timelib_sll rise, set, transit;
php_int_t time, retformat = 0; zend_long time, retformat = 0;
int rs; int rs;
timelib_time *t; timelib_time *t;
timelib_tzinfo *tzi; timelib_tzinfo *tzi;
zend_string *retstr; 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; RETURN_FALSE;
} }
@ -4617,7 +4617,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
} }
if (retformat == SUNFUNCS_RET_TIMESTAMP) { 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; 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 */ Returns an array with information about sun set/rise and twilight begin/end */
PHP_FUNCTION(date_sun_info) PHP_FUNCTION(date_sun_info)
{ {
php_int_t time; zend_long time;
double latitude, longitude; double latitude, longitude;
timelib_time *t, *t2; timelib_time *t, *t2;
timelib_tzinfo *tzi; timelib_tzinfo *tzi;
@ -4666,7 +4666,7 @@ PHP_FUNCTION(date_sun_info)
int dummy; int dummy;
double ddummy; 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; RETURN_FALSE;
} }
/* Initialize time struct */ /* Initialize time struct */
@ -4693,12 +4693,12 @@ PHP_FUNCTION(date_sun_info)
break; break;
default: default:
t2->sse = rise; 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; 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; 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 */ /* Get civil twilight */
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); 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; break;
default: default:
t2->sse = rise; 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; 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 */ /* Get nautical twilight */
@ -4731,9 +4731,9 @@ PHP_FUNCTION(date_sun_info)
break; break;
default: default:
t2->sse = rise; 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; 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 */ /* Get astronomical twilight */
@ -4749,9 +4749,9 @@ PHP_FUNCTION(date_sun_info)
break; break;
default: default:
t2->sse = rise; 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; 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(t);
timelib_time_dtor(t2); 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); zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv);
/* converted to larger type (int->long); must check when unserializing */ /* 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); zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv);
ZVAL_BOOL(&zv, period_obj->include_start_date); 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); ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1);
if (ht_entry && if (ht_entry &&
Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) { Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) {
period_obj->recurrences = Z_IVAL_P(ht_entry); period_obj->recurrences = Z_LVAL_P(ht_entry);
} else { } else {
return 0; return 0;
} }

View file

@ -203,7 +203,7 @@ ZEND_END_MODULE_GLOBALS(date)
#endif #endif
/* Backwards compatibility wrapper */ /* 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 void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
#if HAVE_STRFTIME #if HAVE_STRFTIME

View file

@ -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); name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos);
convert_to_string_ex(group); convert_to_string_ex(group);
convert_to_string_ex(name); convert_to_string_ex(name);
if (Z_STRSIZE_P(group) == 0) { if (Z_STRLEN_P(group) == 0) {
*key_str = Z_STRVAL_P(name); *key_str = Z_STRVAL_P(name);
*key_free = NULL; *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)); len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name));
*key_free = *key_str; *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); ZVAL_COPY(&tmp, key);
convert_to_string(&tmp); convert_to_string(&tmp);
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
len = Z_STRSIZE(tmp); len = Z_STRLEN(tmp);
zval_ptr_dtor(&tmp); zval_ptr_dtor(&tmp);
return len; return len;
@ -256,7 +256,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
zval *key; \ zval *key; \
char *key_str, *key_free; \ char *key_str, *key_free; \
size_t key_len; \ size_t key_len; \
php_int_t skip = 0; \ zend_long skip = 0; \
switch(ac) { \ switch(ac) { \
case 2: \ case 2: \
if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \ 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; \ break; \
case 3: \ 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; \ return; \
} \ } \
break; \ break; \
@ -646,7 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} else if (Z_REFCOUNTED(args[i])) { } else if (Z_REFCOUNTED(args[i])) {
Z_ADDREF(args[i]); Z_ADDREF(args[i]);
} }
keylen += Z_STRSIZE(args[i]); keylen += Z_STRLEN(args[i]);
} }
if (persistent) { if (persistent) {
@ -658,8 +658,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
keylen = 0; keylen = 0;
for(i = 0; i < ac; i++) { for(i = 0; i < ac; i++) {
memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i]));
keylen += Z_STRSIZE(args[i]); keylen += Z_STRLEN(args[i]);
} }
/* try to find if we already have this link in our persistent list */ /* try to find if we already have this link in our persistent list */
@ -1243,7 +1243,7 @@ PHP_FUNCTION(dba_handlers)
List opened databases */ List opened databases */
PHP_FUNCTION(dba_list) PHP_FUNCTION(dba_list)
{ {
php_uint_t numitems, i; zend_ulong numitems, i;
zend_resource *le; zend_resource *le;
dba_info *info; dba_info *info;

View file

@ -52,7 +52,7 @@ DBA_OPEN_FUNC(db1)
if (info->argc > 0) { if (info->argc > 0) {
convert_to_int_ex(&info->argv[0]); convert_to_int_ex(&info->argv[0]);
filemode = Z_IVAL(info->argv[0]); filemode = Z_LVAL(info->argv[0]);
} }
gmode = 0; gmode = 0;

View file

@ -73,7 +73,7 @@ DBA_OPEN_FUNC(db2)
if (info->argc > 0) { if (info->argc > 0) {
convert_to_int_ex(&info->argv[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)) { if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {

View file

@ -82,7 +82,7 @@ DBA_OPEN_FUNC(db3)
if (info->argc > 0) { if (info->argc > 0) {
convert_to_int_ex(&info->argv[0]); convert_to_int_ex(&info->argv[0]);
filemode = Z_IVAL(info->argv[0]); filemode = Z_LVAL(info->argv[0]);
} }
#ifdef DB_FCNTL_LOCKING #ifdef DB_FCNTL_LOCKING

View file

@ -119,7 +119,7 @@ DBA_OPEN_FUNC(db4)
if (info->argc > 0) { if (info->argc > 0) {
convert_to_int_ex(&info->argv[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) { if ((err=db_create(&dbp, NULL, 0)) == 0) {

View file

@ -61,7 +61,7 @@ DBA_OPEN_FUNC(dbm)
if(info->argc > 0) { if(info->argc > 0) {
convert_to_int_ex(&info->argv[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) { if(info->mode == DBA_TRUNC) {

View file

@ -55,7 +55,7 @@ DBA_OPEN_FUNC(gdbm)
if(info->argc > 0) { if(info->argc > 0) {
convert_to_int_ex(&info->argv[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); dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);

View file

@ -60,7 +60,7 @@ DBA_OPEN_FUNC(ndbm)
if(info->argc > 0) { if(info->argc > 0) {
convert_to_int_ex(&info->argv[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); dbf = dbm_open(info->path, gmode, filemode);

View file

@ -126,7 +126,7 @@ typedef struct dba_handler {
DBA_SYNC_FUNC(x); \ DBA_SYNC_FUNC(x); \
DBA_INFO_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_open);
PHP_FUNCTION(dba_popen); PHP_FUNCTION(dba_popen);

View file

@ -175,7 +175,7 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
xmlNodeSetContentLen((xmlNodePtr) attrp, str->val, str->len + 1); xmlNodeSetContentLen((xmlNodePtr) attrp, str->val, str->len + 1);
STR_RELEASE(str); zend_string_release(str);
return SUCCESS; return SUCCESS;
} }

View file

@ -110,7 +110,7 @@ int dom_characterdata_data_write(dom_object *obj, zval *newval TSRMLS_DC)
xmlNodeSetContentLen(nodep, str->val, str->len + 1); xmlNodeSetContentLen(nodep, str->val, str->len + 1);
STR_RELEASE(str); zend_string_release(str);
return SUCCESS; return SUCCESS;
} }
@ -139,7 +139,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval TSRMLS_DC)
xmlFree(content); xmlFree(content);
} }
ZVAL_INT(retval, length); ZVAL_LONG(retval, length);
return SUCCESS; return SUCCESS;
} }
@ -156,11 +156,11 @@ PHP_FUNCTION(dom_characterdata_substring_data)
xmlChar *cur; xmlChar *cur;
xmlChar *substring; xmlChar *substring;
xmlNodePtr node; xmlNodePtr node;
php_int_t offset, count; zend_long offset, count;
int length; int length;
dom_object *intern; 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; return;
} }
@ -239,11 +239,11 @@ PHP_FUNCTION(dom_characterdata_insert_data)
xmlChar *cur, *first, *second; xmlChar *cur, *first, *second;
xmlNodePtr node; xmlNodePtr node;
char *arg; char *arg;
php_int_t offset; zend_long offset;
int length, arg_len; int length, arg_len;
dom_object *intern; 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; return;
} }
@ -286,11 +286,11 @@ PHP_FUNCTION(dom_characterdata_delete_data)
zval *id; zval *id;
xmlChar *cur, *substring, *second; xmlChar *cur, *substring, *second;
xmlNodePtr node; xmlNodePtr node;
php_int_t offset, count; zend_long offset, count;
int length; int length;
dom_object *intern; 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; return;
} }
@ -342,11 +342,11 @@ PHP_FUNCTION(dom_characterdata_replace_data)
xmlChar *cur, *substring, *second = NULL; xmlChar *cur, *substring, *second = NULL;
xmlNodePtr node; xmlNodePtr node;
char *arg; char *arg;
php_int_t offset, count; zend_long offset, count;
int length, arg_len; int length, arg_len;
dom_object *intern; 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; return;
} }

View file

@ -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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document Encoding");
} }
STR_RELEASE(str); zend_string_release(str);
return SUCCESS; return SUCCESS;
} }
@ -388,7 +388,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
return FAILURE; return FAILURE;
} }
standalone = zval_get_int(newval); standalone = zval_get_long(newval);
docp->standalone = ZEND_NORMALIZE_BOOL(standalone); docp->standalone = ZEND_NORMALIZE_BOOL(standalone);
return SUCCESS; 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); docp->version = xmlStrdup((const xmlChar *) str->val);
STR_RELEASE(str); zend_string_release(str);
return SUCCESS; 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); docp->URL = xmlStrdup((const xmlChar *) str->val);
STR_RELEASE(str); zend_string_release(str);
return SUCCESS; return SUCCESS;
} }
@ -970,9 +970,9 @@ PHP_FUNCTION(dom_document_import_node)
xmlNodePtr nodep, retnodep; xmlNodePtr nodep, retnodep;
dom_object *intern, *nodeobj; dom_object *intern, *nodeobj;
int ret; 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; return;
} }
@ -1465,14 +1465,14 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
dom_object *intern; dom_object *intern;
char *source; char *source;
int source_len, refcount, ret; int source_len, refcount, ret;
php_int_t options = 0; zend_long options = 0;
id = getThis(); id = getThis();
if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) {
id = NULL; 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; return;
} }
@ -1547,9 +1547,9 @@ PHP_FUNCTION(dom_document_save)
dom_object *intern; dom_object *intern;
dom_doc_propsptr doc_props; dom_doc_propsptr doc_props;
char *file; 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; return;
} }
@ -1575,7 +1575,7 @@ PHP_FUNCTION(dom_document_save)
if (bytes == -1) { if (bytes == -1) {
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_INT(bytes); RETURN_LONG(bytes);
} }
/* }}} end dom_document_save */ /* }}} end dom_document_save */
@ -1593,9 +1593,9 @@ PHP_FUNCTION(dom_document_savexml)
dom_object *intern, *nodeobj; dom_object *intern, *nodeobj;
dom_doc_propsptr doc_props; dom_doc_propsptr doc_props;
int size, format, saveempty = 0; 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; return;
} }
@ -1698,11 +1698,11 @@ PHP_FUNCTION(dom_document_xinclude)
zval *id; zval *id;
xmlDoc *docp; xmlDoc *docp;
xmlNodePtr root; xmlNodePtr root;
php_int_t flags = 0; zend_long flags = 0;
int err; int err;
dom_object *intern; 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; return;
} }
@ -1723,7 +1723,7 @@ PHP_FUNCTION(dom_document_xinclude)
} }
if (err) { if (err) {
RETVAL_INT(err); RETVAL_LONG(err);
} else { } else {
RETVAL_FALSE; RETVAL_FALSE;
} }
@ -1772,14 +1772,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
dom_object *intern; dom_object *intern;
char *source = NULL, *valid_file = NULL; char *source = NULL, *valid_file = NULL;
int source_len = 0, valid_opts = 0; int source_len = 0, valid_opts = 0;
php_int_t flags = 0; zend_long flags = 0;
xmlSchemaParserCtxtPtr parser; xmlSchemaParserCtxtPtr parser;
xmlSchemaPtr sptr; xmlSchemaPtr sptr;
xmlSchemaValidCtxtPtr vptr; xmlSchemaValidCtxtPtr vptr;
int is_valid; int is_valid;
char resolved_path[MAXPATHLEN + 1]; 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; return;
} }
@ -1963,12 +1963,12 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
dom_doc_propsptr doc_prop; dom_doc_propsptr doc_prop;
char *source; char *source;
int source_len, refcount, ret; int source_len, refcount, ret;
php_int_t options = 0; zend_long options = 0;
htmlParserCtxtPtr ctxt; htmlParserCtxtPtr ctxt;
id = getThis(); 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; return;
} }
@ -2087,7 +2087,7 @@ PHP_FUNCTION(dom_document_save_html_file)
if (bytes == -1) { if (bytes == -1) {
RETURN_FALSE; RETURN_FALSE;
} }
RETURN_INT(bytes); RETURN_LONG(bytes);
} }
/* }}} end dom_document_save_html_file */ /* }}} end dom_document_save_html_file */

View file

@ -158,7 +158,7 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key T
zval *object = &iterator->intern.data; zval *object = &iterator->intern.data;
if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) {
ZVAL_INT(key, iter->index); ZVAL_LONG(key, iter->index);
} else { } else {
dom_object *intern = Z_DOMOBJ_P(&iterator->curobj); dom_object *intern = Z_DOMOBJ_P(&iterator->curobj);

Some files were not shown because too many files have changed in this diff Show more